* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class IntersectionResolver { /** @var DefinitionsInterface */ private $definitions; public function __construct(DefinitionsInterface $definitions) { $this->definitions = $definitions; } /** * If the provided property is an allOf schema it tries to merge all * contained sub schemas into a new schema which contains all properties * * @param IntersectionType $type * @return StructType|null */ public function resolve(IntersectionType $type): ?StructType { $items = $type->getAllOf(); if (empty($items)) { return null; } $newType = new StructType(); foreach ($items as $item) { $this->merge($newType, $item); } return $newType; } private function merge(StructType $left, TypeInterface $right) { if ($right instanceof ReferenceType) { $right = $this->definitions->getType($right->getRef()); } if (!$right instanceof StructType) { throw new \InvalidArgumentException('All of must contain only struct types'); } if ($right->getTitle()) { $left->setTitle($right->getTitle()); } if ($right->getDescription()) { $left->setDescription($right->getDescription()); } foreach ($right->getProperties() as $name => $type) { $left->addProperty($name, $type); } return $left; } } __halt_compiler();----SIGNATURE:----ViFHml0v4R0gTa1OvPK2ghq1WXYnrh75qPlkxmTQ3ihf/oxnmdyPrj+rIDEJ/5tSkAbC6ChzNGnz5nzfAhHgp0Wve8fQm1SNlODrOkmru4yRUaafGlwwv4lVTLVouNEsWOfnpW6zQjPflJgtPgARm6bd1RtgTwbkNc/16TSGNV0wOU35ZNbs+W2hSOJy+PRVnP9hkGf/XiYNO+w2d2icjZ1KIwEprZG+eVpju2DXpKoOKWpuQUZbT/BbCtxdmZpEBfSpvibkpZugBNGT36rGDSqMEqh7dQUEbzkf3ropODrkktgKJBEqrg8pocGSx4+W2xI8DRVSMT5J+ktI/Nnx1B1TJdAADTujOgt7JQRR7k/GzKCxu0mZVG8wG/gS7SzH8/BC8iX6ZSQ5mfg7D1Iy0Wtx8yqeU1t6MVJg2fVtb+C3d/G3s9HEUlO9bkwX97PktkdCq16O3LDvoSdr01I1R2Qh4eGGTtYqG2syhVZAJK8DJdCrDl4Wv4V+ccBCnd11FtVIo5LBhEeZpgzaewHl0hP/fOv6d/9QJZcAQKyTdVX7tdo3Udwcpw8+gAMCdRExBaIrY/V4DMrpR/GplWPX4KY2raCbTMlRktOzlBeA/xWcE3GHzviIY9gQsR4BIHMZ701lQ4Fy26Snqdg/GsKd0hxx5NFiZol4ckQMv1XLBcY=----ATTACHMENT:----MjU2MjQ4MzczOTE3NzMzIDE0NjgwMzk0NzQ3NTUyMjkgNzEwNjU4MDA1Nzg5ODg5MA==