* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class MethodBuilder implements MethodBuilderInterface { /** @var SchemaManagerInterface */ private $schemaManager; /** @var DefinitionsInterface */ private $definitions; /** @var MethodAbstract */ private $method; public function __construct( SchemaManagerInterface $schemaManager, DefinitionsInterface $definitions, string $methodName, ) { $this->schemaManager = $schemaManager; $this->definitions = $definitions; $this->method = Factory::getMethod($methodName); } /** * @inheritDoc */ public function setOperationId(?string $operationId): void { $this->method->setOperationId($operationId); } /** * @inheritDoc */ public function setDescription(?string $description): void { $this->method->setDescription($description); } /** * @inheritDoc */ public function setQueryParameters(?string $typeName): Builder { $builder = new Builder(); $this->definitions->addType($typeName, $builder->getType()); $this->method->setQueryParameters($typeName); return $builder; } /** * @inheritDoc */ public function setRequest(string $schemaName): void { $this->method->setRequest($this->getSchema($schemaName)); } /** * @inheritDoc */ public function addResponse(int $statusCode, string $schemaName): void { $this->method->addResponse($statusCode, $this->getSchema($schemaName)); } /** * @inheritDoc */ public function setSecurity(string $name, array $scopes): void { $this->method->setSecurity($name, $scopes); } /** * @inheritDoc */ public function setTags(array $tags): void { $this->method->setTags($tags); } /** * @inheritDoc */ public function getMethod(): MethodAbstract { return $this->method; } private function getSchema(string $schemaName): string { $schema = $this->schemaManager->getSchema($schemaName); $type = $schema->getType(); if (!$type instanceof ReferenceType) { throw new InvalidSchemaException('Provided schema contains not a reference'); } $this->definitions->merge($schema->getDefinitions()); return $type->getRef(); } } __halt_compiler();----SIGNATURE:----YhHQK3Qh4cFyCp7fkin0ITpRdN8ZuFIyI/5/WoUOjA7Gi0I29GOy/YH2V+rbEolUJpRQ6/EeAqDIhAK5Bn+BSsphOb/Vmd15ouKLFnaFm/eLsezglCU845tgDfRqqXHXMufMdqLpcLIvNmYMZ+ABHfPul0q89qSB7FfRhVwx5OHQ924vLL3I9Mo9PqTjlk+Q1C8Zl+L6rwEcfxE8q56AROvKCfESnf46RFZb4DVPR5uDV8W6sLBjSwuhBErumK+gAF2bnIEKd9wDh7NDYZylKQZz1v8eT7IKpdArrr230RDmzgOOl+2AyV1M9Iw+KUGE8qcJajaGVIFToxmAsNwuKV9U0qvlpV8mb3VTdHOVFq5aFf7/RQ+f0AlG284uR/Ku//EPaxXGrxpyvkfNOylavUwPQCQpXrHgX4RQn12/yX5r2WABKktdSGx3nHq4jvL56eHUUuzAggl57q3Q0KAXz31HDZOG1ZZxBO04oIqewubJh8b8X3JiqLOFQlV/YPlHdIOl3KqpREHNGzMWVWEs9vDSVvAjRN5aRdrb+wbuFH8GQaJvBlMRes9d9+aaqVRHpoSWrfLyzJ8t//SPCgOEHpYumZtAiku5UOdFxOedxtkvhqC53ZJPMwvzo6sYg2Dtyb+4bHyTw4OqSNe/q5E9orUcScwj0LeC3LtKU0swqXw=----ATTACHMENT:----OTQwNDM1Mzg5OTQxMzQzMCA5NDYyOTYyMDM3ODI4Mzk0IDczNDIxNDM1ODI5NTY1MTE=