* @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:----rMeDrMnlBKnnqCh0lPuyGy5tRMoicN2oJ7zHV6Wvt8yUDH+yB/xVpRLXzTktD7toupfnJUjT5lWq9C5NmrBgfumqShjsCTpKprEfs2mfVSzbrWFPgfxjsUNBQxacb4Of0psGtmos4/9wRnBiaoG00wAbbOuqx9zJzM8JIyxIG/cVe20JAAibAoYw+sAQEBKA1bfUt4uAcSikTwE+0XPOFnUoMtONawVaWrxWhh9pkNtJ1UlCcMJ7P+NDB0N0vdT10x0iIw8xxYj751g7/kVYgNnQXEW3n8cdUJJ9octuEzjh+Tal6lNRI7Es8U0faSY+TfMGa74SF+xgsHtC4kQQCOTLpiFJ4UKw988zew1H5AmMWig21I+8XbWyjF10XAP3OOBAkK8t+PYUYvdS6q0xDKBjK2aSaqdS2EDDquSx15LWNwy483NCOzmortTs0LT1tJLK/LRyaIwldxBSxWo7OcCUPXSVRdAfdcK7HkJiNq3wcNqgxDMPjmriUbmIDKSJvTLkVguutSrLf+q4ohcLWR3p9dTamtbCp3vJng7h1Aopadttw0z5OX38iKMZXV64jUQwXxkgRCC+1MTSbYZb8/htx4CA1SrsaqcJdqgDjXMRGM2xdplwbDqAKMZzenApQ2qiSxoTxvnRX6oKuAwDpNuvN1K8xVMik6KOPARMfhA=----ATTACHMENT:----Njk2OTc0NjE4NjIwMDk0OSA5ODQ5OTIzMTQzODkxMDUgOTU3ODU4OTM4NjA3MzkwMQ==