* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ abstract class MethodAbstract { use TagableTrait; /** @var string */ protected $operationId; /** @var string */ protected $description; /** @var string */ protected $queryParameters; /** @var string */ protected $request; /** @var array */ protected $responses; /** @var array */ protected $security; public function __construct() { $this->responses = []; } /** * @param string $operationId */ public function setOperationId(?string $operationId) { $this->operationId = $operationId; } /** * @return string */ public function getOperationId(): ?string { return $this->operationId; } /** * @param string $description */ public function setDescription(?string $description) { $this->description = $description; } /** * @return string */ public function getDescription(): ?string { return $this->description; } /** * @param string $typeName */ public function setQueryParameters(?string $typeName) { $this->queryParameters = $typeName; } /** * @return string */ public function getQueryParameters(): ?string { return $this->queryParameters; } /** * @return bool */ public function hasQueryParameters(): bool { return !empty($this->queryParameters); } /** * @param string $typeName */ public function setRequest(?string $typeName) { $this->request = $typeName; } /** * @return string */ public function getRequest(): ?string { return $this->request; } /** * @return bool */ public function hasRequest(): bool { return !empty($this->request); } /** * @param integer $statusCode * @param string $typeName */ public function addResponse(int $statusCode, string $typeName) { $this->responses[$statusCode] = $typeName; } /** * @return array */ public function getResponses(): array { return $this->responses; } /** * @param int $statusCode * @return string */ public function getResponse(int $statusCode): ?string { if (isset($this->responses[$statusCode])) { return $this->responses[$statusCode]; } else { throw new RuntimeException('Status code response ' . $statusCode . ' is not available for this resource'); } } /** * @param int $statusCode * @return bool */ public function hasResponse($statusCode): bool { return isset($this->responses[$statusCode]); } /** * @param string $name * @param array $scopes */ public function setSecurity(string $name, array $scopes) { $this->security[$name] = $scopes; } /** * @return array */ public function getSecurity(): ?array { return $this->security; } /** * @return bool */ public function hasSecurity(): bool { return !empty($this->security); } /** * Returns the uppercase name of the method * * @return string */ abstract public function getName(): string; public function toArray(): array { $responses = []; foreach ($this->responses as $statusCode => $response) { $responses[$statusCode] = $response; } return array_filter([ 'operationId' => $this->operationId, 'description' => $this->description, 'security' => $this->security, 'tags' => $this->tags, 'queryParameters' => $this->queryParameters, 'request' => $this->request, 'responses' => $responses, ], function($value){ return $value !== null; }); } } __halt_compiler();----SIGNATURE:----lhuA3l6ZFTW2Kph2IJQm3NUU4s0YYzazu3x/sXYYJXE2xRBZkVdLba7mN2yzzZfwrIKmugtWWB3elma+2UVDO0yfwOp8H55Njj3Qo/e3bSg7wPEIS1czyATXl9fqpCj3muVE0zhpF1Om08X2JoEI1VuyuXXifmodAyymU2HqHtsoK4/CM0WMqLrZhydBz3MZdmYKD47CtN87JLytmsus5aKz45hlE1q+zZ4iNKR7ujkFHm2WFk8giSjQPwJ4XUS1cyC7bv2mwjnefHyk1m7NSIN6I7BW+NFsVgLplWykIajm0fYmRvhNNk68CPGU92qedQWciZu9vSBvyOTAmuTcwbUsYnAMA4dDPI9mfilRYfA9IXLd8mmwE2FKrGXDxybd4p6UDdJT47wsahyUdwc49+6Lpl9AVfY1p1fYCRHPFZ9FYNXOrLPVg6xlXmmP2GCdI5XnBuPDgYajGvvhsdJkOvRPRj+6q3PYQNsskANsY4G2t8IvUwxQdXLMQ/pwxqEPbPnFPbabk9I0u2n4/T8fsmo22WxyBO5+mrg8YLHbIPFxxOH0CrTfx+VpSJDZtqvNlJoiXTb9EvLRWRRJm9V4y6Ni+IUwcKPMtpHhOrVL3kPrpDvC3sVRXWbGWITmpFXG9x2UWgzQpOKGzzrSWKPOvBSStYwbhkeUJCEXF6+D174=----ATTACHMENT:----NDM1MjcxMzQ1NDI5Mzc3NyA4Mzk4NjE5NjYwODE1ODA5IDIzNDQwMDEwMTEwNjIwMjc=