* @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:----qMQO7Xj+JShAODK2RsWWI4FZ9iYmAHukBI427KVoEHGmTQ7piIHu9L9SWHo4KwMAaMuaKlz6zlwuhyeEpoCleOzBnrflzA8mdR8XGn4km3o9ZjK+UljlvjzsYePpq4GmebamrcUq0lldLz8uZV2gA3SNOyQzL43lX6qVT/9DH3Kj1qbhNOZ6emsWyqrMAVkbe9n3gZTNUS3oS4etUygB0KGZYrktfz0M/gxWw7VzNSVhU+3pJYGdq5DH1eR1AERv019A7yklemJgT4peqf9mVNsU2OzmZhRxotS8l/wu8YymfmEY7EpCi+J0xotkBoOJH978AIdItZXaqavpvMudEcgNkoRTKBybeL6MsMqPPcujwSwvdTWbRug6ew5ziOXa0+ZdfISgkAz90Thtxi3y8+71Cq3/0gauC0tw762keiEGptykKz0gXCENQjBU4PXl6x0uGpfZrLQER3H93e3NpWhBMH4gPWzEMYuZk3wpiPXY14eO/byBpw+or/osfkjfSlQyWw8+DHxImQPtvHpD58D81g6a2ectz+t3rTI7mTVffaYsrHly/YH7d2DShH6Gxcy401m6Bq0f4izil7o5T4yic0odiqZxGVr5ccA6XSNyLWMICqeEz1L9tcP88xOzUKjFQr3JUuiQwgeSjgxist6jwZYpTWghn8RjLblQhMY=----ATTACHMENT:----NzA3NzU4MTM3NDkxMDg4NyA0ODM2NzQzMzQ0NTMxMjIzIDQzMjMxMjU0NDY0ODQ0Mzk=