Use parameter class in method class

This commit is contained in:
Jake Barnby 2025-03-27 21:03:10 +13:00
parent 6615c1a382
commit 254c12b084
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C

View file

@ -20,16 +20,14 @@ class Method
* @param string $description * @param string $description
* @param array<AuthType> $auth * @param array<AuthType> $auth
* @param array<SDKResponse> $responses * @param array<SDKResponse> $responses
* @param ContentType $responseType * @param ContentType $contentType
* @param MethodType|null $methodType * @param MethodType|null $type
* @param bool $deprecated * @param bool $deprecated
* @param array|bool $hide * @param array|bool $hide
* @param bool $packaging * @param bool $packaging
* @param string $requestType * @param ContentType $requestType
* @param array $parameters * @param array<Parameter> $parameters
* @param array $additionalParameters * @param array $additionalParameters
*
* @throws \Exception
*/ */
public function __construct( public function __construct(
protected string $namespace, protected string $namespace,
@ -42,16 +40,16 @@ class Method
protected bool $deprecated = false, protected bool $deprecated = false,
protected array|bool $hide = false, protected array|bool $hide = false,
protected bool $packaging = false, protected bool $packaging = false,
protected string $requestType = 'application/json', protected ContentType $requestType = ContentType::JSON,
protected array $parameters = [], protected array $parameters = [],
protected array $additionalParameters = [] protected array $additionalParameters = []
) { )
{
$this->validateMethod($name, $namespace); $this->validateMethod($name, $namespace);
$this->validateAuthTypes($auth); $this->validateAuthTypes($auth);
$this->validateDesc($description); $this->validateDesc($description);
foreach ($responses as $response) { foreach ($responses as $response) {
/** @var SDKResponse $response */
$this->validateResponseModel($response->getModel()); $this->validateResponseModel($response->getModel());
$this->validateNoContent($response); $this->validateNoContent($response);
} }
@ -189,6 +187,9 @@ class Method
return $this->requestType; return $this->requestType;
} }
/**
* @return array<Parameter>
*/
public function getParameters(): array public function getParameters(): array
{ {
return $this->parameters; return $this->parameters;