forked from loafle/openapi-generator-original
Regenerate php-nextgen-sample (#19556)
* Regenerate php-nextgen-sample * Add missing changes
This commit is contained in:
parent
8171648eb4
commit
1658264261
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
return PhpCsFixer\Config::create()
|
||||
->setUsingCache(true)
|
||||
->setRules([
|
||||
'@PSR2' => true,
|
||||
'ordered_imports' => true,
|
||||
'phpdoc_order' => true,
|
||||
'array_syntax' => [ 'syntax' => 'short' ],
|
||||
'strict_comparison' => true,
|
||||
'strict_param' => true,
|
||||
'no_trailing_whitespace' => false,
|
||||
'no_trailing_whitespace_in_comment' => false,
|
||||
'braces' => false,
|
||||
'single_blank_line_at_eof' => false,
|
||||
'blank_line_after_namespace' => false,
|
||||
])
|
||||
->setFinder(
|
||||
PhpCsFixer\Finder::create()
|
||||
->exclude('test')
|
||||
->exclude('tests')
|
||||
->in(__DIR__)
|
||||
);
|
@ -1,12 +0,0 @@
|
||||
path:
|
||||
- ./lib
|
||||
- ./test
|
||||
- ./tests
|
||||
jobs: 10
|
||||
extensions:
|
||||
- php
|
||||
exclude:
|
||||
- vendor
|
||||
warning: true
|
||||
memory-limit: -1
|
||||
no-cache: true
|
@ -1,9 +0,0 @@
|
||||
# # CatAllOf
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**declawed** | **bool** | | [optional]
|
||||
|
||||
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
|
@ -1,9 +0,0 @@
|
||||
# # DogAllOf
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**breed** | **string** | | [optional]
|
||||
|
||||
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
|
@ -1,9 +0,0 @@
|
||||
# # InlineResponseDefault
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**string** | [**\OpenAPI\Client\Model\Foo**](Foo.md) | | [optional]
|
||||
|
||||
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
|
@ -1,425 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* AnotherFakeApi
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Api;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\ClientInterface;
|
||||
use GuzzleHttp\Exception\ConnectException;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use GuzzleHttp\Psr7\MultipartStream;
|
||||
use GuzzleHttp\Psr7\Request;
|
||||
use GuzzleHttp\RequestOptions;
|
||||
use OpenAPI\Client\ApiException;
|
||||
use OpenAPI\Client\Configuration;
|
||||
use OpenAPI\Client\HeaderSelector;
|
||||
use OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* AnotherFakeApi Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class AnotherFakeApi
|
||||
{
|
||||
/**
|
||||
* @var ClientInterface
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* @var Configuration
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @var HeaderSelector
|
||||
*/
|
||||
protected $headerSelector;
|
||||
|
||||
/**
|
||||
* @var int Host index
|
||||
*/
|
||||
protected $hostIndex;
|
||||
|
||||
/** @var string[] $contentTypes **/
|
||||
public const contentTypes = [
|
||||
'call123TestSpecialTags' => [
|
||||
'application/json',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* @param ClientInterface $client
|
||||
* @param Configuration $config
|
||||
* @param HeaderSelector $selector
|
||||
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
|
||||
*/
|
||||
public function __construct(
|
||||
ClientInterface $client = null,
|
||||
Configuration $config = null,
|
||||
HeaderSelector $selector = null,
|
||||
$hostIndex = 0
|
||||
) {
|
||||
$this->client = $client ?: new Client();
|
||||
$this->config = $config ?: new Configuration();
|
||||
$this->headerSelector = $selector ?: new HeaderSelector();
|
||||
$this->hostIndex = $hostIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the host index
|
||||
*
|
||||
* @param int $hostIndex Host index (required)
|
||||
*/
|
||||
public function setHostIndex($hostIndex): void
|
||||
{
|
||||
$this->hostIndex = $hostIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the host index
|
||||
*
|
||||
* @return int Host index
|
||||
*/
|
||||
public function getHostIndex()
|
||||
{
|
||||
return $this->hostIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Configuration
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation call123TestSpecialTags
|
||||
*
|
||||
* To test special tags
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
|
||||
*
|
||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \OpenAPI\Client\Model\Client
|
||||
*/
|
||||
public function call123TestSpecialTags($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
|
||||
{
|
||||
list($response) = $this->call123TestSpecialTagsWithHttpInfo($client, $contentType);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation call123TestSpecialTagsWithHttpInfo
|
||||
*
|
||||
* To test special tags
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
|
||||
*
|
||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||
* @throws \InvalidArgumentException
|
||||
* @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings)
|
||||
*/
|
||||
public function call123TestSpecialTagsWithHttpInfo($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
|
||||
{
|
||||
$request = $this->call123TestSpecialTagsRequest($client, $contentType);
|
||||
|
||||
try {
|
||||
$options = $this->createHttpClientOption();
|
||||
try {
|
||||
$response = $this->client->send($request, $options);
|
||||
} catch (RequestException $e) {
|
||||
throw new ApiException(
|
||||
"[{$e->getCode()}] {$e->getMessage()}",
|
||||
(int) $e->getCode(),
|
||||
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
|
||||
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
|
||||
);
|
||||
} catch (ConnectException $e) {
|
||||
throw new ApiException(
|
||||
"[{$e->getCode()}] {$e->getMessage()}",
|
||||
(int) $e->getCode(),
|
||||
null,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
$statusCode = $response->getStatusCode();
|
||||
|
||||
if ($statusCode < 200 || $statusCode > 299) {
|
||||
throw new ApiException(
|
||||
sprintf(
|
||||
'[%d] Error connecting to the API (%s)',
|
||||
$statusCode,
|
||||
(string) $request->getUri()
|
||||
),
|
||||
$statusCode,
|
||||
$response->getHeaders(),
|
||||
(string) $response->getBody()
|
||||
);
|
||||
}
|
||||
|
||||
switch($statusCode) {
|
||||
case 200:
|
||||
if ('\OpenAPI\Client\Model\Client' === '\SplFileObject') {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('\OpenAPI\Client\Model\Client' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Client', []),
|
||||
$response->getStatusCode(),
|
||||
$response->getHeaders()
|
||||
];
|
||||
}
|
||||
|
||||
$returnType = '\OpenAPI\Client\Model\Client';
|
||||
if ($returnType === '\SplFileObject') {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
ObjectSerializer::deserialize($content, $returnType, []),
|
||||
$response->getStatusCode(),
|
||||
$response->getHeaders()
|
||||
];
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = ObjectSerializer::deserialize(
|
||||
$e->getResponseBody(),
|
||||
'\OpenAPI\Client\Model\Client',
|
||||
$e->getResponseHeaders()
|
||||
);
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation call123TestSpecialTagsAsync
|
||||
*
|
||||
* To test special tags
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||
*/
|
||||
public function call123TestSpecialTagsAsync($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
|
||||
{
|
||||
return $this->call123TestSpecialTagsAsyncWithHttpInfo($client, $contentType)
|
||||
->then(
|
||||
function ($response) {
|
||||
return $response[0];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation call123TestSpecialTagsAsyncWithHttpInfo
|
||||
*
|
||||
* To test special tags
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||
*/
|
||||
public function call123TestSpecialTagsAsyncWithHttpInfo($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
|
||||
{
|
||||
$returnType = '\OpenAPI\Client\Model\Client';
|
||||
$request = $this->call123TestSpecialTagsRequest($client, $contentType);
|
||||
|
||||
return $this->client
|
||||
->sendAsync($request, $this->createHttpClientOption())
|
||||
->then(
|
||||
function ($response) use ($returnType) {
|
||||
if ($returnType === '\SplFileObject') {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
ObjectSerializer::deserialize($content, $returnType, []),
|
||||
$response->getStatusCode(),
|
||||
$response->getHeaders()
|
||||
];
|
||||
},
|
||||
function ($exception) {
|
||||
$response = $exception->getResponse();
|
||||
$statusCode = $response->getStatusCode();
|
||||
throw new ApiException(
|
||||
sprintf(
|
||||
'[%d] Error connecting to the API (%s)',
|
||||
$statusCode,
|
||||
$exception->getRequest()->getUri()
|
||||
),
|
||||
$statusCode,
|
||||
$response->getHeaders(),
|
||||
(string) $response->getBody()
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create request for operation 'call123TestSpecialTags'
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Psr7\Request
|
||||
*/
|
||||
public function call123TestSpecialTagsRequest($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
|
||||
{
|
||||
|
||||
// verify the required parameter 'client' is set
|
||||
if ($client === null || (is_array($client) && count($client) === 0)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'Missing the required parameter $client when calling call123TestSpecialTags'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$resourcePath = '/another-fake/dummy';
|
||||
$formParams = [];
|
||||
$queryParams = [];
|
||||
$headerParams = [];
|
||||
$httpBody = '';
|
||||
$multipart = false;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$headers = $this->headerSelector->selectHeaders(
|
||||
['application/json', ],
|
||||
$contentType,
|
||||
$multipart
|
||||
);
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($client)) {
|
||||
if (stripos($headers['Content-Type'], 'application/json') !== false) {
|
||||
# if Content-Type contains "application/json", json_encode the body
|
||||
$httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($client));
|
||||
} else {
|
||||
$httpBody = $client;
|
||||
}
|
||||
} elseif (count($formParams) > 0) {
|
||||
if ($multipart) {
|
||||
$multipartContents = [];
|
||||
foreach ($formParams as $formParamName => $formParamValue) {
|
||||
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
|
||||
foreach ($formParamValueItems as $formParamValueItem) {
|
||||
$multipartContents[] = [
|
||||
'name' => $formParamName,
|
||||
'contents' => $formParamValueItem
|
||||
];
|
||||
}
|
||||
}
|
||||
// for HTTP post (form)
|
||||
$httpBody = new MultipartStream($multipartContents);
|
||||
|
||||
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
||||
# if Content-Type contains "application/json", json_encode the form parameters
|
||||
$httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
|
||||
} else {
|
||||
// for HTTP post (form)
|
||||
$httpBody = ObjectSerializer::buildQuery($formParams);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$defaultHeaders = [];
|
||||
if ($this->config->getUserAgent()) {
|
||||
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
|
||||
}
|
||||
|
||||
$headers = array_merge(
|
||||
$defaultHeaders,
|
||||
$headerParams,
|
||||
$headers
|
||||
);
|
||||
|
||||
$operationHost = $this->config->getHost();
|
||||
$query = ObjectSerializer::buildQuery($queryParams);
|
||||
return new Request(
|
||||
'PATCH',
|
||||
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
|
||||
$headers,
|
||||
$httpBody
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create http client option
|
||||
*
|
||||
* @throws \RuntimeException on file opening failure
|
||||
* @return array of http client options
|
||||
*/
|
||||
protected function createHttpClientOption()
|
||||
{
|
||||
$options = [];
|
||||
if ($this->config->getDebug()) {
|
||||
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
|
||||
if (!$options[RequestOptions::DEBUG]) {
|
||||
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
@ -1,398 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* DefaultApi
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Api;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\ClientInterface;
|
||||
use GuzzleHttp\Exception\ConnectException;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use GuzzleHttp\Psr7\MultipartStream;
|
||||
use GuzzleHttp\Psr7\Request;
|
||||
use GuzzleHttp\RequestOptions;
|
||||
use OpenAPI\Client\ApiException;
|
||||
use OpenAPI\Client\Configuration;
|
||||
use OpenAPI\Client\HeaderSelector;
|
||||
use OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* DefaultApi Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class DefaultApi
|
||||
{
|
||||
/**
|
||||
* @var ClientInterface
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* @var Configuration
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @var HeaderSelector
|
||||
*/
|
||||
protected $headerSelector;
|
||||
|
||||
/**
|
||||
* @var int Host index
|
||||
*/
|
||||
protected $hostIndex;
|
||||
|
||||
/** @var string[] $contentTypes **/
|
||||
public const contentTypes = [
|
||||
'fooGet' => [
|
||||
'application/json',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* @param ClientInterface $client
|
||||
* @param Configuration $config
|
||||
* @param HeaderSelector $selector
|
||||
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
|
||||
*/
|
||||
public function __construct(
|
||||
ClientInterface $client = null,
|
||||
Configuration $config = null,
|
||||
HeaderSelector $selector = null,
|
||||
$hostIndex = 0
|
||||
) {
|
||||
$this->client = $client ?: new Client();
|
||||
$this->config = $config ?: new Configuration();
|
||||
$this->headerSelector = $selector ?: new HeaderSelector();
|
||||
$this->hostIndex = $hostIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the host index
|
||||
*
|
||||
* @param int $hostIndex Host index (required)
|
||||
*/
|
||||
public function setHostIndex($hostIndex): void
|
||||
{
|
||||
$this->hostIndex = $hostIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the host index
|
||||
*
|
||||
* @return int Host index
|
||||
*/
|
||||
public function getHostIndex()
|
||||
{
|
||||
return $this->hostIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Configuration
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation fooGet
|
||||
*
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fooGet'] to see the possible values for this operation
|
||||
*
|
||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \OpenAPI\Client\Model\FooGetDefaultResponse
|
||||
*/
|
||||
public function fooGet(string $contentType = self::contentTypes['fooGet'][0])
|
||||
{
|
||||
list($response) = $this->fooGetWithHttpInfo($contentType);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation fooGetWithHttpInfo
|
||||
*
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fooGet'] to see the possible values for this operation
|
||||
*
|
||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||
* @throws \InvalidArgumentException
|
||||
* @return array of \OpenAPI\Client\Model\FooGetDefaultResponse, HTTP status code, HTTP response headers (array of strings)
|
||||
*/
|
||||
public function fooGetWithHttpInfo(string $contentType = self::contentTypes['fooGet'][0])
|
||||
{
|
||||
$request = $this->fooGetRequest($contentType);
|
||||
|
||||
try {
|
||||
$options = $this->createHttpClientOption();
|
||||
try {
|
||||
$response = $this->client->send($request, $options);
|
||||
} catch (RequestException $e) {
|
||||
throw new ApiException(
|
||||
"[{$e->getCode()}] {$e->getMessage()}",
|
||||
(int) $e->getCode(),
|
||||
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
|
||||
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
|
||||
);
|
||||
} catch (ConnectException $e) {
|
||||
throw new ApiException(
|
||||
"[{$e->getCode()}] {$e->getMessage()}",
|
||||
(int) $e->getCode(),
|
||||
null,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
$statusCode = $response->getStatusCode();
|
||||
|
||||
if ($statusCode < 200 || $statusCode > 299) {
|
||||
throw new ApiException(
|
||||
sprintf(
|
||||
'[%d] Error connecting to the API (%s)',
|
||||
$statusCode,
|
||||
(string) $request->getUri()
|
||||
),
|
||||
$statusCode,
|
||||
$response->getHeaders(),
|
||||
(string) $response->getBody()
|
||||
);
|
||||
}
|
||||
|
||||
switch($statusCode) {
|
||||
default:
|
||||
if ('\OpenAPI\Client\Model\FooGetDefaultResponse' === '\SplFileObject') {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('\OpenAPI\Client\Model\FooGetDefaultResponse' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\FooGetDefaultResponse', []),
|
||||
$response->getStatusCode(),
|
||||
$response->getHeaders()
|
||||
];
|
||||
}
|
||||
|
||||
$returnType = '\OpenAPI\Client\Model\FooGetDefaultResponse';
|
||||
if ($returnType === '\SplFileObject') {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
ObjectSerializer::deserialize($content, $returnType, []),
|
||||
$response->getStatusCode(),
|
||||
$response->getHeaders()
|
||||
];
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
default:
|
||||
$data = ObjectSerializer::deserialize(
|
||||
$e->getResponseBody(),
|
||||
'\OpenAPI\Client\Model\FooGetDefaultResponse',
|
||||
$e->getResponseHeaders()
|
||||
);
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation fooGetAsync
|
||||
*
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fooGet'] to see the possible values for this operation
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||
*/
|
||||
public function fooGetAsync(string $contentType = self::contentTypes['fooGet'][0])
|
||||
{
|
||||
return $this->fooGetAsyncWithHttpInfo($contentType)
|
||||
->then(
|
||||
function ($response) {
|
||||
return $response[0];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation fooGetAsyncWithHttpInfo
|
||||
*
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fooGet'] to see the possible values for this operation
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||
*/
|
||||
public function fooGetAsyncWithHttpInfo(string $contentType = self::contentTypes['fooGet'][0])
|
||||
{
|
||||
$returnType = '\OpenAPI\Client\Model\FooGetDefaultResponse';
|
||||
$request = $this->fooGetRequest($contentType);
|
||||
|
||||
return $this->client
|
||||
->sendAsync($request, $this->createHttpClientOption())
|
||||
->then(
|
||||
function ($response) use ($returnType) {
|
||||
if ($returnType === '\SplFileObject') {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
ObjectSerializer::deserialize($content, $returnType, []),
|
||||
$response->getStatusCode(),
|
||||
$response->getHeaders()
|
||||
];
|
||||
},
|
||||
function ($exception) {
|
||||
$response = $exception->getResponse();
|
||||
$statusCode = $response->getStatusCode();
|
||||
throw new ApiException(
|
||||
sprintf(
|
||||
'[%d] Error connecting to the API (%s)',
|
||||
$statusCode,
|
||||
$exception->getRequest()->getUri()
|
||||
),
|
||||
$statusCode,
|
||||
$response->getHeaders(),
|
||||
(string) $response->getBody()
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create request for operation 'fooGet'
|
||||
*
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fooGet'] to see the possible values for this operation
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Psr7\Request
|
||||
*/
|
||||
public function fooGetRequest(string $contentType = self::contentTypes['fooGet'][0])
|
||||
{
|
||||
|
||||
|
||||
$resourcePath = '/foo';
|
||||
$formParams = [];
|
||||
$queryParams = [];
|
||||
$headerParams = [];
|
||||
$httpBody = '';
|
||||
$multipart = false;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$headers = $this->headerSelector->selectHeaders(
|
||||
['application/json', ],
|
||||
$contentType,
|
||||
$multipart
|
||||
);
|
||||
|
||||
// for model (json/xml)
|
||||
if (count($formParams) > 0) {
|
||||
if ($multipart) {
|
||||
$multipartContents = [];
|
||||
foreach ($formParams as $formParamName => $formParamValue) {
|
||||
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
|
||||
foreach ($formParamValueItems as $formParamValueItem) {
|
||||
$multipartContents[] = [
|
||||
'name' => $formParamName,
|
||||
'contents' => $formParamValueItem
|
||||
];
|
||||
}
|
||||
}
|
||||
// for HTTP post (form)
|
||||
$httpBody = new MultipartStream($multipartContents);
|
||||
|
||||
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
||||
# if Content-Type contains "application/json", json_encode the form parameters
|
||||
$httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
|
||||
} else {
|
||||
// for HTTP post (form)
|
||||
$httpBody = ObjectSerializer::buildQuery($formParams);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$defaultHeaders = [];
|
||||
if ($this->config->getUserAgent()) {
|
||||
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
|
||||
}
|
||||
|
||||
$headers = array_merge(
|
||||
$defaultHeaders,
|
||||
$headerParams,
|
||||
$headers
|
||||
);
|
||||
|
||||
$operationHost = $this->config->getHost();
|
||||
$query = ObjectSerializer::buildQuery($queryParams);
|
||||
return new Request(
|
||||
'GET',
|
||||
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
|
||||
$headers,
|
||||
$httpBody
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create http client option
|
||||
*
|
||||
* @throws \RuntimeException on file opening failure
|
||||
* @return array of http client options
|
||||
*/
|
||||
protected function createHttpClientOption()
|
||||
{
|
||||
$options = [];
|
||||
if ($this->config->getDebug()) {
|
||||
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
|
||||
if (!$options[RequestOptions::DEBUG]) {
|
||||
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,430 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* FakeClassnameTags123Api
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Api;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\ClientInterface;
|
||||
use GuzzleHttp\Exception\ConnectException;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use GuzzleHttp\Psr7\MultipartStream;
|
||||
use GuzzleHttp\Psr7\Request;
|
||||
use GuzzleHttp\RequestOptions;
|
||||
use OpenAPI\Client\ApiException;
|
||||
use OpenAPI\Client\Configuration;
|
||||
use OpenAPI\Client\HeaderSelector;
|
||||
use OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* FakeClassnameTags123Api Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class FakeClassnameTags123Api
|
||||
{
|
||||
/**
|
||||
* @var ClientInterface
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* @var Configuration
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @var HeaderSelector
|
||||
*/
|
||||
protected $headerSelector;
|
||||
|
||||
/**
|
||||
* @var int Host index
|
||||
*/
|
||||
protected $hostIndex;
|
||||
|
||||
/** @var string[] $contentTypes **/
|
||||
public const contentTypes = [
|
||||
'testClassname' => [
|
||||
'application/json',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* @param ClientInterface $client
|
||||
* @param Configuration $config
|
||||
* @param HeaderSelector $selector
|
||||
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
|
||||
*/
|
||||
public function __construct(
|
||||
ClientInterface $client = null,
|
||||
Configuration $config = null,
|
||||
HeaderSelector $selector = null,
|
||||
$hostIndex = 0
|
||||
) {
|
||||
$this->client = $client ?: new Client();
|
||||
$this->config = $config ?: new Configuration();
|
||||
$this->headerSelector = $selector ?: new HeaderSelector();
|
||||
$this->hostIndex = $hostIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the host index
|
||||
*
|
||||
* @param int $hostIndex Host index (required)
|
||||
*/
|
||||
public function setHostIndex($hostIndex): void
|
||||
{
|
||||
$this->hostIndex = $hostIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the host index
|
||||
*
|
||||
* @return int Host index
|
||||
*/
|
||||
public function getHostIndex()
|
||||
{
|
||||
return $this->hostIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Configuration
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testClassname
|
||||
*
|
||||
* To test class name in snake case
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClassname'] to see the possible values for this operation
|
||||
*
|
||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \OpenAPI\Client\Model\Client
|
||||
*/
|
||||
public function testClassname($client, string $contentType = self::contentTypes['testClassname'][0])
|
||||
{
|
||||
list($response) = $this->testClassnameWithHttpInfo($client, $contentType);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testClassnameWithHttpInfo
|
||||
*
|
||||
* To test class name in snake case
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClassname'] to see the possible values for this operation
|
||||
*
|
||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||
* @throws \InvalidArgumentException
|
||||
* @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings)
|
||||
*/
|
||||
public function testClassnameWithHttpInfo($client, string $contentType = self::contentTypes['testClassname'][0])
|
||||
{
|
||||
$request = $this->testClassnameRequest($client, $contentType);
|
||||
|
||||
try {
|
||||
$options = $this->createHttpClientOption();
|
||||
try {
|
||||
$response = $this->client->send($request, $options);
|
||||
} catch (RequestException $e) {
|
||||
throw new ApiException(
|
||||
"[{$e->getCode()}] {$e->getMessage()}",
|
||||
(int) $e->getCode(),
|
||||
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
|
||||
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
|
||||
);
|
||||
} catch (ConnectException $e) {
|
||||
throw new ApiException(
|
||||
"[{$e->getCode()}] {$e->getMessage()}",
|
||||
(int) $e->getCode(),
|
||||
null,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
$statusCode = $response->getStatusCode();
|
||||
|
||||
if ($statusCode < 200 || $statusCode > 299) {
|
||||
throw new ApiException(
|
||||
sprintf(
|
||||
'[%d] Error connecting to the API (%s)',
|
||||
$statusCode,
|
||||
(string) $request->getUri()
|
||||
),
|
||||
$statusCode,
|
||||
$response->getHeaders(),
|
||||
(string) $response->getBody()
|
||||
);
|
||||
}
|
||||
|
||||
switch($statusCode) {
|
||||
case 200:
|
||||
if ('\OpenAPI\Client\Model\Client' === '\SplFileObject') {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('\OpenAPI\Client\Model\Client' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Client', []),
|
||||
$response->getStatusCode(),
|
||||
$response->getHeaders()
|
||||
];
|
||||
}
|
||||
|
||||
$returnType = '\OpenAPI\Client\Model\Client';
|
||||
if ($returnType === '\SplFileObject') {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
ObjectSerializer::deserialize($content, $returnType, []),
|
||||
$response->getStatusCode(),
|
||||
$response->getHeaders()
|
||||
];
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = ObjectSerializer::deserialize(
|
||||
$e->getResponseBody(),
|
||||
'\OpenAPI\Client\Model\Client',
|
||||
$e->getResponseHeaders()
|
||||
);
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testClassnameAsync
|
||||
*
|
||||
* To test class name in snake case
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClassname'] to see the possible values for this operation
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||
*/
|
||||
public function testClassnameAsync($client, string $contentType = self::contentTypes['testClassname'][0])
|
||||
{
|
||||
return $this->testClassnameAsyncWithHttpInfo($client, $contentType)
|
||||
->then(
|
||||
function ($response) {
|
||||
return $response[0];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testClassnameAsyncWithHttpInfo
|
||||
*
|
||||
* To test class name in snake case
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClassname'] to see the possible values for this operation
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||
*/
|
||||
public function testClassnameAsyncWithHttpInfo($client, string $contentType = self::contentTypes['testClassname'][0])
|
||||
{
|
||||
$returnType = '\OpenAPI\Client\Model\Client';
|
||||
$request = $this->testClassnameRequest($client, $contentType);
|
||||
|
||||
return $this->client
|
||||
->sendAsync($request, $this->createHttpClientOption())
|
||||
->then(
|
||||
function ($response) use ($returnType) {
|
||||
if ($returnType === '\SplFileObject') {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
ObjectSerializer::deserialize($content, $returnType, []),
|
||||
$response->getStatusCode(),
|
||||
$response->getHeaders()
|
||||
];
|
||||
},
|
||||
function ($exception) {
|
||||
$response = $exception->getResponse();
|
||||
$statusCode = $response->getStatusCode();
|
||||
throw new ApiException(
|
||||
sprintf(
|
||||
'[%d] Error connecting to the API (%s)',
|
||||
$statusCode,
|
||||
$exception->getRequest()->getUri()
|
||||
),
|
||||
$statusCode,
|
||||
$response->getHeaders(),
|
||||
(string) $response->getBody()
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create request for operation 'testClassname'
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClassname'] to see the possible values for this operation
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Psr7\Request
|
||||
*/
|
||||
public function testClassnameRequest($client, string $contentType = self::contentTypes['testClassname'][0])
|
||||
{
|
||||
|
||||
// verify the required parameter 'client' is set
|
||||
if ($client === null || (is_array($client) && count($client) === 0)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'Missing the required parameter $client when calling testClassname'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$resourcePath = '/fake_classname_test';
|
||||
$formParams = [];
|
||||
$queryParams = [];
|
||||
$headerParams = [];
|
||||
$httpBody = '';
|
||||
$multipart = false;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$headers = $this->headerSelector->selectHeaders(
|
||||
['application/json', ],
|
||||
$contentType,
|
||||
$multipart
|
||||
);
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($client)) {
|
||||
if (stripos($headers['Content-Type'], 'application/json') !== false) {
|
||||
# if Content-Type contains "application/json", json_encode the body
|
||||
$httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($client));
|
||||
} else {
|
||||
$httpBody = $client;
|
||||
}
|
||||
} elseif (count($formParams) > 0) {
|
||||
if ($multipart) {
|
||||
$multipartContents = [];
|
||||
foreach ($formParams as $formParamName => $formParamValue) {
|
||||
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
|
||||
foreach ($formParamValueItems as $formParamValueItem) {
|
||||
$multipartContents[] = [
|
||||
'name' => $formParamName,
|
||||
'contents' => $formParamValueItem
|
||||
];
|
||||
}
|
||||
}
|
||||
// for HTTP post (form)
|
||||
$httpBody = new MultipartStream($multipartContents);
|
||||
|
||||
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
||||
# if Content-Type contains "application/json", json_encode the form parameters
|
||||
$httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
|
||||
} else {
|
||||
// for HTTP post (form)
|
||||
$httpBody = ObjectSerializer::buildQuery($formParams);
|
||||
}
|
||||
}
|
||||
|
||||
// this endpoint requires API key authentication
|
||||
$apiKey = $this->config->getApiKeyWithPrefix('api_key_query');
|
||||
if ($apiKey !== null) {
|
||||
$queryParams['api_key_query'] = $apiKey;
|
||||
}
|
||||
|
||||
$defaultHeaders = [];
|
||||
if ($this->config->getUserAgent()) {
|
||||
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
|
||||
}
|
||||
|
||||
$headers = array_merge(
|
||||
$defaultHeaders,
|
||||
$headerParams,
|
||||
$headers
|
||||
);
|
||||
|
||||
$operationHost = $this->config->getHost();
|
||||
$query = ObjectSerializer::buildQuery($queryParams);
|
||||
return new Request(
|
||||
'PATCH',
|
||||
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
|
||||
$headers,
|
||||
$httpBody
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create http client option
|
||||
*
|
||||
* @throws \RuntimeException on file opening failure
|
||||
* @return array of http client options
|
||||
*/
|
||||
protected function createHttpClientOption()
|
||||
{
|
||||
$options = [];
|
||||
if ($this->config->getDebug()) {
|
||||
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
|
||||
if (!$options[RequestOptions::DEBUG]) {
|
||||
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,119 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ApiException
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use \Exception;
|
||||
|
||||
/**
|
||||
* ApiException Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class ApiException extends Exception
|
||||
{
|
||||
/**
|
||||
* The HTTP body of the server response either as Json or string.
|
||||
*
|
||||
* @var \stdClass|string|null
|
||||
*/
|
||||
protected $responseBody;
|
||||
|
||||
/**
|
||||
* The HTTP header of the server response.
|
||||
*
|
||||
* @var string[][]|null
|
||||
*/
|
||||
protected $responseHeaders;
|
||||
|
||||
/**
|
||||
* The deserialized response object
|
||||
*
|
||||
* @var \stdClass|string|null
|
||||
*/
|
||||
protected $responseObject;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $message Error message
|
||||
* @param int $code HTTP status code
|
||||
* @param string[][]|null $responseHeaders HTTP response headerr
|
||||
* @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string
|
||||
*/
|
||||
public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null)
|
||||
{
|
||||
parent::__construct($message, $code);
|
||||
$this->responseHeaders = $responseHeaders;
|
||||
$this->responseBody = $responseBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HTTP response header
|
||||
*
|
||||
* @return string[]|null HTTP response header
|
||||
*/
|
||||
public function getResponseHeaders()
|
||||
{
|
||||
return $this->responseHeaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HTTP body of the server response either as Json or string
|
||||
*
|
||||
* @return \stdClass|string|null HTTP body of the server response either as \stdClass or string
|
||||
*/
|
||||
public function getResponseBody()
|
||||
{
|
||||
return $this->responseBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the deserialized response object (during deserialization)
|
||||
*
|
||||
* @param mixed $obj Deserialized response object
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setResponseObject($obj)
|
||||
{
|
||||
$this->responseObject = $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the deserialized response object (during deserialization)
|
||||
*
|
||||
* @return mixed the deserialized response object
|
||||
*/
|
||||
public function getResponseObject()
|
||||
{
|
||||
return $this->responseObject;
|
||||
}
|
||||
}
|
@ -1,567 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Configuration
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
/**
|
||||
* Configuration Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class Configuration
|
||||
{
|
||||
public const BOOLEAN_FORMAT_INT = 'int';
|
||||
public const BOOLEAN_FORMAT_STRING = 'string';
|
||||
|
||||
/**
|
||||
* @var Configuration
|
||||
*/
|
||||
private static $defaultConfiguration;
|
||||
|
||||
/**
|
||||
* Associate array to store API key(s)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $apiKeys = [];
|
||||
|
||||
/**
|
||||
* Associate array to store API prefix (e.g. Bearer)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $apiKeyPrefixes = [];
|
||||
|
||||
/**
|
||||
* Access token for OAuth/Bearer authentication
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $accessToken = '';
|
||||
|
||||
/**
|
||||
* Boolean format for query string
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $booleanFormatForQueryString = self::BOOLEAN_FORMAT_INT;
|
||||
|
||||
/**
|
||||
* Username for HTTP basic authentication
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $username = '';
|
||||
|
||||
/**
|
||||
* Password for HTTP basic authentication
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $password = '';
|
||||
|
||||
/**
|
||||
* The host
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $host = 'http://petstore.swagger.io:80/v2';
|
||||
|
||||
/**
|
||||
* User agent of the HTTP request, set to "OpenAPI-Generator/{version}/PHP" by default
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $userAgent = 'OpenAPI-Generator/1.0.0/PHP';
|
||||
|
||||
/**
|
||||
* Debug switch (default set to false)
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $debug = false;
|
||||
|
||||
/**
|
||||
* Debug file location (log to STDOUT by default)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $debugFile = 'php://output';
|
||||
|
||||
/**
|
||||
* Debug file location (log to STDOUT by default)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $tempFolderPath;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->tempFolderPath = sys_get_temp_dir();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets API key
|
||||
*
|
||||
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
|
||||
* @param string $key API key or token
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setApiKey($apiKeyIdentifier, $key)
|
||||
{
|
||||
$this->apiKeys[$apiKeyIdentifier] = $key;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets API key
|
||||
*
|
||||
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
|
||||
*
|
||||
* @return null|string API key or token
|
||||
*/
|
||||
public function getApiKey($apiKeyIdentifier)
|
||||
{
|
||||
return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the prefix for API key (e.g. Bearer)
|
||||
*
|
||||
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
|
||||
* @param string $prefix API key prefix, e.g. Bearer
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setApiKeyPrefix($apiKeyIdentifier, $prefix)
|
||||
{
|
||||
$this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets API key prefix
|
||||
*
|
||||
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getApiKeyPrefix($apiKeyIdentifier)
|
||||
{
|
||||
return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the access token for OAuth
|
||||
*
|
||||
* @param string $accessToken Token for OAuth
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAccessToken($accessToken)
|
||||
{
|
||||
$this->accessToken = $accessToken;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the access token for OAuth
|
||||
*
|
||||
* @return string Access token for OAuth
|
||||
*/
|
||||
public function getAccessToken()
|
||||
{
|
||||
return $this->accessToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets boolean format for query string.
|
||||
*
|
||||
* @param string $booleanFormatForQueryString Boolean format for query string
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBooleanFormatForQueryString(string $booleanFormat)
|
||||
{
|
||||
$this->booleanFormatForQueryString = $booleanFormat;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets boolean format for query string.
|
||||
*
|
||||
* @return string Boolean format for query string
|
||||
*/
|
||||
public function getBooleanFormatForQueryString(): string
|
||||
{
|
||||
return $this->booleanFormatForQueryString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the username for HTTP basic authentication
|
||||
*
|
||||
* @param string $username Username for HTTP basic authentication
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setUsername($username)
|
||||
{
|
||||
$this->username = $username;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the username for HTTP basic authentication
|
||||
*
|
||||
* @return string Username for HTTP basic authentication
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the password for HTTP basic authentication
|
||||
*
|
||||
* @param string $password Password for HTTP basic authentication
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
$this->password = $password;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the password for HTTP basic authentication
|
||||
*
|
||||
* @return string Password for HTTP basic authentication
|
||||
*/
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the host
|
||||
*
|
||||
* @param string $host Host
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setHost($host)
|
||||
{
|
||||
$this->host = $host;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the host
|
||||
*
|
||||
* @return string Host
|
||||
*/
|
||||
public function getHost()
|
||||
{
|
||||
return $this->host;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user agent of the api client
|
||||
*
|
||||
* @param string $userAgent the user agent of the api client
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return $this
|
||||
*/
|
||||
public function setUserAgent($userAgent)
|
||||
{
|
||||
if (!is_string($userAgent)) {
|
||||
throw new \InvalidArgumentException('User-agent must be a string.');
|
||||
}
|
||||
|
||||
$this->userAgent = $userAgent;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the user agent of the api client
|
||||
*
|
||||
* @return string user agent
|
||||
*/
|
||||
public function getUserAgent()
|
||||
{
|
||||
return $this->userAgent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets debug flag
|
||||
*
|
||||
* @param bool $debug Debug flag
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDebug($debug)
|
||||
{
|
||||
$this->debug = $debug;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the debug flag
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getDebug()
|
||||
{
|
||||
return $this->debug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the debug file
|
||||
*
|
||||
* @param string $debugFile Debug file
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDebugFile($debugFile)
|
||||
{
|
||||
$this->debugFile = $debugFile;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the debug file
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDebugFile()
|
||||
{
|
||||
return $this->debugFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the temp folder path
|
||||
*
|
||||
* @param string $tempFolderPath Temp folder path
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTempFolderPath($tempFolderPath)
|
||||
{
|
||||
$this->tempFolderPath = $tempFolderPath;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the temp folder path
|
||||
*
|
||||
* @return string Temp folder path
|
||||
*/
|
||||
public function getTempFolderPath()
|
||||
{
|
||||
return $this->tempFolderPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default configuration instance
|
||||
*
|
||||
* @return Configuration
|
||||
*/
|
||||
public static function getDefaultConfiguration()
|
||||
{
|
||||
if (self::$defaultConfiguration === null) {
|
||||
self::$defaultConfiguration = new Configuration();
|
||||
}
|
||||
|
||||
return self::$defaultConfiguration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default configuration instance
|
||||
*
|
||||
* @param Configuration $config An instance of the Configuration Object
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function setDefaultConfiguration(Configuration $config)
|
||||
{
|
||||
self::$defaultConfiguration = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the essential information for debugging
|
||||
*
|
||||
* @return string The report for debugging
|
||||
*/
|
||||
public static function toDebugReport()
|
||||
{
|
||||
$report = 'PHP SDK (OpenAPI\Client) Debug Report:' . PHP_EOL;
|
||||
$report .= ' OS: ' . php_uname() . PHP_EOL;
|
||||
$report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL;
|
||||
$report .= ' The version of the OpenAPI document: 1.0.0' . PHP_EOL;
|
||||
$report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL;
|
||||
|
||||
return $report;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get API key (with prefix if set)
|
||||
*
|
||||
* @param string $apiKeyIdentifier name of apikey
|
||||
*
|
||||
* @return null|string API key with the prefix
|
||||
*/
|
||||
public function getApiKeyWithPrefix($apiKeyIdentifier)
|
||||
{
|
||||
$prefix = $this->getApiKeyPrefix($apiKeyIdentifier);
|
||||
$apiKey = $this->getApiKey($apiKeyIdentifier);
|
||||
|
||||
if ($apiKey === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($prefix === null) {
|
||||
$keyWithPrefix = $apiKey;
|
||||
} else {
|
||||
$keyWithPrefix = $prefix . ' ' . $apiKey;
|
||||
}
|
||||
|
||||
return $keyWithPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of host settings
|
||||
*
|
||||
* @return array an array of host settings
|
||||
*/
|
||||
public function getHostSettings()
|
||||
{
|
||||
return [
|
||||
[
|
||||
"url" => "http://{server}.swagger.io:{port}/v2",
|
||||
"description" => "petstore server",
|
||||
"variables" => [
|
||||
"server" => [
|
||||
"description" => "No description provided",
|
||||
"default_value" => "petstore",
|
||||
"enum_values" => [
|
||||
"petstore",
|
||||
"qa-petstore",
|
||||
"dev-petstore"
|
||||
]
|
||||
],
|
||||
"port" => [
|
||||
"description" => "No description provided",
|
||||
"default_value" => "80",
|
||||
"enum_values" => [
|
||||
"80",
|
||||
"8080"
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
"url" => "https://localhost:8080/{version}",
|
||||
"description" => "The local server",
|
||||
"variables" => [
|
||||
"version" => [
|
||||
"description" => "No description provided",
|
||||
"default_value" => "v2",
|
||||
"enum_values" => [
|
||||
"v1",
|
||||
"v2"
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
"url" => "https://127.0.0.1/no_varaible",
|
||||
"description" => "The local server without variables",
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns URL based on host settings, index and variables
|
||||
*
|
||||
* @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
|
||||
* @param int $hostIndex index of the host settings
|
||||
* @param array|null $variables hash of variable and the corresponding value (optional)
|
||||
* @return string URL based on host settings
|
||||
*/
|
||||
public static function getHostString(array $hostsSettings, $hostIndex, array $variables = null)
|
||||
{
|
||||
if (null === $variables) {
|
||||
$variables = [];
|
||||
}
|
||||
|
||||
// check array index out of bound
|
||||
if ($hostIndex < 0 || $hostIndex >= count($hostsSettings)) {
|
||||
throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostsSettings));
|
||||
}
|
||||
|
||||
$host = $hostsSettings[$hostIndex];
|
||||
$url = $host["url"];
|
||||
|
||||
// go through variable and assign a value
|
||||
foreach ($host["variables"] ?? [] as $name => $variable) {
|
||||
if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user
|
||||
if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum
|
||||
$url = str_replace("{".$name."}", $variables[$name], $url);
|
||||
} else {
|
||||
throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"]).".");
|
||||
}
|
||||
} else {
|
||||
// use default value
|
||||
$url = str_replace("{".$name."}", $variable["default_value"], $url);
|
||||
}
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns URL based on the index and variables
|
||||
*
|
||||
* @param int $index index of the host settings
|
||||
* @param array|null $variables hash of variable and the corresponding value (optional)
|
||||
* @return string URL based on host settings
|
||||
*/
|
||||
public function getHostFromSettings($index, $variables = null)
|
||||
{
|
||||
return self::getHostString($this->getHostSettings(), $index, $variables);
|
||||
}
|
||||
}
|
@ -1,245 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* HeaderSelector
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
/**
|
||||
* HeaderSelector Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class HeaderSelector
|
||||
{
|
||||
/**
|
||||
* @param string[] $accept
|
||||
* @param string $contentType
|
||||
* @param bool $isMultipart
|
||||
* @return string[]
|
||||
*/
|
||||
public function selectHeaders(array $accept, string $contentType, bool $isMultipart): array
|
||||
{
|
||||
$headers = [];
|
||||
|
||||
$accept = $this->selectAcceptHeader($accept);
|
||||
if ($accept !== null) {
|
||||
$headers['Accept'] = $accept;
|
||||
}
|
||||
|
||||
if (!$isMultipart) {
|
||||
if($contentType === '') {
|
||||
$contentType = 'application/json';
|
||||
}
|
||||
|
||||
$headers['Content-Type'] = $contentType;
|
||||
}
|
||||
|
||||
return $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the header 'Accept' based on an array of Accept provided.
|
||||
*
|
||||
* @param string[] $accept Array of header
|
||||
*
|
||||
* @return null|string Accept (e.g. application/json)
|
||||
*/
|
||||
private function selectAcceptHeader(array $accept): ?string
|
||||
{
|
||||
# filter out empty entries
|
||||
$accept = array_filter($accept);
|
||||
|
||||
if (count($accept) === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
# If there's only one Accept header, just use it
|
||||
if (count($accept) === 1) {
|
||||
return reset($accept);
|
||||
}
|
||||
|
||||
# If none of the available Accept headers is of type "json", then just use all them
|
||||
$headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept);
|
||||
if (count($headersWithJson) === 0) {
|
||||
return implode(',', $accept);
|
||||
}
|
||||
|
||||
# If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1,
|
||||
# to give the highest priority to json-like headers - recalculating the existing ones, if needed
|
||||
return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an Accept header string from the given "Accept" headers array, recalculating all weights
|
||||
*
|
||||
* @param string[] $accept Array of Accept Headers
|
||||
* @param string[] $headersWithJson Array of Accept Headers of type "json"
|
||||
*
|
||||
* @return string "Accept" Header (e.g. "application/json, text/html; q=0.9")
|
||||
*/
|
||||
private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string
|
||||
{
|
||||
$processedHeaders = [
|
||||
'withApplicationJson' => [],
|
||||
'withJson' => [],
|
||||
'withoutJson' => [],
|
||||
];
|
||||
|
||||
foreach ($accept as $header) {
|
||||
|
||||
$headerData = $this->getHeaderAndWeight($header);
|
||||
|
||||
if (stripos($headerData['header'], 'application/json') === 0) {
|
||||
$processedHeaders['withApplicationJson'][] = $headerData;
|
||||
} elseif (in_array($header, $headersWithJson, true)) {
|
||||
$processedHeaders['withJson'][] = $headerData;
|
||||
} else {
|
||||
$processedHeaders['withoutJson'][] = $headerData;
|
||||
}
|
||||
}
|
||||
|
||||
$acceptHeaders = [];
|
||||
$currentWeight = 1000;
|
||||
|
||||
$hasMoreThan28Headers = count($accept) > 28;
|
||||
|
||||
foreach($processedHeaders as $headers) {
|
||||
if (count($headers) > 0) {
|
||||
$acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers);
|
||||
}
|
||||
}
|
||||
|
||||
$acceptHeaders = array_merge(...$acceptHeaders);
|
||||
|
||||
return implode(',', $acceptHeaders);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an Accept header, returns an associative array splitting the header and its weight
|
||||
*
|
||||
* @param string $header "Accept" Header
|
||||
*
|
||||
* @return array with the header and its weight
|
||||
*/
|
||||
private function getHeaderAndWeight(string $header): array
|
||||
{
|
||||
# matches headers with weight, splitting the header and the weight in $outputArray
|
||||
if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) {
|
||||
$headerData = [
|
||||
'header' => $outputArray[1],
|
||||
'weight' => (int)($outputArray[2] * 1000),
|
||||
];
|
||||
} else {
|
||||
$headerData = [
|
||||
'header' => trim($header),
|
||||
'weight' => 1000,
|
||||
];
|
||||
}
|
||||
|
||||
return $headerData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array[] $headers
|
||||
* @param float $currentWeight
|
||||
* @param bool $hasMoreThan28Headers
|
||||
* @return string[] array of adjusted "Accept" headers
|
||||
*/
|
||||
private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array
|
||||
{
|
||||
usort($headers, function (array $a, array $b) {
|
||||
return $b['weight'] - $a['weight'];
|
||||
});
|
||||
|
||||
$acceptHeaders = [];
|
||||
foreach ($headers as $index => $header) {
|
||||
if($index > 0 && $headers[$index - 1]['weight'] > $header['weight'])
|
||||
{
|
||||
$currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers);
|
||||
}
|
||||
|
||||
$weight = $currentWeight;
|
||||
|
||||
$acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight);
|
||||
}
|
||||
|
||||
$currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers);
|
||||
|
||||
return $acceptHeaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $header
|
||||
* @param int $weight
|
||||
* @return string
|
||||
*/
|
||||
private function buildAcceptHeader(string $header, int $weight): string
|
||||
{
|
||||
if($weight === 1000) {
|
||||
return $header;
|
||||
}
|
||||
|
||||
return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0');
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the next weight, based on the current one.
|
||||
*
|
||||
* If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the
|
||||
* following formula:
|
||||
*
|
||||
* next weight = current weight - 10 ^ (floor(log(current weight - 1)))
|
||||
*
|
||||
* ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) )
|
||||
*
|
||||
* Starting from 1000, this generates the following series:
|
||||
*
|
||||
* 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
|
||||
*
|
||||
* The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works
|
||||
* if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1
|
||||
* decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc.
|
||||
*
|
||||
* @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value)
|
||||
* @param bool $hasMoreThan28Headers
|
||||
* @return int
|
||||
*/
|
||||
public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int
|
||||
{
|
||||
if ($currentWeight <= 1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ($hasMoreThan28Headers) {
|
||||
return $currentWeight - 1;
|
||||
}
|
||||
|
||||
return $currentWeight - 10 ** floor( log10($currentWeight - 1) );
|
||||
}
|
||||
}
|
@ -1,443 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* AdditionalPropertiesClass
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* AdditionalPropertiesClass Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'AdditionalPropertiesClass';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'map_property' => 'array<string,string>',
|
||||
'map_of_map_property' => 'array<string,array<string,string>>'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'map_property' => null,
|
||||
'map_of_map_property' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'map_property' => false,
|
||||
'map_of_map_property' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'map_property' => 'map_property',
|
||||
'map_of_map_property' => 'map_of_map_property'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'map_property' => 'setMapProperty',
|
||||
'map_of_map_property' => 'setMapOfMapProperty'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'map_property' => 'getMapProperty',
|
||||
'map_of_map_property' => 'getMapOfMapProperty'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('map_property', $data ?? [], null);
|
||||
$this->setIfExists('map_of_map_property', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets map_property
|
||||
*
|
||||
* @return array<string,string>|null
|
||||
*/
|
||||
public function getMapProperty()
|
||||
{
|
||||
return $this->container['map_property'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets map_property
|
||||
*
|
||||
* @param array<string,string>|null $map_property map_property
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setMapProperty($map_property)
|
||||
{
|
||||
if (is_null($map_property)) {
|
||||
throw new \InvalidArgumentException('non-nullable map_property cannot be null');
|
||||
}
|
||||
$this->container['map_property'] = $map_property;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets map_of_map_property
|
||||
*
|
||||
* @return array<string,array<string,string>>|null
|
||||
*/
|
||||
public function getMapOfMapProperty()
|
||||
{
|
||||
return $this->container['map_of_map_property'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets map_of_map_property
|
||||
*
|
||||
* @param array<string,array<string,string>>|null $map_of_map_property map_of_map_property
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setMapOfMapProperty($map_of_map_property)
|
||||
{
|
||||
if (is_null($map_of_map_property)) {
|
||||
throw new \InvalidArgumentException('non-nullable map_of_map_property cannot be null');
|
||||
}
|
||||
$this->container['map_of_map_property'] = $map_of_map_property;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,443 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* AllOfWithSingleRef
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* AllOfWithSingleRef Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'AllOfWithSingleRef';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'username' => 'string',
|
||||
'single_ref_type' => 'SingleRefType'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'username' => null,
|
||||
'single_ref_type' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'username' => false,
|
||||
'single_ref_type' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'username' => 'username',
|
||||
'single_ref_type' => 'SingleRefType'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'username' => 'setUsername',
|
||||
'single_ref_type' => 'setSingleRefType'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'username' => 'getUsername',
|
||||
'single_ref_type' => 'getSingleRefType'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('username', $data ?? [], null);
|
||||
$this->setIfExists('single_ref_type', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets username
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return $this->container['username'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets username
|
||||
*
|
||||
* @param string|null $username username
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setUsername($username)
|
||||
{
|
||||
if (is_null($username)) {
|
||||
throw new \InvalidArgumentException('non-nullable username cannot be null');
|
||||
}
|
||||
$this->container['username'] = $username;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets single_ref_type
|
||||
*
|
||||
* @return SingleRefType|null
|
||||
*/
|
||||
public function getSingleRefType()
|
||||
{
|
||||
return $this->container['single_ref_type'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets single_ref_type
|
||||
*
|
||||
* @param SingleRefType|null $single_ref_type single_ref_type
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setSingleRefType($single_ref_type)
|
||||
{
|
||||
if (is_null($single_ref_type)) {
|
||||
throw new \InvalidArgumentException('non-nullable single_ref_type cannot be null');
|
||||
}
|
||||
$this->container['single_ref_type'] = $single_ref_type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,449 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Animal
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* Animal Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = 'class_name';
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'Animal';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'class_name' => 'string',
|
||||
'color' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'class_name' => null,
|
||||
'color' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'class_name' => false,
|
||||
'color' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'class_name' => 'className',
|
||||
'color' => 'color'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'class_name' => 'setClassName',
|
||||
'color' => 'setColor'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'class_name' => 'getClassName',
|
||||
'color' => 'getColor'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('class_name', $data ?? [], null);
|
||||
$this->setIfExists('color', $data ?? [], 'red');
|
||||
|
||||
// Initialize discriminator property with the model name.
|
||||
$this->container['class_name'] = static::$openAPIModelName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
if ($this->container['class_name'] === null) {
|
||||
$invalidProperties[] = "'class_name' can't be null";
|
||||
}
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets class_name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return $this->container['class_name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets class_name
|
||||
*
|
||||
* @param string $class_name class_name
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setClassName($class_name)
|
||||
{
|
||||
if (is_null($class_name)) {
|
||||
throw new \InvalidArgumentException('non-nullable class_name cannot be null');
|
||||
}
|
||||
$this->container['class_name'] = $class_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets color
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getColor()
|
||||
{
|
||||
return $this->container['color'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets color
|
||||
*
|
||||
* @param string|null $color color
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setColor($color)
|
||||
{
|
||||
if (is_null($color)) {
|
||||
throw new \InvalidArgumentException('non-nullable color cannot be null');
|
||||
}
|
||||
$this->container['color'] = $color;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,477 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ApiResponse
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* ApiResponse Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'ApiResponse';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'code' => 'int',
|
||||
'type' => 'string',
|
||||
'message' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'code' => 'int32',
|
||||
'type' => null,
|
||||
'message' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'code' => false,
|
||||
'type' => false,
|
||||
'message' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'code' => 'code',
|
||||
'type' => 'type',
|
||||
'message' => 'message'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'code' => 'setCode',
|
||||
'type' => 'setType',
|
||||
'message' => 'setMessage'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'code' => 'getCode',
|
||||
'type' => 'getType',
|
||||
'message' => 'getMessage'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('code', $data ?? [], null);
|
||||
$this->setIfExists('type', $data ?? [], null);
|
||||
$this->setIfExists('message', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets code
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getCode()
|
||||
{
|
||||
return $this->container['code'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets code
|
||||
*
|
||||
* @param int|null $code code
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setCode($code)
|
||||
{
|
||||
if (is_null($code)) {
|
||||
throw new \InvalidArgumentException('non-nullable code cannot be null');
|
||||
}
|
||||
$this->container['code'] = $code;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets type
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->container['type'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets type
|
||||
*
|
||||
* @param string|null $type type
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
if (is_null($type)) {
|
||||
throw new \InvalidArgumentException('non-nullable type cannot be null');
|
||||
}
|
||||
$this->container['type'] = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets message
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMessage()
|
||||
{
|
||||
return $this->container['message'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets message
|
||||
*
|
||||
* @param string|null $message message
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setMessage($message)
|
||||
{
|
||||
if (is_null($message)) {
|
||||
throw new \InvalidArgumentException('non-nullable message cannot be null');
|
||||
}
|
||||
$this->container['message'] = $message;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,409 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ArrayOfArrayOfNumberOnly
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* ArrayOfArrayOfNumberOnly Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'ArrayOfArrayOfNumberOnly';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'array_array_number' => 'float[][]'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'array_array_number' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'array_array_number' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'array_array_number' => 'ArrayArrayNumber'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'array_array_number' => 'setArrayArrayNumber'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'array_array_number' => 'getArrayArrayNumber'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('array_array_number', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets array_array_number
|
||||
*
|
||||
* @return float[][]|null
|
||||
*/
|
||||
public function getArrayArrayNumber()
|
||||
{
|
||||
return $this->container['array_array_number'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets array_array_number
|
||||
*
|
||||
* @param float[][]|null $array_array_number array_array_number
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setArrayArrayNumber($array_array_number)
|
||||
{
|
||||
if (is_null($array_array_number)) {
|
||||
throw new \InvalidArgumentException('non-nullable array_array_number cannot be null');
|
||||
}
|
||||
$this->container['array_array_number'] = $array_array_number;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,409 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ArrayOfNumberOnly
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* ArrayOfNumberOnly Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'ArrayOfNumberOnly';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'array_number' => 'float[]'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'array_number' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'array_number' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'array_number' => 'ArrayNumber'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'array_number' => 'setArrayNumber'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'array_number' => 'getArrayNumber'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('array_number', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets array_number
|
||||
*
|
||||
* @return float[]|null
|
||||
*/
|
||||
public function getArrayNumber()
|
||||
{
|
||||
return $this->container['array_number'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets array_number
|
||||
*
|
||||
* @param float[]|null $array_number array_number
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setArrayNumber($array_number)
|
||||
{
|
||||
if (is_null($array_number)) {
|
||||
throw new \InvalidArgumentException('non-nullable array_number cannot be null');
|
||||
}
|
||||
$this->container['array_number'] = $array_number;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,492 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ArrayTest
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* ArrayTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'ArrayTest';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'array_of_string' => 'string[]',
|
||||
'array_array_of_integer' => 'int[][]',
|
||||
'array_array_of_model' => '\OpenAPI\Client\Model\ReadOnlyFirst[][]'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'array_of_string' => null,
|
||||
'array_array_of_integer' => 'int64',
|
||||
'array_array_of_model' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'array_of_string' => false,
|
||||
'array_array_of_integer' => false,
|
||||
'array_array_of_model' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'array_of_string' => 'array_of_string',
|
||||
'array_array_of_integer' => 'array_array_of_integer',
|
||||
'array_array_of_model' => 'array_array_of_model'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'array_of_string' => 'setArrayOfString',
|
||||
'array_array_of_integer' => 'setArrayArrayOfInteger',
|
||||
'array_array_of_model' => 'setArrayArrayOfModel'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'array_of_string' => 'getArrayOfString',
|
||||
'array_array_of_integer' => 'getArrayArrayOfInteger',
|
||||
'array_array_of_model' => 'getArrayArrayOfModel'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('array_of_string', $data ?? [], null);
|
||||
$this->setIfExists('array_array_of_integer', $data ?? [], null);
|
||||
$this->setIfExists('array_array_of_model', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
if (!is_null($this->container['array_of_string']) && (count($this->container['array_of_string']) > 3)) {
|
||||
$invalidProperties[] = "invalid value for 'array_of_string', number of items must be less than or equal to 3.";
|
||||
}
|
||||
|
||||
if (!is_null($this->container['array_of_string']) && (count($this->container['array_of_string']) < 0)) {
|
||||
$invalidProperties[] = "invalid value for 'array_of_string', number of items must be greater than or equal to 0.";
|
||||
}
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets array_of_string
|
||||
*
|
||||
* @return string[]|null
|
||||
*/
|
||||
public function getArrayOfString()
|
||||
{
|
||||
return $this->container['array_of_string'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets array_of_string
|
||||
*
|
||||
* @param string[]|null $array_of_string array_of_string
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setArrayOfString($array_of_string)
|
||||
{
|
||||
if (is_null($array_of_string)) {
|
||||
throw new \InvalidArgumentException('non-nullable array_of_string cannot be null');
|
||||
}
|
||||
|
||||
if ((count($array_of_string) > 3)) {
|
||||
throw new \InvalidArgumentException('invalid value for $array_of_string when calling ArrayTest., number of items must be less than or equal to 3.');
|
||||
}
|
||||
if ((count($array_of_string) < 0)) {
|
||||
throw new \InvalidArgumentException('invalid length for $array_of_string when calling ArrayTest., number of items must be greater than or equal to 0.');
|
||||
}
|
||||
$this->container['array_of_string'] = $array_of_string;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets array_array_of_integer
|
||||
*
|
||||
* @return int[][]|null
|
||||
*/
|
||||
public function getArrayArrayOfInteger()
|
||||
{
|
||||
return $this->container['array_array_of_integer'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets array_array_of_integer
|
||||
*
|
||||
* @param int[][]|null $array_array_of_integer array_array_of_integer
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setArrayArrayOfInteger($array_array_of_integer)
|
||||
{
|
||||
if (is_null($array_array_of_integer)) {
|
||||
throw new \InvalidArgumentException('non-nullable array_array_of_integer cannot be null');
|
||||
}
|
||||
$this->container['array_array_of_integer'] = $array_array_of_integer;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets array_array_of_model
|
||||
*
|
||||
* @return \OpenAPI\Client\Model\ReadOnlyFirst[][]|null
|
||||
*/
|
||||
public function getArrayArrayOfModel()
|
||||
{
|
||||
return $this->container['array_array_of_model'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets array_array_of_model
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\ReadOnlyFirst[][]|null $array_array_of_model array_array_of_model
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setArrayArrayOfModel($array_array_of_model)
|
||||
{
|
||||
if (is_null($array_array_of_model)) {
|
||||
throw new \InvalidArgumentException('non-nullable array_array_of_model cannot be null');
|
||||
}
|
||||
$this->container['array_array_of_model'] = $array_array_of_model;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,579 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Capitalization
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* Capitalization Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'Capitalization';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'small_camel' => 'string',
|
||||
'capital_camel' => 'string',
|
||||
'small_snake' => 'string',
|
||||
'capital_snake' => 'string',
|
||||
'sca_eth_flow_points' => 'string',
|
||||
'att_name' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'small_camel' => null,
|
||||
'capital_camel' => null,
|
||||
'small_snake' => null,
|
||||
'capital_snake' => null,
|
||||
'sca_eth_flow_points' => null,
|
||||
'att_name' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'small_camel' => false,
|
||||
'capital_camel' => false,
|
||||
'small_snake' => false,
|
||||
'capital_snake' => false,
|
||||
'sca_eth_flow_points' => false,
|
||||
'att_name' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'small_camel' => 'smallCamel',
|
||||
'capital_camel' => 'CapitalCamel',
|
||||
'small_snake' => 'small_Snake',
|
||||
'capital_snake' => 'Capital_Snake',
|
||||
'sca_eth_flow_points' => 'SCA_ETH_Flow_Points',
|
||||
'att_name' => 'ATT_NAME'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'small_camel' => 'setSmallCamel',
|
||||
'capital_camel' => 'setCapitalCamel',
|
||||
'small_snake' => 'setSmallSnake',
|
||||
'capital_snake' => 'setCapitalSnake',
|
||||
'sca_eth_flow_points' => 'setScaEthFlowPoints',
|
||||
'att_name' => 'setAttName'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'small_camel' => 'getSmallCamel',
|
||||
'capital_camel' => 'getCapitalCamel',
|
||||
'small_snake' => 'getSmallSnake',
|
||||
'capital_snake' => 'getCapitalSnake',
|
||||
'sca_eth_flow_points' => 'getScaEthFlowPoints',
|
||||
'att_name' => 'getAttName'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('small_camel', $data ?? [], null);
|
||||
$this->setIfExists('capital_camel', $data ?? [], null);
|
||||
$this->setIfExists('small_snake', $data ?? [], null);
|
||||
$this->setIfExists('capital_snake', $data ?? [], null);
|
||||
$this->setIfExists('sca_eth_flow_points', $data ?? [], null);
|
||||
$this->setIfExists('att_name', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets small_camel
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSmallCamel()
|
||||
{
|
||||
return $this->container['small_camel'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets small_camel
|
||||
*
|
||||
* @param string|null $small_camel small_camel
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setSmallCamel($small_camel)
|
||||
{
|
||||
if (is_null($small_camel)) {
|
||||
throw new \InvalidArgumentException('non-nullable small_camel cannot be null');
|
||||
}
|
||||
$this->container['small_camel'] = $small_camel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets capital_camel
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCapitalCamel()
|
||||
{
|
||||
return $this->container['capital_camel'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets capital_camel
|
||||
*
|
||||
* @param string|null $capital_camel capital_camel
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setCapitalCamel($capital_camel)
|
||||
{
|
||||
if (is_null($capital_camel)) {
|
||||
throw new \InvalidArgumentException('non-nullable capital_camel cannot be null');
|
||||
}
|
||||
$this->container['capital_camel'] = $capital_camel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets small_snake
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSmallSnake()
|
||||
{
|
||||
return $this->container['small_snake'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets small_snake
|
||||
*
|
||||
* @param string|null $small_snake small_snake
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setSmallSnake($small_snake)
|
||||
{
|
||||
if (is_null($small_snake)) {
|
||||
throw new \InvalidArgumentException('non-nullable small_snake cannot be null');
|
||||
}
|
||||
$this->container['small_snake'] = $small_snake;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets capital_snake
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCapitalSnake()
|
||||
{
|
||||
return $this->container['capital_snake'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets capital_snake
|
||||
*
|
||||
* @param string|null $capital_snake capital_snake
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setCapitalSnake($capital_snake)
|
||||
{
|
||||
if (is_null($capital_snake)) {
|
||||
throw new \InvalidArgumentException('non-nullable capital_snake cannot be null');
|
||||
}
|
||||
$this->container['capital_snake'] = $capital_snake;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets sca_eth_flow_points
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getScaEthFlowPoints()
|
||||
{
|
||||
return $this->container['sca_eth_flow_points'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets sca_eth_flow_points
|
||||
*
|
||||
* @param string|null $sca_eth_flow_points sca_eth_flow_points
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setScaEthFlowPoints($sca_eth_flow_points)
|
||||
{
|
||||
if (is_null($sca_eth_flow_points)) {
|
||||
throw new \InvalidArgumentException('non-nullable sca_eth_flow_points cannot be null');
|
||||
}
|
||||
$this->container['sca_eth_flow_points'] = $sca_eth_flow_points;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets att_name
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getAttName()
|
||||
{
|
||||
return $this->container['att_name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets att_name
|
||||
*
|
||||
* @param string|null $att_name Name of the pet
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setAttName($att_name)
|
||||
{
|
||||
if (is_null($att_name)) {
|
||||
throw new \InvalidArgumentException('non-nullable att_name cannot be null');
|
||||
}
|
||||
$this->container['att_name'] = $att_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,403 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Cat
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* Cat Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class Cat extends Animal
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'Cat';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'declawed' => 'bool'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'declawed' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'declawed' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes + parent::openAPITypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats + parent::openAPIFormats();
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables + parent::openAPINullables();
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'declawed' => 'declawed'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'declawed' => 'setDeclawed'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'declawed' => 'getDeclawed'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return parent::attributeMap() + self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return parent::setters() + self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return parent::getters() + self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
parent::__construct($data);
|
||||
|
||||
$this->setIfExists('declawed', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = parent::listInvalidProperties();
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets declawed
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
public function getDeclawed()
|
||||
{
|
||||
return $this->container['declawed'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets declawed
|
||||
*
|
||||
* @param bool|null $declawed declawed
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setDeclawed($declawed)
|
||||
{
|
||||
if (is_null($declawed)) {
|
||||
throw new \InvalidArgumentException('non-nullable declawed cannot be null');
|
||||
}
|
||||
$this->container['declawed'] = $declawed;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,409 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CatAllOf
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* CatAllOf Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class CatAllOf implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'Cat_allOf';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'declawed' => 'bool'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'declawed' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'declawed' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'declawed' => 'declawed'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'declawed' => 'setDeclawed'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'declawed' => 'getDeclawed'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('declawed', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets declawed
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
public function getDeclawed()
|
||||
{
|
||||
return $this->container['declawed'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets declawed
|
||||
*
|
||||
* @param bool|null $declawed declawed
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setDeclawed($declawed)
|
||||
{
|
||||
if (is_null($declawed)) {
|
||||
throw new \InvalidArgumentException('non-nullable declawed cannot be null');
|
||||
}
|
||||
$this->container['declawed'] = $declawed;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,446 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Category
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* Category Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class Category implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'Category';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'id' => 'int',
|
||||
'name' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'id' => 'int64',
|
||||
'name' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'id' => false,
|
||||
'name' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'id' => 'setId',
|
||||
'name' => 'setName'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'id' => 'getId',
|
||||
'name' => 'getName'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('id', $data ?? [], null);
|
||||
$this->setIfExists('name', $data ?? [], 'default-name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
if ($this->container['name'] === null) {
|
||||
$invalidProperties[] = "'name' can't be null";
|
||||
}
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets id
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->container['id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets id
|
||||
*
|
||||
* @param int|null $id id
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
if (is_null($id)) {
|
||||
throw new \InvalidArgumentException('non-nullable id cannot be null');
|
||||
}
|
||||
$this->container['id'] = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->container['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets name
|
||||
*
|
||||
* @param string $name name
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
if (is_null($name)) {
|
||||
throw new \InvalidArgumentException('non-nullable name cannot be null');
|
||||
}
|
||||
$this->container['name'] = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,410 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ClassModel
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* ClassModel Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description Model for testing model with \"_class\" property
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'ClassModel';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'_class' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'_class' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'_class' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'_class' => '_class'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'_class' => 'setClass'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'_class' => 'getClass'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('_class', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets _class
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getClass()
|
||||
{
|
||||
return $this->container['_class'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets _class
|
||||
*
|
||||
* @param string|null $_class _class
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setClass($_class)
|
||||
{
|
||||
if (is_null($_class)) {
|
||||
throw new \InvalidArgumentException('non-nullable _class cannot be null');
|
||||
}
|
||||
$this->container['_class'] = $_class;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,409 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Client
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* Client Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class Client implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'Client';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'client' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'client' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'client' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'client' => 'client'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'client' => 'setClient'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'client' => 'getClient'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('client', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets client
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getClient()
|
||||
{
|
||||
return $this->container['client'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets client
|
||||
*
|
||||
* @param string|null $client client
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setClient($client)
|
||||
{
|
||||
if (is_null($client)) {
|
||||
throw new \InvalidArgumentException('non-nullable client cannot be null');
|
||||
}
|
||||
$this->container['client'] = $client;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,409 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* DeprecatedObject
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* DeprecatedObject Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'DeprecatedObject';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'name' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'name' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'name' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'name' => 'name'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'name' => 'setName'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'name' => 'getName'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('name', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets name
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->container['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets name
|
||||
*
|
||||
* @param string|null $name name
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
if (is_null($name)) {
|
||||
throw new \InvalidArgumentException('non-nullable name cannot be null');
|
||||
}
|
||||
$this->container['name'] = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,403 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Dog
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* Dog Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class Dog extends Animal
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'Dog';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'breed' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'breed' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'breed' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes + parent::openAPITypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats + parent::openAPIFormats();
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables + parent::openAPINullables();
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'breed' => 'breed'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'breed' => 'setBreed'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'breed' => 'getBreed'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return parent::attributeMap() + self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return parent::setters() + self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return parent::getters() + self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
parent::__construct($data);
|
||||
|
||||
$this->setIfExists('breed', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = parent::listInvalidProperties();
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets breed
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getBreed()
|
||||
{
|
||||
return $this->container['breed'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets breed
|
||||
*
|
||||
* @param string|null $breed breed
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setBreed($breed)
|
||||
{
|
||||
if (is_null($breed)) {
|
||||
throw new \InvalidArgumentException('non-nullable breed cannot be null');
|
||||
}
|
||||
$this->container['breed'] = $breed;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,409 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* DogAllOf
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* DogAllOf Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class DogAllOf implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'Dog_allOf';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'breed' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'breed' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'breed' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'breed' => 'breed'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'breed' => 'setBreed'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'breed' => 'getBreed'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('breed', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets breed
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getBreed()
|
||||
{
|
||||
return $this->container['breed'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets breed
|
||||
*
|
||||
* @param string|null $breed breed
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setBreed($breed)
|
||||
{
|
||||
if (is_null($breed)) {
|
||||
throw new \InvalidArgumentException('non-nullable breed cannot be null');
|
||||
}
|
||||
$this->container['breed'] = $breed;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,501 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* EnumArrays
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* EnumArrays Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'EnumArrays';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'just_symbol' => 'string',
|
||||
'array_enum' => 'string[]'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'just_symbol' => null,
|
||||
'array_enum' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'just_symbol' => false,
|
||||
'array_enum' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'just_symbol' => 'just_symbol',
|
||||
'array_enum' => 'array_enum'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'just_symbol' => 'setJustSymbol',
|
||||
'array_enum' => 'setArrayEnum'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'just_symbol' => 'getJustSymbol',
|
||||
'array_enum' => 'getArrayEnum'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
public const JUST_SYMBOL_GREATER_THAN_OR_EQUAL_TO = '>=';
|
||||
public const JUST_SYMBOL_DOLLAR = '$';
|
||||
public const ARRAY_ENUM_FISH = 'fish';
|
||||
public const ARRAY_ENUM_CRAB = 'crab';
|
||||
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getJustSymbolAllowableValues()
|
||||
{
|
||||
return [
|
||||
self::JUST_SYMBOL_GREATER_THAN_OR_EQUAL_TO,
|
||||
self::JUST_SYMBOL_DOLLAR,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getArrayEnumAllowableValues()
|
||||
{
|
||||
return [
|
||||
self::ARRAY_ENUM_FISH,
|
||||
self::ARRAY_ENUM_CRAB,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('just_symbol', $data ?? [], null);
|
||||
$this->setIfExists('array_enum', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
$allowedValues = $this->getJustSymbolAllowableValues();
|
||||
if (!is_null($this->container['just_symbol']) && !in_array($this->container['just_symbol'], $allowedValues, true)) {
|
||||
$invalidProperties[] = sprintf(
|
||||
"invalid value '%s' for 'just_symbol', must be one of '%s'",
|
||||
$this->container['just_symbol'],
|
||||
implode("', '", $allowedValues)
|
||||
);
|
||||
}
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets just_symbol
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getJustSymbol()
|
||||
{
|
||||
return $this->container['just_symbol'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets just_symbol
|
||||
*
|
||||
* @param string|null $just_symbol just_symbol
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setJustSymbol($just_symbol)
|
||||
{
|
||||
if (is_null($just_symbol)) {
|
||||
throw new \InvalidArgumentException('non-nullable just_symbol cannot be null');
|
||||
}
|
||||
$allowedValues = $this->getJustSymbolAllowableValues();
|
||||
if (!in_array($just_symbol, $allowedValues, true)) {
|
||||
throw new \InvalidArgumentException(
|
||||
sprintf(
|
||||
"Invalid value '%s' for 'just_symbol', must be one of '%s'",
|
||||
$just_symbol,
|
||||
implode("', '", $allowedValues)
|
||||
)
|
||||
);
|
||||
}
|
||||
$this->container['just_symbol'] = $just_symbol;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets array_enum
|
||||
*
|
||||
* @return string[]|null
|
||||
*/
|
||||
public function getArrayEnum()
|
||||
{
|
||||
return $this->container['array_enum'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets array_enum
|
||||
*
|
||||
* @param string[]|null $array_enum array_enum
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setArrayEnum($array_enum)
|
||||
{
|
||||
if (is_null($array_enum)) {
|
||||
throw new \InvalidArgumentException('non-nullable array_enum cannot be null');
|
||||
}
|
||||
$allowedValues = $this->getArrayEnumAllowableValues();
|
||||
if (array_diff($array_enum, $allowedValues)) {
|
||||
throw new \InvalidArgumentException(
|
||||
sprintf(
|
||||
"Invalid value for 'array_enum', must be one of '%s'",
|
||||
implode("', '", $allowedValues)
|
||||
)
|
||||
);
|
||||
}
|
||||
$this->container['array_enum'] = $array_enum;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* EnumClass
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* EnumClass Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class EnumClass
|
||||
{
|
||||
/**
|
||||
* Possible values of this enum
|
||||
*/
|
||||
public const ABC = '_abc';
|
||||
|
||||
public const EFG = '-efg';
|
||||
|
||||
public const XYZ = '(xyz)';
|
||||
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getAllowableEnumValues()
|
||||
{
|
||||
return [
|
||||
self::ABC,
|
||||
self::EFG,
|
||||
self::XYZ
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,797 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* EnumTest
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* EnumTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'Enum_Test';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'enum_string' => 'string',
|
||||
'enum_string_required' => 'string',
|
||||
'enum_integer' => 'int',
|
||||
'enum_number' => 'float',
|
||||
'outer_enum' => '\OpenAPI\Client\Model\OuterEnum',
|
||||
'outer_enum_integer' => '\OpenAPI\Client\Model\OuterEnumInteger',
|
||||
'outer_enum_default_value' => '\OpenAPI\Client\Model\OuterEnumDefaultValue',
|
||||
'outer_enum_integer_default_value' => '\OpenAPI\Client\Model\OuterEnumIntegerDefaultValue'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'enum_string' => null,
|
||||
'enum_string_required' => null,
|
||||
'enum_integer' => 'int32',
|
||||
'enum_number' => 'double',
|
||||
'outer_enum' => null,
|
||||
'outer_enum_integer' => null,
|
||||
'outer_enum_default_value' => null,
|
||||
'outer_enum_integer_default_value' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'enum_string' => false,
|
||||
'enum_string_required' => false,
|
||||
'enum_integer' => false,
|
||||
'enum_number' => false,
|
||||
'outer_enum' => true,
|
||||
'outer_enum_integer' => false,
|
||||
'outer_enum_default_value' => false,
|
||||
'outer_enum_integer_default_value' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'enum_string' => 'enum_string',
|
||||
'enum_string_required' => 'enum_string_required',
|
||||
'enum_integer' => 'enum_integer',
|
||||
'enum_number' => 'enum_number',
|
||||
'outer_enum' => 'outerEnum',
|
||||
'outer_enum_integer' => 'outerEnumInteger',
|
||||
'outer_enum_default_value' => 'outerEnumDefaultValue',
|
||||
'outer_enum_integer_default_value' => 'outerEnumIntegerDefaultValue'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'enum_string' => 'setEnumString',
|
||||
'enum_string_required' => 'setEnumStringRequired',
|
||||
'enum_integer' => 'setEnumInteger',
|
||||
'enum_number' => 'setEnumNumber',
|
||||
'outer_enum' => 'setOuterEnum',
|
||||
'outer_enum_integer' => 'setOuterEnumInteger',
|
||||
'outer_enum_default_value' => 'setOuterEnumDefaultValue',
|
||||
'outer_enum_integer_default_value' => 'setOuterEnumIntegerDefaultValue'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'enum_string' => 'getEnumString',
|
||||
'enum_string_required' => 'getEnumStringRequired',
|
||||
'enum_integer' => 'getEnumInteger',
|
||||
'enum_number' => 'getEnumNumber',
|
||||
'outer_enum' => 'getOuterEnum',
|
||||
'outer_enum_integer' => 'getOuterEnumInteger',
|
||||
'outer_enum_default_value' => 'getOuterEnumDefaultValue',
|
||||
'outer_enum_integer_default_value' => 'getOuterEnumIntegerDefaultValue'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
public const ENUM_STRING_UPPER = 'UPPER';
|
||||
public const ENUM_STRING_LOWER = 'lower';
|
||||
public const ENUM_STRING_EMPTY = '';
|
||||
public const ENUM_STRING_REQUIRED_UPPER = 'UPPER';
|
||||
public const ENUM_STRING_REQUIRED_LOWER = 'lower';
|
||||
public const ENUM_STRING_REQUIRED_EMPTY = '';
|
||||
public const ENUM_INTEGER_1 = 1;
|
||||
public const ENUM_INTEGER_MINUS_1 = -1;
|
||||
public const ENUM_NUMBER_1_DOT_1 = 1.1;
|
||||
public const ENUM_NUMBER_MINUS_1_DOT_2 = -1.2;
|
||||
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getEnumStringAllowableValues()
|
||||
{
|
||||
return [
|
||||
self::ENUM_STRING_UPPER,
|
||||
self::ENUM_STRING_LOWER,
|
||||
self::ENUM_STRING_EMPTY,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getEnumStringRequiredAllowableValues()
|
||||
{
|
||||
return [
|
||||
self::ENUM_STRING_REQUIRED_UPPER,
|
||||
self::ENUM_STRING_REQUIRED_LOWER,
|
||||
self::ENUM_STRING_REQUIRED_EMPTY,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getEnumIntegerAllowableValues()
|
||||
{
|
||||
return [
|
||||
self::ENUM_INTEGER_1,
|
||||
self::ENUM_INTEGER_MINUS_1,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getEnumNumberAllowableValues()
|
||||
{
|
||||
return [
|
||||
self::ENUM_NUMBER_1_DOT_1,
|
||||
self::ENUM_NUMBER_MINUS_1_DOT_2,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('enum_string', $data ?? [], null);
|
||||
$this->setIfExists('enum_string_required', $data ?? [], null);
|
||||
$this->setIfExists('enum_integer', $data ?? [], null);
|
||||
$this->setIfExists('enum_number', $data ?? [], null);
|
||||
$this->setIfExists('outer_enum', $data ?? [], null);
|
||||
$this->setIfExists('outer_enum_integer', $data ?? [], null);
|
||||
$this->setIfExists('outer_enum_default_value', $data ?? [], null);
|
||||
$this->setIfExists('outer_enum_integer_default_value', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
$allowedValues = $this->getEnumStringAllowableValues();
|
||||
if (!is_null($this->container['enum_string']) && !in_array($this->container['enum_string'], $allowedValues, true)) {
|
||||
$invalidProperties[] = sprintf(
|
||||
"invalid value '%s' for 'enum_string', must be one of '%s'",
|
||||
$this->container['enum_string'],
|
||||
implode("', '", $allowedValues)
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->container['enum_string_required'] === null) {
|
||||
$invalidProperties[] = "'enum_string_required' can't be null";
|
||||
}
|
||||
$allowedValues = $this->getEnumStringRequiredAllowableValues();
|
||||
if (!is_null($this->container['enum_string_required']) && !in_array($this->container['enum_string_required'], $allowedValues, true)) {
|
||||
$invalidProperties[] = sprintf(
|
||||
"invalid value '%s' for 'enum_string_required', must be one of '%s'",
|
||||
$this->container['enum_string_required'],
|
||||
implode("', '", $allowedValues)
|
||||
);
|
||||
}
|
||||
|
||||
$allowedValues = $this->getEnumIntegerAllowableValues();
|
||||
if (!is_null($this->container['enum_integer']) && !in_array($this->container['enum_integer'], $allowedValues, true)) {
|
||||
$invalidProperties[] = sprintf(
|
||||
"invalid value '%s' for 'enum_integer', must be one of '%s'",
|
||||
$this->container['enum_integer'],
|
||||
implode("', '", $allowedValues)
|
||||
);
|
||||
}
|
||||
|
||||
$allowedValues = $this->getEnumNumberAllowableValues();
|
||||
if (!is_null($this->container['enum_number']) && !in_array($this->container['enum_number'], $allowedValues, true)) {
|
||||
$invalidProperties[] = sprintf(
|
||||
"invalid value '%s' for 'enum_number', must be one of '%s'",
|
||||
$this->container['enum_number'],
|
||||
implode("', '", $allowedValues)
|
||||
);
|
||||
}
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets enum_string
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getEnumString()
|
||||
{
|
||||
return $this->container['enum_string'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets enum_string
|
||||
*
|
||||
* @param string|null $enum_string enum_string
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setEnumString($enum_string)
|
||||
{
|
||||
if (is_null($enum_string)) {
|
||||
throw new \InvalidArgumentException('non-nullable enum_string cannot be null');
|
||||
}
|
||||
$allowedValues = $this->getEnumStringAllowableValues();
|
||||
if (!in_array($enum_string, $allowedValues, true)) {
|
||||
throw new \InvalidArgumentException(
|
||||
sprintf(
|
||||
"Invalid value '%s' for 'enum_string', must be one of '%s'",
|
||||
$enum_string,
|
||||
implode("', '", $allowedValues)
|
||||
)
|
||||
);
|
||||
}
|
||||
$this->container['enum_string'] = $enum_string;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets enum_string_required
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEnumStringRequired()
|
||||
{
|
||||
return $this->container['enum_string_required'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets enum_string_required
|
||||
*
|
||||
* @param string $enum_string_required enum_string_required
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setEnumStringRequired($enum_string_required)
|
||||
{
|
||||
if (is_null($enum_string_required)) {
|
||||
throw new \InvalidArgumentException('non-nullable enum_string_required cannot be null');
|
||||
}
|
||||
$allowedValues = $this->getEnumStringRequiredAllowableValues();
|
||||
if (!in_array($enum_string_required, $allowedValues, true)) {
|
||||
throw new \InvalidArgumentException(
|
||||
sprintf(
|
||||
"Invalid value '%s' for 'enum_string_required', must be one of '%s'",
|
||||
$enum_string_required,
|
||||
implode("', '", $allowedValues)
|
||||
)
|
||||
);
|
||||
}
|
||||
$this->container['enum_string_required'] = $enum_string_required;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets enum_integer
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getEnumInteger()
|
||||
{
|
||||
return $this->container['enum_integer'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets enum_integer
|
||||
*
|
||||
* @param int|null $enum_integer enum_integer
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setEnumInteger($enum_integer)
|
||||
{
|
||||
if (is_null($enum_integer)) {
|
||||
throw new \InvalidArgumentException('non-nullable enum_integer cannot be null');
|
||||
}
|
||||
$allowedValues = $this->getEnumIntegerAllowableValues();
|
||||
if (!in_array($enum_integer, $allowedValues, true)) {
|
||||
throw new \InvalidArgumentException(
|
||||
sprintf(
|
||||
"Invalid value '%s' for 'enum_integer', must be one of '%s'",
|
||||
$enum_integer,
|
||||
implode("', '", $allowedValues)
|
||||
)
|
||||
);
|
||||
}
|
||||
$this->container['enum_integer'] = $enum_integer;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets enum_number
|
||||
*
|
||||
* @return float|null
|
||||
*/
|
||||
public function getEnumNumber()
|
||||
{
|
||||
return $this->container['enum_number'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets enum_number
|
||||
*
|
||||
* @param float|null $enum_number enum_number
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setEnumNumber($enum_number)
|
||||
{
|
||||
if (is_null($enum_number)) {
|
||||
throw new \InvalidArgumentException('non-nullable enum_number cannot be null');
|
||||
}
|
||||
$allowedValues = $this->getEnumNumberAllowableValues();
|
||||
if (!in_array($enum_number, $allowedValues, true)) {
|
||||
throw new \InvalidArgumentException(
|
||||
sprintf(
|
||||
"Invalid value '%s' for 'enum_number', must be one of '%s'",
|
||||
$enum_number,
|
||||
implode("', '", $allowedValues)
|
||||
)
|
||||
);
|
||||
}
|
||||
$this->container['enum_number'] = $enum_number;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets outer_enum
|
||||
*
|
||||
* @return \OpenAPI\Client\Model\OuterEnum|null
|
||||
*/
|
||||
public function getOuterEnum()
|
||||
{
|
||||
return $this->container['outer_enum'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets outer_enum
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\OuterEnum|null $outer_enum outer_enum
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setOuterEnum($outer_enum)
|
||||
{
|
||||
if (is_null($outer_enum)) {
|
||||
array_push($this->openAPINullablesSetToNull, 'outer_enum');
|
||||
} else {
|
||||
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
|
||||
$index = array_search('outer_enum', $nullablesSetToNull);
|
||||
if ($index !== FALSE) {
|
||||
unset($nullablesSetToNull[$index]);
|
||||
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
|
||||
}
|
||||
}
|
||||
$this->container['outer_enum'] = $outer_enum;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets outer_enum_integer
|
||||
*
|
||||
* @return \OpenAPI\Client\Model\OuterEnumInteger|null
|
||||
*/
|
||||
public function getOuterEnumInteger()
|
||||
{
|
||||
return $this->container['outer_enum_integer'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets outer_enum_integer
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\OuterEnumInteger|null $outer_enum_integer outer_enum_integer
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setOuterEnumInteger($outer_enum_integer)
|
||||
{
|
||||
if (is_null($outer_enum_integer)) {
|
||||
throw new \InvalidArgumentException('non-nullable outer_enum_integer cannot be null');
|
||||
}
|
||||
$this->container['outer_enum_integer'] = $outer_enum_integer;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets outer_enum_default_value
|
||||
*
|
||||
* @return \OpenAPI\Client\Model\OuterEnumDefaultValue|null
|
||||
*/
|
||||
public function getOuterEnumDefaultValue()
|
||||
{
|
||||
return $this->container['outer_enum_default_value'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets outer_enum_default_value
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\OuterEnumDefaultValue|null $outer_enum_default_value outer_enum_default_value
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setOuterEnumDefaultValue($outer_enum_default_value)
|
||||
{
|
||||
if (is_null($outer_enum_default_value)) {
|
||||
throw new \InvalidArgumentException('non-nullable outer_enum_default_value cannot be null');
|
||||
}
|
||||
$this->container['outer_enum_default_value'] = $outer_enum_default_value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets outer_enum_integer_default_value
|
||||
*
|
||||
* @return \OpenAPI\Client\Model\OuterEnumIntegerDefaultValue|null
|
||||
*/
|
||||
public function getOuterEnumIntegerDefaultValue()
|
||||
{
|
||||
return $this->container['outer_enum_integer_default_value'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets outer_enum_integer_default_value
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\OuterEnumIntegerDefaultValue|null $outer_enum_integer_default_value outer_enum_integer_default_value
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setOuterEnumIntegerDefaultValue($outer_enum_integer_default_value)
|
||||
{
|
||||
if (is_null($outer_enum_integer_default_value)) {
|
||||
throw new \InvalidArgumentException('non-nullable outer_enum_integer_default_value cannot be null');
|
||||
}
|
||||
$this->container['outer_enum_integer_default_value'] = $outer_enum_integer_default_value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,410 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* File
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* File Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description Must be named `File` for test.
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class File implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'File';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'source_uri' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'source_uri' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'source_uri' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'source_uri' => 'sourceURI'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'source_uri' => 'setSourceUri'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'source_uri' => 'getSourceUri'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('source_uri', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets source_uri
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSourceUri()
|
||||
{
|
||||
return $this->container['source_uri'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets source_uri
|
||||
*
|
||||
* @param string|null $source_uri Test capitalization
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setSourceUri($source_uri)
|
||||
{
|
||||
if (is_null($source_uri)) {
|
||||
throw new \InvalidArgumentException('non-nullable source_uri cannot be null');
|
||||
}
|
||||
$this->container['source_uri'] = $source_uri;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,443 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* FileSchemaTestClass
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* FileSchemaTestClass Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'FileSchemaTestClass';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'file' => '\OpenAPI\Client\Model\File',
|
||||
'files' => '\OpenAPI\Client\Model\File[]'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'file' => null,
|
||||
'files' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'file' => false,
|
||||
'files' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'file' => 'file',
|
||||
'files' => 'files'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'file' => 'setFile',
|
||||
'files' => 'setFiles'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'file' => 'getFile',
|
||||
'files' => 'getFiles'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('file', $data ?? [], null);
|
||||
$this->setIfExists('files', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets file
|
||||
*
|
||||
* @return \OpenAPI\Client\Model\File|null
|
||||
*/
|
||||
public function getFile()
|
||||
{
|
||||
return $this->container['file'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets file
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\File|null $file file
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setFile($file)
|
||||
{
|
||||
if (is_null($file)) {
|
||||
throw new \InvalidArgumentException('non-nullable file cannot be null');
|
||||
}
|
||||
$this->container['file'] = $file;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets files
|
||||
*
|
||||
* @return \OpenAPI\Client\Model\File[]|null
|
||||
*/
|
||||
public function getFiles()
|
||||
{
|
||||
return $this->container['files'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets files
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\File[]|null $files files
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setFiles($files)
|
||||
{
|
||||
if (is_null($files)) {
|
||||
throw new \InvalidArgumentException('non-nullable files cannot be null');
|
||||
}
|
||||
$this->container['files'] = $files;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,409 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Foo
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* Foo Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'Foo';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'bar' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'bar' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'bar' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'bar' => 'bar'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'bar' => 'setBar'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'bar' => 'getBar'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('bar', $data ?? [], 'bar');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets bar
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getBar()
|
||||
{
|
||||
return $this->container['bar'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets bar
|
||||
*
|
||||
* @param string|null $bar bar
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setBar($bar)
|
||||
{
|
||||
if (is_null($bar)) {
|
||||
throw new \InvalidArgumentException('non-nullable bar cannot be null');
|
||||
}
|
||||
$this->container['bar'] = $bar;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,409 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* FooGetDefaultResponse
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* FooGetDefaultResponse Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = '_foo_get_default_response';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'string' => '\OpenAPI\Client\Model\Foo'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'string' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'string' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'string' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'string' => 'setString'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'string' => 'getString'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('string', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets string
|
||||
*
|
||||
* @return \OpenAPI\Client\Model\Foo|null
|
||||
*/
|
||||
public function getString()
|
||||
{
|
||||
return $this->container['string'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets string
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\Foo|null $string string
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setString($string)
|
||||
{
|
||||
if (is_null($string)) {
|
||||
throw new \InvalidArgumentException('non-nullable string cannot be null');
|
||||
}
|
||||
$this->container['string'] = $string;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,443 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* HasOnlyReadOnly
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* HasOnlyReadOnly Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'hasOnlyReadOnly';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'bar' => 'string',
|
||||
'foo' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'bar' => null,
|
||||
'foo' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'bar' => false,
|
||||
'foo' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'bar' => 'bar',
|
||||
'foo' => 'foo'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'bar' => 'setBar',
|
||||
'foo' => 'setFoo'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'bar' => 'getBar',
|
||||
'foo' => 'getFoo'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('bar', $data ?? [], null);
|
||||
$this->setIfExists('foo', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets bar
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getBar()
|
||||
{
|
||||
return $this->container['bar'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets bar
|
||||
*
|
||||
* @param string|null $bar bar
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setBar($bar)
|
||||
{
|
||||
if (is_null($bar)) {
|
||||
throw new \InvalidArgumentException('non-nullable bar cannot be null');
|
||||
}
|
||||
$this->container['bar'] = $bar;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets foo
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFoo()
|
||||
{
|
||||
return $this->container['foo'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets foo
|
||||
*
|
||||
* @param string|null $foo foo
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setFoo($foo)
|
||||
{
|
||||
if (is_null($foo)) {
|
||||
throw new \InvalidArgumentException('non-nullable foo cannot be null');
|
||||
}
|
||||
$this->container['foo'] = $foo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,417 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* HealthCheckResult
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* HealthCheckResult Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'HealthCheckResult';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'nullable_message' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'nullable_message' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'nullable_message' => true
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'nullable_message' => 'NullableMessage'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'nullable_message' => 'setNullableMessage'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'nullable_message' => 'getNullableMessage'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('nullable_message', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets nullable_message
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getNullableMessage()
|
||||
{
|
||||
return $this->container['nullable_message'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets nullable_message
|
||||
*
|
||||
* @param string|null $nullable_message nullable_message
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setNullableMessage($nullable_message)
|
||||
{
|
||||
if (is_null($nullable_message)) {
|
||||
array_push($this->openAPINullablesSetToNull, 'nullable_message');
|
||||
} else {
|
||||
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
|
||||
$index = array_search('nullable_message', $nullablesSetToNull);
|
||||
if ($index !== FALSE) {
|
||||
unset($nullablesSetToNull[$index]);
|
||||
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
|
||||
}
|
||||
}
|
||||
$this->container['nullable_message'] = $nullable_message;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,535 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* MapTest
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* MapTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'MapTest';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'map_map_of_string' => 'array<string,array<string,string>>',
|
||||
'map_of_enum_string' => 'array<string,string>',
|
||||
'direct_map' => 'array<string,bool>',
|
||||
'indirect_map' => 'array<string,bool>'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'map_map_of_string' => null,
|
||||
'map_of_enum_string' => null,
|
||||
'direct_map' => null,
|
||||
'indirect_map' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'map_map_of_string' => false,
|
||||
'map_of_enum_string' => false,
|
||||
'direct_map' => false,
|
||||
'indirect_map' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'map_map_of_string' => 'map_map_of_string',
|
||||
'map_of_enum_string' => 'map_of_enum_string',
|
||||
'direct_map' => 'direct_map',
|
||||
'indirect_map' => 'indirect_map'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'map_map_of_string' => 'setMapMapOfString',
|
||||
'map_of_enum_string' => 'setMapOfEnumString',
|
||||
'direct_map' => 'setDirectMap',
|
||||
'indirect_map' => 'setIndirectMap'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'map_map_of_string' => 'getMapMapOfString',
|
||||
'map_of_enum_string' => 'getMapOfEnumString',
|
||||
'direct_map' => 'getDirectMap',
|
||||
'indirect_map' => 'getIndirectMap'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
public const MAP_OF_ENUM_STRING_UPPER = 'UPPER';
|
||||
public const MAP_OF_ENUM_STRING_LOWER = 'lower';
|
||||
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getMapOfEnumStringAllowableValues()
|
||||
{
|
||||
return [
|
||||
self::MAP_OF_ENUM_STRING_UPPER,
|
||||
self::MAP_OF_ENUM_STRING_LOWER,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('map_map_of_string', $data ?? [], null);
|
||||
$this->setIfExists('map_of_enum_string', $data ?? [], null);
|
||||
$this->setIfExists('direct_map', $data ?? [], null);
|
||||
$this->setIfExists('indirect_map', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets map_map_of_string
|
||||
*
|
||||
* @return array<string,array<string,string>>|null
|
||||
*/
|
||||
public function getMapMapOfString()
|
||||
{
|
||||
return $this->container['map_map_of_string'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets map_map_of_string
|
||||
*
|
||||
* @param array<string,array<string,string>>|null $map_map_of_string map_map_of_string
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setMapMapOfString($map_map_of_string)
|
||||
{
|
||||
if (is_null($map_map_of_string)) {
|
||||
throw new \InvalidArgumentException('non-nullable map_map_of_string cannot be null');
|
||||
}
|
||||
$this->container['map_map_of_string'] = $map_map_of_string;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets map_of_enum_string
|
||||
*
|
||||
* @return array<string,string>|null
|
||||
*/
|
||||
public function getMapOfEnumString()
|
||||
{
|
||||
return $this->container['map_of_enum_string'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets map_of_enum_string
|
||||
*
|
||||
* @param array<string,string>|null $map_of_enum_string map_of_enum_string
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setMapOfEnumString($map_of_enum_string)
|
||||
{
|
||||
if (is_null($map_of_enum_string)) {
|
||||
throw new \InvalidArgumentException('non-nullable map_of_enum_string cannot be null');
|
||||
}
|
||||
$allowedValues = $this->getMapOfEnumStringAllowableValues();
|
||||
if (array_diff($map_of_enum_string, $allowedValues)) {
|
||||
throw new \InvalidArgumentException(
|
||||
sprintf(
|
||||
"Invalid value for 'map_of_enum_string', must be one of '%s'",
|
||||
implode("', '", $allowedValues)
|
||||
)
|
||||
);
|
||||
}
|
||||
$this->container['map_of_enum_string'] = $map_of_enum_string;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets direct_map
|
||||
*
|
||||
* @return array<string,bool>|null
|
||||
*/
|
||||
public function getDirectMap()
|
||||
{
|
||||
return $this->container['direct_map'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets direct_map
|
||||
*
|
||||
* @param array<string,bool>|null $direct_map direct_map
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setDirectMap($direct_map)
|
||||
{
|
||||
if (is_null($direct_map)) {
|
||||
throw new \InvalidArgumentException('non-nullable direct_map cannot be null');
|
||||
}
|
||||
$this->container['direct_map'] = $direct_map;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets indirect_map
|
||||
*
|
||||
* @return array<string,bool>|null
|
||||
*/
|
||||
public function getIndirectMap()
|
||||
{
|
||||
return $this->container['indirect_map'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets indirect_map
|
||||
*
|
||||
* @param array<string,bool>|null $indirect_map indirect_map
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setIndirectMap($indirect_map)
|
||||
{
|
||||
if (is_null($indirect_map)) {
|
||||
throw new \InvalidArgumentException('non-nullable indirect_map cannot be null');
|
||||
}
|
||||
$this->container['indirect_map'] = $indirect_map;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,477 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* MixedPropertiesAndAdditionalPropertiesClass
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* MixedPropertiesAndAdditionalPropertiesClass Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'MixedPropertiesAndAdditionalPropertiesClass';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'uuid' => 'string',
|
||||
'date_time' => '\DateTime',
|
||||
'map' => 'array<string,\OpenAPI\Client\Model\Animal>'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'uuid' => 'uuid',
|
||||
'date_time' => 'date-time',
|
||||
'map' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'uuid' => false,
|
||||
'date_time' => false,
|
||||
'map' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'uuid' => 'uuid',
|
||||
'date_time' => 'dateTime',
|
||||
'map' => 'map'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'uuid' => 'setUuid',
|
||||
'date_time' => 'setDateTime',
|
||||
'map' => 'setMap'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'uuid' => 'getUuid',
|
||||
'date_time' => 'getDateTime',
|
||||
'map' => 'getMap'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('uuid', $data ?? [], null);
|
||||
$this->setIfExists('date_time', $data ?? [], null);
|
||||
$this->setIfExists('map', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets uuid
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getUuid()
|
||||
{
|
||||
return $this->container['uuid'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets uuid
|
||||
*
|
||||
* @param string|null $uuid uuid
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setUuid($uuid)
|
||||
{
|
||||
if (is_null($uuid)) {
|
||||
throw new \InvalidArgumentException('non-nullable uuid cannot be null');
|
||||
}
|
||||
$this->container['uuid'] = $uuid;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets date_time
|
||||
*
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function getDateTime()
|
||||
{
|
||||
return $this->container['date_time'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets date_time
|
||||
*
|
||||
* @param \DateTime|null $date_time date_time
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setDateTime($date_time)
|
||||
{
|
||||
if (is_null($date_time)) {
|
||||
throw new \InvalidArgumentException('non-nullable date_time cannot be null');
|
||||
}
|
||||
$this->container['date_time'] = $date_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets map
|
||||
*
|
||||
* @return array<string,\OpenAPI\Client\Model\Animal>|null
|
||||
*/
|
||||
public function getMap()
|
||||
{
|
||||
return $this->container['map'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets map
|
||||
*
|
||||
* @param array<string,\OpenAPI\Client\Model\Animal>|null $map map
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setMap($map)
|
||||
{
|
||||
if (is_null($map)) {
|
||||
throw new \InvalidArgumentException('non-nullable map cannot be null');
|
||||
}
|
||||
$this->container['map'] = $map;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,444 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Model200Response
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* Model200Response Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description Model for testing model name starting with number
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = '200_response';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'name' => 'int',
|
||||
'class' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'name' => 'int32',
|
||||
'class' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'name' => false,
|
||||
'class' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'name' => 'name',
|
||||
'class' => 'class'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'name' => 'setName',
|
||||
'class' => 'setClass'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'name' => 'getName',
|
||||
'class' => 'getClass'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('name', $data ?? [], null);
|
||||
$this->setIfExists('class', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets name
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->container['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets name
|
||||
*
|
||||
* @param int|null $name name
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
if (is_null($name)) {
|
||||
throw new \InvalidArgumentException('non-nullable name cannot be null');
|
||||
}
|
||||
$this->container['name'] = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets class
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getClass()
|
||||
{
|
||||
return $this->container['class'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets class
|
||||
*
|
||||
* @param string|null $class class
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setClass($class)
|
||||
{
|
||||
if (is_null($class)) {
|
||||
throw new \InvalidArgumentException('non-nullable class cannot be null');
|
||||
}
|
||||
$this->container['class'] = $class;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,111 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ModelInterface
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client\Model
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
/**
|
||||
* Interface abstracting model access.
|
||||
*
|
||||
* @package OpenAPI\Client\Model
|
||||
* @author OpenAPI Generator team
|
||||
*/
|
||||
interface ModelInterface
|
||||
{
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName();
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes();
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats();
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name, and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap();
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters();
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters();
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function listInvalidProperties();
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function valid();
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool;
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool;
|
||||
}
|
@ -1,409 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ModelList
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* ModelList Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'List';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'_123_list' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'_123_list' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'_123_list' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'_123_list' => '123-list'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'_123_list' => 'set123List'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'_123_list' => 'get123List'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('_123_list', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets _123_list
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function get123List()
|
||||
{
|
||||
return $this->container['_123_list'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets _123_list
|
||||
*
|
||||
* @param string|null $_123_list _123_list
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set123List($_123_list)
|
||||
{
|
||||
if (is_null($_123_list)) {
|
||||
throw new \InvalidArgumentException('non-nullable _123_list cannot be null');
|
||||
}
|
||||
$this->container['_123_list'] = $_123_list;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,410 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ModelReturn
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* ModelReturn Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description Model for testing reserved words
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'Return';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'return' => 'int'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'return' => 'int32'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'return' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'return' => 'return'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'return' => 'setReturn'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'return' => 'getReturn'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('return', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets return
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getReturn()
|
||||
{
|
||||
return $this->container['return'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets return
|
||||
*
|
||||
* @param int|null $return return
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setReturn($return)
|
||||
{
|
||||
if (is_null($return)) {
|
||||
throw new \InvalidArgumentException('non-nullable return cannot be null');
|
||||
}
|
||||
$this->container['return'] = $return;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,515 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Name
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* Name Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description Model for testing model name same as property name
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class Name implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'Name';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'name' => 'int',
|
||||
'snake_case' => 'int',
|
||||
'property' => 'string',
|
||||
'_123_number' => 'int'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'name' => 'int32',
|
||||
'snake_case' => 'int32',
|
||||
'property' => null,
|
||||
'_123_number' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'name' => false,
|
||||
'snake_case' => false,
|
||||
'property' => false,
|
||||
'_123_number' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'name' => 'name',
|
||||
'snake_case' => 'snake_case',
|
||||
'property' => 'property',
|
||||
'_123_number' => '123Number'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'name' => 'setName',
|
||||
'snake_case' => 'setSnakeCase',
|
||||
'property' => 'setProperty',
|
||||
'_123_number' => 'set123Number'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'name' => 'getName',
|
||||
'snake_case' => 'getSnakeCase',
|
||||
'property' => 'getProperty',
|
||||
'_123_number' => 'get123Number'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('name', $data ?? [], null);
|
||||
$this->setIfExists('snake_case', $data ?? [], null);
|
||||
$this->setIfExists('property', $data ?? [], null);
|
||||
$this->setIfExists('_123_number', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
if ($this->container['name'] === null) {
|
||||
$invalidProperties[] = "'name' can't be null";
|
||||
}
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets name
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->container['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets name
|
||||
*
|
||||
* @param int $name name
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
if (is_null($name)) {
|
||||
throw new \InvalidArgumentException('non-nullable name cannot be null');
|
||||
}
|
||||
$this->container['name'] = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets snake_case
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getSnakeCase()
|
||||
{
|
||||
return $this->container['snake_case'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets snake_case
|
||||
*
|
||||
* @param int|null $snake_case snake_case
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setSnakeCase($snake_case)
|
||||
{
|
||||
if (is_null($snake_case)) {
|
||||
throw new \InvalidArgumentException('non-nullable snake_case cannot be null');
|
||||
}
|
||||
$this->container['snake_case'] = $snake_case;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets property
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getProperty()
|
||||
{
|
||||
return $this->container['property'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets property
|
||||
*
|
||||
* @param string|null $property property
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setProperty($property)
|
||||
{
|
||||
if (is_null($property)) {
|
||||
throw new \InvalidArgumentException('non-nullable property cannot be null');
|
||||
}
|
||||
$this->container['property'] = $property;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets _123_number
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function get123Number()
|
||||
{
|
||||
return $this->container['_123_number'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets _123_number
|
||||
*
|
||||
* @param int|null $_123_number _123_number
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set123Number($_123_number)
|
||||
{
|
||||
if (is_null($_123_number)) {
|
||||
throw new \InvalidArgumentException('non-nullable _123_number cannot be null');
|
||||
}
|
||||
$this->container['_123_number'] = $_123_number;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,853 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NullableClass
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* NullableClass Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'NullableClass';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'integer_prop' => 'int',
|
||||
'number_prop' => 'float',
|
||||
'boolean_prop' => 'bool',
|
||||
'string_prop' => 'string',
|
||||
'date_prop' => '\DateTime',
|
||||
'datetime_prop' => '\DateTime',
|
||||
'array_nullable_prop' => 'object[]',
|
||||
'array_and_items_nullable_prop' => 'object[]',
|
||||
'array_items_nullable' => 'object[]',
|
||||
'object_nullable_prop' => 'array<string,object>',
|
||||
'object_and_items_nullable_prop' => 'array<string,object>',
|
||||
'object_items_nullable' => 'array<string,object>'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'integer_prop' => null,
|
||||
'number_prop' => null,
|
||||
'boolean_prop' => null,
|
||||
'string_prop' => null,
|
||||
'date_prop' => 'date',
|
||||
'datetime_prop' => 'date-time',
|
||||
'array_nullable_prop' => null,
|
||||
'array_and_items_nullable_prop' => null,
|
||||
'array_items_nullable' => null,
|
||||
'object_nullable_prop' => null,
|
||||
'object_and_items_nullable_prop' => null,
|
||||
'object_items_nullable' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'integer_prop' => true,
|
||||
'number_prop' => true,
|
||||
'boolean_prop' => true,
|
||||
'string_prop' => true,
|
||||
'date_prop' => true,
|
||||
'datetime_prop' => true,
|
||||
'array_nullable_prop' => true,
|
||||
'array_and_items_nullable_prop' => true,
|
||||
'array_items_nullable' => false,
|
||||
'object_nullable_prop' => true,
|
||||
'object_and_items_nullable_prop' => true,
|
||||
'object_items_nullable' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'integer_prop' => 'integer_prop',
|
||||
'number_prop' => 'number_prop',
|
||||
'boolean_prop' => 'boolean_prop',
|
||||
'string_prop' => 'string_prop',
|
||||
'date_prop' => 'date_prop',
|
||||
'datetime_prop' => 'datetime_prop',
|
||||
'array_nullable_prop' => 'array_nullable_prop',
|
||||
'array_and_items_nullable_prop' => 'array_and_items_nullable_prop',
|
||||
'array_items_nullable' => 'array_items_nullable',
|
||||
'object_nullable_prop' => 'object_nullable_prop',
|
||||
'object_and_items_nullable_prop' => 'object_and_items_nullable_prop',
|
||||
'object_items_nullable' => 'object_items_nullable'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'integer_prop' => 'setIntegerProp',
|
||||
'number_prop' => 'setNumberProp',
|
||||
'boolean_prop' => 'setBooleanProp',
|
||||
'string_prop' => 'setStringProp',
|
||||
'date_prop' => 'setDateProp',
|
||||
'datetime_prop' => 'setDatetimeProp',
|
||||
'array_nullable_prop' => 'setArrayNullableProp',
|
||||
'array_and_items_nullable_prop' => 'setArrayAndItemsNullableProp',
|
||||
'array_items_nullable' => 'setArrayItemsNullable',
|
||||
'object_nullable_prop' => 'setObjectNullableProp',
|
||||
'object_and_items_nullable_prop' => 'setObjectAndItemsNullableProp',
|
||||
'object_items_nullable' => 'setObjectItemsNullable'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'integer_prop' => 'getIntegerProp',
|
||||
'number_prop' => 'getNumberProp',
|
||||
'boolean_prop' => 'getBooleanProp',
|
||||
'string_prop' => 'getStringProp',
|
||||
'date_prop' => 'getDateProp',
|
||||
'datetime_prop' => 'getDatetimeProp',
|
||||
'array_nullable_prop' => 'getArrayNullableProp',
|
||||
'array_and_items_nullable_prop' => 'getArrayAndItemsNullableProp',
|
||||
'array_items_nullable' => 'getArrayItemsNullable',
|
||||
'object_nullable_prop' => 'getObjectNullableProp',
|
||||
'object_and_items_nullable_prop' => 'getObjectAndItemsNullableProp',
|
||||
'object_items_nullable' => 'getObjectItemsNullable'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('integer_prop', $data ?? [], null);
|
||||
$this->setIfExists('number_prop', $data ?? [], null);
|
||||
$this->setIfExists('boolean_prop', $data ?? [], null);
|
||||
$this->setIfExists('string_prop', $data ?? [], null);
|
||||
$this->setIfExists('date_prop', $data ?? [], null);
|
||||
$this->setIfExists('datetime_prop', $data ?? [], null);
|
||||
$this->setIfExists('array_nullable_prop', $data ?? [], null);
|
||||
$this->setIfExists('array_and_items_nullable_prop', $data ?? [], null);
|
||||
$this->setIfExists('array_items_nullable', $data ?? [], null);
|
||||
$this->setIfExists('object_nullable_prop', $data ?? [], null);
|
||||
$this->setIfExists('object_and_items_nullable_prop', $data ?? [], null);
|
||||
$this->setIfExists('object_items_nullable', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets integer_prop
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getIntegerProp()
|
||||
{
|
||||
return $this->container['integer_prop'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets integer_prop
|
||||
*
|
||||
* @param int|null $integer_prop integer_prop
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setIntegerProp($integer_prop)
|
||||
{
|
||||
if (is_null($integer_prop)) {
|
||||
array_push($this->openAPINullablesSetToNull, 'integer_prop');
|
||||
} else {
|
||||
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
|
||||
$index = array_search('integer_prop', $nullablesSetToNull);
|
||||
if ($index !== FALSE) {
|
||||
unset($nullablesSetToNull[$index]);
|
||||
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
|
||||
}
|
||||
}
|
||||
$this->container['integer_prop'] = $integer_prop;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets number_prop
|
||||
*
|
||||
* @return float|null
|
||||
*/
|
||||
public function getNumberProp()
|
||||
{
|
||||
return $this->container['number_prop'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets number_prop
|
||||
*
|
||||
* @param float|null $number_prop number_prop
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setNumberProp($number_prop)
|
||||
{
|
||||
if (is_null($number_prop)) {
|
||||
array_push($this->openAPINullablesSetToNull, 'number_prop');
|
||||
} else {
|
||||
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
|
||||
$index = array_search('number_prop', $nullablesSetToNull);
|
||||
if ($index !== FALSE) {
|
||||
unset($nullablesSetToNull[$index]);
|
||||
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
|
||||
}
|
||||
}
|
||||
$this->container['number_prop'] = $number_prop;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets boolean_prop
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
public function getBooleanProp()
|
||||
{
|
||||
return $this->container['boolean_prop'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets boolean_prop
|
||||
*
|
||||
* @param bool|null $boolean_prop boolean_prop
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setBooleanProp($boolean_prop)
|
||||
{
|
||||
if (is_null($boolean_prop)) {
|
||||
array_push($this->openAPINullablesSetToNull, 'boolean_prop');
|
||||
} else {
|
||||
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
|
||||
$index = array_search('boolean_prop', $nullablesSetToNull);
|
||||
if ($index !== FALSE) {
|
||||
unset($nullablesSetToNull[$index]);
|
||||
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
|
||||
}
|
||||
}
|
||||
$this->container['boolean_prop'] = $boolean_prop;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets string_prop
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getStringProp()
|
||||
{
|
||||
return $this->container['string_prop'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets string_prop
|
||||
*
|
||||
* @param string|null $string_prop string_prop
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setStringProp($string_prop)
|
||||
{
|
||||
if (is_null($string_prop)) {
|
||||
array_push($this->openAPINullablesSetToNull, 'string_prop');
|
||||
} else {
|
||||
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
|
||||
$index = array_search('string_prop', $nullablesSetToNull);
|
||||
if ($index !== FALSE) {
|
||||
unset($nullablesSetToNull[$index]);
|
||||
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
|
||||
}
|
||||
}
|
||||
$this->container['string_prop'] = $string_prop;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets date_prop
|
||||
*
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function getDateProp()
|
||||
{
|
||||
return $this->container['date_prop'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets date_prop
|
||||
*
|
||||
* @param \DateTime|null $date_prop date_prop
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setDateProp($date_prop)
|
||||
{
|
||||
if (is_null($date_prop)) {
|
||||
array_push($this->openAPINullablesSetToNull, 'date_prop');
|
||||
} else {
|
||||
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
|
||||
$index = array_search('date_prop', $nullablesSetToNull);
|
||||
if ($index !== FALSE) {
|
||||
unset($nullablesSetToNull[$index]);
|
||||
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
|
||||
}
|
||||
}
|
||||
$this->container['date_prop'] = $date_prop;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets datetime_prop
|
||||
*
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function getDatetimeProp()
|
||||
{
|
||||
return $this->container['datetime_prop'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets datetime_prop
|
||||
*
|
||||
* @param \DateTime|null $datetime_prop datetime_prop
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setDatetimeProp($datetime_prop)
|
||||
{
|
||||
if (is_null($datetime_prop)) {
|
||||
array_push($this->openAPINullablesSetToNull, 'datetime_prop');
|
||||
} else {
|
||||
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
|
||||
$index = array_search('datetime_prop', $nullablesSetToNull);
|
||||
if ($index !== FALSE) {
|
||||
unset($nullablesSetToNull[$index]);
|
||||
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
|
||||
}
|
||||
}
|
||||
$this->container['datetime_prop'] = $datetime_prop;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets array_nullable_prop
|
||||
*
|
||||
* @return object[]|null
|
||||
*/
|
||||
public function getArrayNullableProp()
|
||||
{
|
||||
return $this->container['array_nullable_prop'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets array_nullable_prop
|
||||
*
|
||||
* @param object[]|null $array_nullable_prop array_nullable_prop
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setArrayNullableProp($array_nullable_prop)
|
||||
{
|
||||
if (is_null($array_nullable_prop)) {
|
||||
array_push($this->openAPINullablesSetToNull, 'array_nullable_prop');
|
||||
} else {
|
||||
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
|
||||
$index = array_search('array_nullable_prop', $nullablesSetToNull);
|
||||
if ($index !== FALSE) {
|
||||
unset($nullablesSetToNull[$index]);
|
||||
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
|
||||
}
|
||||
}
|
||||
$this->container['array_nullable_prop'] = $array_nullable_prop;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets array_and_items_nullable_prop
|
||||
*
|
||||
* @return object[]|null
|
||||
*/
|
||||
public function getArrayAndItemsNullableProp()
|
||||
{
|
||||
return $this->container['array_and_items_nullable_prop'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets array_and_items_nullable_prop
|
||||
*
|
||||
* @param object[]|null $array_and_items_nullable_prop array_and_items_nullable_prop
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setArrayAndItemsNullableProp($array_and_items_nullable_prop)
|
||||
{
|
||||
if (is_null($array_and_items_nullable_prop)) {
|
||||
array_push($this->openAPINullablesSetToNull, 'array_and_items_nullable_prop');
|
||||
} else {
|
||||
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
|
||||
$index = array_search('array_and_items_nullable_prop', $nullablesSetToNull);
|
||||
if ($index !== FALSE) {
|
||||
unset($nullablesSetToNull[$index]);
|
||||
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
|
||||
}
|
||||
}
|
||||
$this->container['array_and_items_nullable_prop'] = $array_and_items_nullable_prop;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets array_items_nullable
|
||||
*
|
||||
* @return object[]|null
|
||||
*/
|
||||
public function getArrayItemsNullable()
|
||||
{
|
||||
return $this->container['array_items_nullable'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets array_items_nullable
|
||||
*
|
||||
* @param object[]|null $array_items_nullable array_items_nullable
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setArrayItemsNullable($array_items_nullable)
|
||||
{
|
||||
if (is_null($array_items_nullable)) {
|
||||
throw new \InvalidArgumentException('non-nullable array_items_nullable cannot be null');
|
||||
}
|
||||
$this->container['array_items_nullable'] = $array_items_nullable;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets object_nullable_prop
|
||||
*
|
||||
* @return array<string,object>|null
|
||||
*/
|
||||
public function getObjectNullableProp()
|
||||
{
|
||||
return $this->container['object_nullable_prop'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets object_nullable_prop
|
||||
*
|
||||
* @param array<string,object>|null $object_nullable_prop object_nullable_prop
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setObjectNullableProp($object_nullable_prop)
|
||||
{
|
||||
if (is_null($object_nullable_prop)) {
|
||||
array_push($this->openAPINullablesSetToNull, 'object_nullable_prop');
|
||||
} else {
|
||||
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
|
||||
$index = array_search('object_nullable_prop', $nullablesSetToNull);
|
||||
if ($index !== FALSE) {
|
||||
unset($nullablesSetToNull[$index]);
|
||||
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
|
||||
}
|
||||
}
|
||||
$this->container['object_nullable_prop'] = $object_nullable_prop;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets object_and_items_nullable_prop
|
||||
*
|
||||
* @return array<string,object>|null
|
||||
*/
|
||||
public function getObjectAndItemsNullableProp()
|
||||
{
|
||||
return $this->container['object_and_items_nullable_prop'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets object_and_items_nullable_prop
|
||||
*
|
||||
* @param array<string,object>|null $object_and_items_nullable_prop object_and_items_nullable_prop
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setObjectAndItemsNullableProp($object_and_items_nullable_prop)
|
||||
{
|
||||
if (is_null($object_and_items_nullable_prop)) {
|
||||
array_push($this->openAPINullablesSetToNull, 'object_and_items_nullable_prop');
|
||||
} else {
|
||||
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
|
||||
$index = array_search('object_and_items_nullable_prop', $nullablesSetToNull);
|
||||
if ($index !== FALSE) {
|
||||
unset($nullablesSetToNull[$index]);
|
||||
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
|
||||
}
|
||||
}
|
||||
$this->container['object_and_items_nullable_prop'] = $object_and_items_nullable_prop;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets object_items_nullable
|
||||
*
|
||||
* @return array<string,object>|null
|
||||
*/
|
||||
public function getObjectItemsNullable()
|
||||
{
|
||||
return $this->container['object_items_nullable'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets object_items_nullable
|
||||
*
|
||||
* @param array<string,object>|null $object_items_nullable object_items_nullable
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setObjectItemsNullable($object_items_nullable)
|
||||
{
|
||||
if (is_null($object_items_nullable)) {
|
||||
throw new \InvalidArgumentException('non-nullable object_items_nullable cannot be null');
|
||||
}
|
||||
$this->container['object_items_nullable'] = $object_items_nullable;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,409 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NumberOnly
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* NumberOnly Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'NumberOnly';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'just_number' => 'float'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'just_number' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'just_number' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'just_number' => 'JustNumber'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'just_number' => 'setJustNumber'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'just_number' => 'getJustNumber'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('just_number', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets just_number
|
||||
*
|
||||
* @return float|null
|
||||
*/
|
||||
public function getJustNumber()
|
||||
{
|
||||
return $this->container['just_number'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets just_number
|
||||
*
|
||||
* @param float|null $just_number just_number
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setJustNumber($just_number)
|
||||
{
|
||||
if (is_null($just_number)) {
|
||||
throw new \InvalidArgumentException('non-nullable just_number cannot be null');
|
||||
}
|
||||
$this->container['just_number'] = $just_number;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,517 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ObjectWithDeprecatedFields
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* ObjectWithDeprecatedFields Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'ObjectWithDeprecatedFields';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'uuid' => 'string',
|
||||
'id' => 'float',
|
||||
'deprecated_ref' => '\OpenAPI\Client\Model\DeprecatedObject',
|
||||
'bars' => 'string[]'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'uuid' => null,
|
||||
'id' => null,
|
||||
'deprecated_ref' => null,
|
||||
'bars' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'uuid' => false,
|
||||
'id' => false,
|
||||
'deprecated_ref' => false,
|
||||
'bars' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'uuid' => 'uuid',
|
||||
'id' => 'id',
|
||||
'deprecated_ref' => 'deprecatedRef',
|
||||
'bars' => 'bars'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'uuid' => 'setUuid',
|
||||
'id' => 'setId',
|
||||
'deprecated_ref' => 'setDeprecatedRef',
|
||||
'bars' => 'setBars'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'uuid' => 'getUuid',
|
||||
'id' => 'getId',
|
||||
'deprecated_ref' => 'getDeprecatedRef',
|
||||
'bars' => 'getBars'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('uuid', $data ?? [], null);
|
||||
$this->setIfExists('id', $data ?? [], null);
|
||||
$this->setIfExists('deprecated_ref', $data ?? [], null);
|
||||
$this->setIfExists('bars', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets uuid
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getUuid()
|
||||
{
|
||||
return $this->container['uuid'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets uuid
|
||||
*
|
||||
* @param string|null $uuid uuid
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setUuid($uuid)
|
||||
{
|
||||
if (is_null($uuid)) {
|
||||
throw new \InvalidArgumentException('non-nullable uuid cannot be null');
|
||||
}
|
||||
$this->container['uuid'] = $uuid;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets id
|
||||
*
|
||||
* @return float|null
|
||||
* @deprecated
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->container['id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets id
|
||||
*
|
||||
* @param float|null $id id
|
||||
*
|
||||
* @return self
|
||||
* @deprecated
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
if (is_null($id)) {
|
||||
throw new \InvalidArgumentException('non-nullable id cannot be null');
|
||||
}
|
||||
$this->container['id'] = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets deprecated_ref
|
||||
*
|
||||
* @return \OpenAPI\Client\Model\DeprecatedObject|null
|
||||
* @deprecated
|
||||
*/
|
||||
public function getDeprecatedRef()
|
||||
{
|
||||
return $this->container['deprecated_ref'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets deprecated_ref
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\DeprecatedObject|null $deprecated_ref deprecated_ref
|
||||
*
|
||||
* @return self
|
||||
* @deprecated
|
||||
*/
|
||||
public function setDeprecatedRef($deprecated_ref)
|
||||
{
|
||||
if (is_null($deprecated_ref)) {
|
||||
throw new \InvalidArgumentException('non-nullable deprecated_ref cannot be null');
|
||||
}
|
||||
$this->container['deprecated_ref'] = $deprecated_ref;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets bars
|
||||
*
|
||||
* @return string[]|null
|
||||
* @deprecated
|
||||
*/
|
||||
public function getBars()
|
||||
{
|
||||
return $this->container['bars'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets bars
|
||||
*
|
||||
* @param string[]|null $bars bars
|
||||
*
|
||||
* @return self
|
||||
* @deprecated
|
||||
*/
|
||||
public function setBars($bars)
|
||||
{
|
||||
if (is_null($bars)) {
|
||||
throw new \InvalidArgumentException('non-nullable bars cannot be null');
|
||||
}
|
||||
$this->container['bars'] = $bars;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,615 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Order
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* Order Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class Order implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'Order';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'id' => 'int',
|
||||
'pet_id' => 'int',
|
||||
'quantity' => 'int',
|
||||
'ship_date' => '\DateTime',
|
||||
'status' => 'string',
|
||||
'complete' => 'bool'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'id' => 'int64',
|
||||
'pet_id' => 'int64',
|
||||
'quantity' => 'int32',
|
||||
'ship_date' => 'date-time',
|
||||
'status' => null,
|
||||
'complete' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'id' => false,
|
||||
'pet_id' => false,
|
||||
'quantity' => false,
|
||||
'ship_date' => false,
|
||||
'status' => false,
|
||||
'complete' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'id' => 'id',
|
||||
'pet_id' => 'petId',
|
||||
'quantity' => 'quantity',
|
||||
'ship_date' => 'shipDate',
|
||||
'status' => 'status',
|
||||
'complete' => 'complete'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'id' => 'setId',
|
||||
'pet_id' => 'setPetId',
|
||||
'quantity' => 'setQuantity',
|
||||
'ship_date' => 'setShipDate',
|
||||
'status' => 'setStatus',
|
||||
'complete' => 'setComplete'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'id' => 'getId',
|
||||
'pet_id' => 'getPetId',
|
||||
'quantity' => 'getQuantity',
|
||||
'ship_date' => 'getShipDate',
|
||||
'status' => 'getStatus',
|
||||
'complete' => 'getComplete'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
public const STATUS_PLACED = 'placed';
|
||||
public const STATUS_APPROVED = 'approved';
|
||||
public const STATUS_DELIVERED = 'delivered';
|
||||
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getStatusAllowableValues()
|
||||
{
|
||||
return [
|
||||
self::STATUS_PLACED,
|
||||
self::STATUS_APPROVED,
|
||||
self::STATUS_DELIVERED,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('id', $data ?? [], null);
|
||||
$this->setIfExists('pet_id', $data ?? [], null);
|
||||
$this->setIfExists('quantity', $data ?? [], null);
|
||||
$this->setIfExists('ship_date', $data ?? [], null);
|
||||
$this->setIfExists('status', $data ?? [], null);
|
||||
$this->setIfExists('complete', $data ?? [], false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
$allowedValues = $this->getStatusAllowableValues();
|
||||
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
|
||||
$invalidProperties[] = sprintf(
|
||||
"invalid value '%s' for 'status', must be one of '%s'",
|
||||
$this->container['status'],
|
||||
implode("', '", $allowedValues)
|
||||
);
|
||||
}
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets id
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->container['id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets id
|
||||
*
|
||||
* @param int|null $id id
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
if (is_null($id)) {
|
||||
throw new \InvalidArgumentException('non-nullable id cannot be null');
|
||||
}
|
||||
$this->container['id'] = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets pet_id
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getPetId()
|
||||
{
|
||||
return $this->container['pet_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets pet_id
|
||||
*
|
||||
* @param int|null $pet_id pet_id
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setPetId($pet_id)
|
||||
{
|
||||
if (is_null($pet_id)) {
|
||||
throw new \InvalidArgumentException('non-nullable pet_id cannot be null');
|
||||
}
|
||||
$this->container['pet_id'] = $pet_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets quantity
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getQuantity()
|
||||
{
|
||||
return $this->container['quantity'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets quantity
|
||||
*
|
||||
* @param int|null $quantity quantity
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setQuantity($quantity)
|
||||
{
|
||||
if (is_null($quantity)) {
|
||||
throw new \InvalidArgumentException('non-nullable quantity cannot be null');
|
||||
}
|
||||
$this->container['quantity'] = $quantity;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets ship_date
|
||||
*
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function getShipDate()
|
||||
{
|
||||
return $this->container['ship_date'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets ship_date
|
||||
*
|
||||
* @param \DateTime|null $ship_date ship_date
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setShipDate($ship_date)
|
||||
{
|
||||
if (is_null($ship_date)) {
|
||||
throw new \InvalidArgumentException('non-nullable ship_date cannot be null');
|
||||
}
|
||||
$this->container['ship_date'] = $ship_date;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets status
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->container['status'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets status
|
||||
*
|
||||
* @param string|null $status Order Status
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setStatus($status)
|
||||
{
|
||||
if (is_null($status)) {
|
||||
throw new \InvalidArgumentException('non-nullable status cannot be null');
|
||||
}
|
||||
$allowedValues = $this->getStatusAllowableValues();
|
||||
if (!in_array($status, $allowedValues, true)) {
|
||||
throw new \InvalidArgumentException(
|
||||
sprintf(
|
||||
"Invalid value '%s' for 'status', must be one of '%s'",
|
||||
$status,
|
||||
implode("', '", $allowedValues)
|
||||
)
|
||||
);
|
||||
}
|
||||
$this->container['status'] = $status;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets complete
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
public function getComplete()
|
||||
{
|
||||
return $this->container['complete'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets complete
|
||||
*
|
||||
* @param bool|null $complete complete
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setComplete($complete)
|
||||
{
|
||||
if (is_null($complete)) {
|
||||
throw new \InvalidArgumentException('non-nullable complete cannot be null');
|
||||
}
|
||||
$this->container['complete'] = $complete;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,477 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* OuterComposite
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* OuterComposite Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'OuterComposite';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'my_number' => 'float',
|
||||
'my_string' => 'string',
|
||||
'my_boolean' => 'bool'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'my_number' => null,
|
||||
'my_string' => null,
|
||||
'my_boolean' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'my_number' => false,
|
||||
'my_string' => false,
|
||||
'my_boolean' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'my_number' => 'my_number',
|
||||
'my_string' => 'my_string',
|
||||
'my_boolean' => 'my_boolean'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'my_number' => 'setMyNumber',
|
||||
'my_string' => 'setMyString',
|
||||
'my_boolean' => 'setMyBoolean'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'my_number' => 'getMyNumber',
|
||||
'my_string' => 'getMyString',
|
||||
'my_boolean' => 'getMyBoolean'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('my_number', $data ?? [], null);
|
||||
$this->setIfExists('my_string', $data ?? [], null);
|
||||
$this->setIfExists('my_boolean', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets my_number
|
||||
*
|
||||
* @return float|null
|
||||
*/
|
||||
public function getMyNumber()
|
||||
{
|
||||
return $this->container['my_number'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets my_number
|
||||
*
|
||||
* @param float|null $my_number my_number
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setMyNumber($my_number)
|
||||
{
|
||||
if (is_null($my_number)) {
|
||||
throw new \InvalidArgumentException('non-nullable my_number cannot be null');
|
||||
}
|
||||
$this->container['my_number'] = $my_number;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets my_string
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMyString()
|
||||
{
|
||||
return $this->container['my_string'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets my_string
|
||||
*
|
||||
* @param string|null $my_string my_string
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setMyString($my_string)
|
||||
{
|
||||
if (is_null($my_string)) {
|
||||
throw new \InvalidArgumentException('non-nullable my_string cannot be null');
|
||||
}
|
||||
$this->container['my_string'] = $my_string;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets my_boolean
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
public function getMyBoolean()
|
||||
{
|
||||
return $this->container['my_boolean'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets my_boolean
|
||||
*
|
||||
* @param bool|null $my_boolean my_boolean
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setMyBoolean($my_boolean)
|
||||
{
|
||||
if (is_null($my_boolean)) {
|
||||
throw new \InvalidArgumentException('non-nullable my_boolean cannot be null');
|
||||
}
|
||||
$this->container['my_boolean'] = $my_boolean;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* OuterEnum
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* OuterEnum Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class OuterEnum
|
||||
{
|
||||
/**
|
||||
* Possible values of this enum
|
||||
*/
|
||||
public const PLACED = 'placed';
|
||||
|
||||
public const APPROVED = 'approved';
|
||||
|
||||
public const DELIVERED = 'delivered';
|
||||
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getAllowableEnumValues()
|
||||
{
|
||||
return [
|
||||
self::PLACED,
|
||||
self::APPROVED,
|
||||
self::DELIVERED
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* OuterEnumDefaultValue
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* OuterEnumDefaultValue Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class OuterEnumDefaultValue
|
||||
{
|
||||
/**
|
||||
* Possible values of this enum
|
||||
*/
|
||||
public const PLACED = 'placed';
|
||||
|
||||
public const APPROVED = 'approved';
|
||||
|
||||
public const DELIVERED = 'delivered';
|
||||
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getAllowableEnumValues()
|
||||
{
|
||||
return [
|
||||
self::PLACED,
|
||||
self::APPROVED,
|
||||
self::DELIVERED
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* OuterEnumInteger
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* OuterEnumInteger Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class OuterEnumInteger
|
||||
{
|
||||
/**
|
||||
* Possible values of this enum
|
||||
*/
|
||||
public const NUMBER_0 = 0;
|
||||
|
||||
public const NUMBER_1 = 1;
|
||||
|
||||
public const NUMBER_2 = 2;
|
||||
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getAllowableEnumValues()
|
||||
{
|
||||
return [
|
||||
self::NUMBER_0,
|
||||
self::NUMBER_1,
|
||||
self::NUMBER_2
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* OuterEnumIntegerDefaultValue
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* OuterEnumIntegerDefaultValue Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class OuterEnumIntegerDefaultValue
|
||||
{
|
||||
/**
|
||||
* Possible values of this enum
|
||||
*/
|
||||
public const NUMBER_0 = 0;
|
||||
|
||||
public const NUMBER_1 = 1;
|
||||
|
||||
public const NUMBER_2 = 2;
|
||||
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getAllowableEnumValues()
|
||||
{
|
||||
return [
|
||||
self::NUMBER_0,
|
||||
self::NUMBER_1,
|
||||
self::NUMBER_2
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,412 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* OuterObjectWithEnumProperty
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* OuterObjectWithEnumProperty Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'OuterObjectWithEnumProperty';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'value' => '\OpenAPI\Client\Model\OuterEnumInteger'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'value' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'value' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'value' => 'value'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'value' => 'setValue'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'value' => 'getValue'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('value', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
if ($this->container['value'] === null) {
|
||||
$invalidProperties[] = "'value' can't be null";
|
||||
}
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets value
|
||||
*
|
||||
* @return \OpenAPI\Client\Model\OuterEnumInteger
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->container['value'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\OuterEnumInteger $value value
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
if (is_null($value)) {
|
||||
throw new \InvalidArgumentException('non-nullable value cannot be null');
|
||||
}
|
||||
$this->container['value'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,623 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Pet
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* Pet Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'Pet';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'id' => 'int',
|
||||
'category' => '\OpenAPI\Client\Model\Category',
|
||||
'name' => 'string',
|
||||
'photo_urls' => 'string[]',
|
||||
'tags' => '\OpenAPI\Client\Model\Tag[]',
|
||||
'status' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'id' => 'int64',
|
||||
'category' => null,
|
||||
'name' => null,
|
||||
'photo_urls' => null,
|
||||
'tags' => null,
|
||||
'status' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'id' => false,
|
||||
'category' => false,
|
||||
'name' => false,
|
||||
'photo_urls' => false,
|
||||
'tags' => false,
|
||||
'status' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'id' => 'id',
|
||||
'category' => 'category',
|
||||
'name' => 'name',
|
||||
'photo_urls' => 'photoUrls',
|
||||
'tags' => 'tags',
|
||||
'status' => 'status'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'id' => 'setId',
|
||||
'category' => 'setCategory',
|
||||
'name' => 'setName',
|
||||
'photo_urls' => 'setPhotoUrls',
|
||||
'tags' => 'setTags',
|
||||
'status' => 'setStatus'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'id' => 'getId',
|
||||
'category' => 'getCategory',
|
||||
'name' => 'getName',
|
||||
'photo_urls' => 'getPhotoUrls',
|
||||
'tags' => 'getTags',
|
||||
'status' => 'getStatus'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
public const STATUS_AVAILABLE = 'available';
|
||||
public const STATUS_PENDING = 'pending';
|
||||
public const STATUS_SOLD = 'sold';
|
||||
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getStatusAllowableValues()
|
||||
{
|
||||
return [
|
||||
self::STATUS_AVAILABLE,
|
||||
self::STATUS_PENDING,
|
||||
self::STATUS_SOLD,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('id', $data ?? [], null);
|
||||
$this->setIfExists('category', $data ?? [], null);
|
||||
$this->setIfExists('name', $data ?? [], null);
|
||||
$this->setIfExists('photo_urls', $data ?? [], null);
|
||||
$this->setIfExists('tags', $data ?? [], null);
|
||||
$this->setIfExists('status', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
if ($this->container['name'] === null) {
|
||||
$invalidProperties[] = "'name' can't be null";
|
||||
}
|
||||
if ($this->container['photo_urls'] === null) {
|
||||
$invalidProperties[] = "'photo_urls' can't be null";
|
||||
}
|
||||
$allowedValues = $this->getStatusAllowableValues();
|
||||
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
|
||||
$invalidProperties[] = sprintf(
|
||||
"invalid value '%s' for 'status', must be one of '%s'",
|
||||
$this->container['status'],
|
||||
implode("', '", $allowedValues)
|
||||
);
|
||||
}
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets id
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->container['id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets id
|
||||
*
|
||||
* @param int|null $id id
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
if (is_null($id)) {
|
||||
throw new \InvalidArgumentException('non-nullable id cannot be null');
|
||||
}
|
||||
$this->container['id'] = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets category
|
||||
*
|
||||
* @return \OpenAPI\Client\Model\Category|null
|
||||
*/
|
||||
public function getCategory()
|
||||
{
|
||||
return $this->container['category'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets category
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\Category|null $category category
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setCategory($category)
|
||||
{
|
||||
if (is_null($category)) {
|
||||
throw new \InvalidArgumentException('non-nullable category cannot be null');
|
||||
}
|
||||
$this->container['category'] = $category;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->container['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets name
|
||||
*
|
||||
* @param string $name name
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
if (is_null($name)) {
|
||||
throw new \InvalidArgumentException('non-nullable name cannot be null');
|
||||
}
|
||||
$this->container['name'] = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets photo_urls
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getPhotoUrls()
|
||||
{
|
||||
return $this->container['photo_urls'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets photo_urls
|
||||
*
|
||||
* @param string[] $photo_urls photo_urls
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setPhotoUrls($photo_urls)
|
||||
{
|
||||
if (is_null($photo_urls)) {
|
||||
throw new \InvalidArgumentException('non-nullable photo_urls cannot be null');
|
||||
}
|
||||
|
||||
|
||||
$this->container['photo_urls'] = $photo_urls;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets tags
|
||||
*
|
||||
* @return \OpenAPI\Client\Model\Tag[]|null
|
||||
*/
|
||||
public function getTags()
|
||||
{
|
||||
return $this->container['tags'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets tags
|
||||
*
|
||||
* @param \OpenAPI\Client\Model\Tag[]|null $tags tags
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setTags($tags)
|
||||
{
|
||||
if (is_null($tags)) {
|
||||
throw new \InvalidArgumentException('non-nullable tags cannot be null');
|
||||
}
|
||||
$this->container['tags'] = $tags;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets status
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->container['status'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets status
|
||||
*
|
||||
* @param string|null $status pet status in the store
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setStatus($status)
|
||||
{
|
||||
if (is_null($status)) {
|
||||
throw new \InvalidArgumentException('non-nullable status cannot be null');
|
||||
}
|
||||
$allowedValues = $this->getStatusAllowableValues();
|
||||
if (!in_array($status, $allowedValues, true)) {
|
||||
throw new \InvalidArgumentException(
|
||||
sprintf(
|
||||
"Invalid value '%s' for 'status', must be one of '%s'",
|
||||
$status,
|
||||
implode("', '", $allowedValues)
|
||||
)
|
||||
);
|
||||
}
|
||||
$this->container['status'] = $status;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,443 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ReadOnlyFirst
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* ReadOnlyFirst Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'ReadOnlyFirst';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'bar' => 'string',
|
||||
'baz' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'bar' => null,
|
||||
'baz' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'bar' => false,
|
||||
'baz' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'bar' => 'bar',
|
||||
'baz' => 'baz'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'bar' => 'setBar',
|
||||
'baz' => 'setBaz'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'bar' => 'getBar',
|
||||
'baz' => 'getBaz'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('bar', $data ?? [], null);
|
||||
$this->setIfExists('baz', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets bar
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getBar()
|
||||
{
|
||||
return $this->container['bar'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets bar
|
||||
*
|
||||
* @param string|null $bar bar
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setBar($bar)
|
||||
{
|
||||
if (is_null($bar)) {
|
||||
throw new \InvalidArgumentException('non-nullable bar cannot be null');
|
||||
}
|
||||
$this->container['bar'] = $bar;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets baz
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getBaz()
|
||||
{
|
||||
return $this->container['baz'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets baz
|
||||
*
|
||||
* @param string|null $baz baz
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setBaz($baz)
|
||||
{
|
||||
if (is_null($baz)) {
|
||||
throw new \InvalidArgumentException('non-nullable baz cannot be null');
|
||||
}
|
||||
$this->container['baz'] = $baz;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,62 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* SingleRefType
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* SingleRefType Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class SingleRefType
|
||||
{
|
||||
/**
|
||||
* Possible values of this enum
|
||||
*/
|
||||
public const ADMIN = 'admin';
|
||||
|
||||
public const USER = 'user';
|
||||
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getAllowableEnumValues()
|
||||
{
|
||||
return [
|
||||
self::ADMIN,
|
||||
self::USER
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,409 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* SpecialModelName
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* SpecialModelName Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = '_special_model.name_';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'special_property_name' => 'int'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'special_property_name' => 'int64'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'special_property_name' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'special_property_name' => '$special[property.name]'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'special_property_name' => 'setSpecialPropertyName'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'special_property_name' => 'getSpecialPropertyName'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('special_property_name', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets special_property_name
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getSpecialPropertyName()
|
||||
{
|
||||
return $this->container['special_property_name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets special_property_name
|
||||
*
|
||||
* @param int|null $special_property_name special_property_name
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setSpecialPropertyName($special_property_name)
|
||||
{
|
||||
if (is_null($special_property_name)) {
|
||||
throw new \InvalidArgumentException('non-nullable special_property_name cannot be null');
|
||||
}
|
||||
$this->container['special_property_name'] = $special_property_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,443 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Tag
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* Tag Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'Tag';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'id' => 'int',
|
||||
'name' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'id' => 'int64',
|
||||
'name' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'id' => false,
|
||||
'name' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'id' => 'setId',
|
||||
'name' => 'setName'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'id' => 'getId',
|
||||
'name' => 'getName'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('id', $data ?? [], null);
|
||||
$this->setIfExists('name', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets id
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->container['id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets id
|
||||
*
|
||||
* @param int|null $id id
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
if (is_null($id)) {
|
||||
throw new \InvalidArgumentException('non-nullable id cannot be null');
|
||||
}
|
||||
$this->container['id'] = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets name
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->container['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets name
|
||||
*
|
||||
* @param string|null $name name
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
if (is_null($name)) {
|
||||
throw new \InvalidArgumentException('non-nullable name cannot be null');
|
||||
}
|
||||
$this->container['name'] = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,647 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* User
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* User Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class User implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'User';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'id' => 'int',
|
||||
'username' => 'string',
|
||||
'first_name' => 'string',
|
||||
'last_name' => 'string',
|
||||
'email' => 'string',
|
||||
'password' => 'string',
|
||||
'phone' => 'string',
|
||||
'user_status' => 'int'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'id' => 'int64',
|
||||
'username' => null,
|
||||
'first_name' => null,
|
||||
'last_name' => null,
|
||||
'email' => null,
|
||||
'password' => null,
|
||||
'phone' => null,
|
||||
'user_status' => 'int32'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'id' => false,
|
||||
'username' => false,
|
||||
'first_name' => false,
|
||||
'last_name' => false,
|
||||
'email' => false,
|
||||
'password' => false,
|
||||
'phone' => false,
|
||||
'user_status' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'id' => 'id',
|
||||
'username' => 'username',
|
||||
'first_name' => 'firstName',
|
||||
'last_name' => 'lastName',
|
||||
'email' => 'email',
|
||||
'password' => 'password',
|
||||
'phone' => 'phone',
|
||||
'user_status' => 'userStatus'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'id' => 'setId',
|
||||
'username' => 'setUsername',
|
||||
'first_name' => 'setFirstName',
|
||||
'last_name' => 'setLastName',
|
||||
'email' => 'setEmail',
|
||||
'password' => 'setPassword',
|
||||
'phone' => 'setPhone',
|
||||
'user_status' => 'setUserStatus'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'id' => 'getId',
|
||||
'username' => 'getUsername',
|
||||
'first_name' => 'getFirstName',
|
||||
'last_name' => 'getLastName',
|
||||
'email' => 'getEmail',
|
||||
'password' => 'getPassword',
|
||||
'phone' => 'getPhone',
|
||||
'user_status' => 'getUserStatus'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('id', $data ?? [], null);
|
||||
$this->setIfExists('username', $data ?? [], null);
|
||||
$this->setIfExists('first_name', $data ?? [], null);
|
||||
$this->setIfExists('last_name', $data ?? [], null);
|
||||
$this->setIfExists('email', $data ?? [], null);
|
||||
$this->setIfExists('password', $data ?? [], null);
|
||||
$this->setIfExists('phone', $data ?? [], null);
|
||||
$this->setIfExists('user_status', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets id
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->container['id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets id
|
||||
*
|
||||
* @param int|null $id id
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
if (is_null($id)) {
|
||||
throw new \InvalidArgumentException('non-nullable id cannot be null');
|
||||
}
|
||||
$this->container['id'] = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets username
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return $this->container['username'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets username
|
||||
*
|
||||
* @param string|null $username username
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setUsername($username)
|
||||
{
|
||||
if (is_null($username)) {
|
||||
throw new \InvalidArgumentException('non-nullable username cannot be null');
|
||||
}
|
||||
$this->container['username'] = $username;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets first_name
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFirstName()
|
||||
{
|
||||
return $this->container['first_name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets first_name
|
||||
*
|
||||
* @param string|null $first_name first_name
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setFirstName($first_name)
|
||||
{
|
||||
if (is_null($first_name)) {
|
||||
throw new \InvalidArgumentException('non-nullable first_name cannot be null');
|
||||
}
|
||||
$this->container['first_name'] = $first_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets last_name
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getLastName()
|
||||
{
|
||||
return $this->container['last_name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets last_name
|
||||
*
|
||||
* @param string|null $last_name last_name
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setLastName($last_name)
|
||||
{
|
||||
if (is_null($last_name)) {
|
||||
throw new \InvalidArgumentException('non-nullable last_name cannot be null');
|
||||
}
|
||||
$this->container['last_name'] = $last_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets email
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->container['email'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets email
|
||||
*
|
||||
* @param string|null $email email
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setEmail($email)
|
||||
{
|
||||
if (is_null($email)) {
|
||||
throw new \InvalidArgumentException('non-nullable email cannot be null');
|
||||
}
|
||||
$this->container['email'] = $email;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets password
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->container['password'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets password
|
||||
*
|
||||
* @param string|null $password password
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
if (is_null($password)) {
|
||||
throw new \InvalidArgumentException('non-nullable password cannot be null');
|
||||
}
|
||||
$this->container['password'] = $password;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets phone
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPhone()
|
||||
{
|
||||
return $this->container['phone'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets phone
|
||||
*
|
||||
* @param string|null $phone phone
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setPhone($phone)
|
||||
{
|
||||
if (is_null($phone)) {
|
||||
throw new \InvalidArgumentException('non-nullable phone cannot be null');
|
||||
}
|
||||
$this->container['phone'] = $phone;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets user_status
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getUserStatus()
|
||||
{
|
||||
return $this->container['user_status'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets user_status
|
||||
*
|
||||
* @param int|null $user_status User Status
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setUserStatus($user_status)
|
||||
{
|
||||
if (is_null($user_status)) {
|
||||
throw new \InvalidArgumentException('non-nullable user_status cannot be null');
|
||||
}
|
||||
$this->container['user_status'] = $user_status;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,616 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ObjectSerializer
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use GuzzleHttp\Psr7\Utils;
|
||||
use OpenAPI\Client\Model\ModelInterface;
|
||||
use function GuzzleHttp\Psr7\;
|
||||
use function is_array;
|
||||
use function is_bool;
|
||||
use function substr;
|
||||
use const PHP_QUERY_RFC1738;
|
||||
use const PHP_QUERY_RFC3986;
|
||||
|
||||
/**
|
||||
* ObjectSerializer Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class ObjectSerializer
|
||||
{
|
||||
/** @var string */
|
||||
private static $dateTimeFormat = \DateTime::ATOM;
|
||||
|
||||
/**
|
||||
* Change the date format
|
||||
*
|
||||
* @param string $format the new date format to use
|
||||
*/
|
||||
public static function setDateTimeFormat($format)
|
||||
{
|
||||
self::$dateTimeFormat = $format;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize data
|
||||
*
|
||||
* @param mixed $data the data to serialize
|
||||
* @param string $type the OpenAPIToolsType of the data
|
||||
* @param string $format the format of the OpenAPITools type of the data
|
||||
*
|
||||
* @return scalar|object|array|null serialized form of $data
|
||||
*/
|
||||
public static function sanitizeForSerialization($data, $type = null, $format = null)
|
||||
{
|
||||
if (is_scalar($data) || null === $data) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
if ($data instanceof \DateTime) {
|
||||
return ($format === 'date') ? $data->format('Y-m-d') : $data->format(self::$dateTimeFormat);
|
||||
}
|
||||
|
||||
if (is_array($data)) {
|
||||
foreach ($data as $property => $value) {
|
||||
$data[$property] = self::sanitizeForSerialization($value);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
if (is_object($data)) {
|
||||
$values = [];
|
||||
if ($data instanceof ModelInterface) {
|
||||
$formats = $data::openAPIFormats();
|
||||
foreach ($data::openAPITypes() as $property => $openAPIType) {
|
||||
$getter = $data::getters()[$property];
|
||||
$value = $data->$getter();
|
||||
if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) {
|
||||
$callable = [$openAPIType, 'getAllowableEnumValues'];
|
||||
if (is_callable($callable)) {
|
||||
/** array $callable */
|
||||
$allowedEnumTypes = $callable();
|
||||
if (!in_array($value, $allowedEnumTypes, true)) {
|
||||
$imploded = implode("', '", $allowedEnumTypes);
|
||||
throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) {
|
||||
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach($data as $property => $value) {
|
||||
$values[$property] = self::sanitizeForSerialization($value);
|
||||
}
|
||||
}
|
||||
return (object)$values;
|
||||
} else {
|
||||
return (string)$data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize filename by removing path.
|
||||
* e.g. ../../sun.gif becomes sun.gif
|
||||
*
|
||||
* @param string $filename filename to be sanitized
|
||||
*
|
||||
* @return string the sanitized filename
|
||||
*/
|
||||
public static function sanitizeFilename($filename)
|
||||
{
|
||||
if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) {
|
||||
return $match[1];
|
||||
} else {
|
||||
return $filename;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shorter timestamp microseconds to 6 digits length.
|
||||
*
|
||||
* @param string $timestamp Original timestamp
|
||||
*
|
||||
* @return string the shorten timestamp
|
||||
*/
|
||||
public static function sanitizeTimestamp($timestamp)
|
||||
{
|
||||
if (!is_string($timestamp)) return $timestamp;
|
||||
|
||||
return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Take value and turn it into a string suitable for inclusion in
|
||||
* the path, by url-encoding.
|
||||
*
|
||||
* @param string $value a string which will be part of the path
|
||||
*
|
||||
* @return string the serialized object
|
||||
*/
|
||||
public static function toPathValue($value)
|
||||
{
|
||||
return rawurlencode(self::toString($value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a value is empty, based on its OpenAPI type.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param string $openApiType
|
||||
*
|
||||
* @return bool true if $value is empty
|
||||
*/
|
||||
private static function isEmptyValue($value, string $openApiType): bool
|
||||
{
|
||||
# If empty() returns false, it is not empty regardless of its type.
|
||||
if (!empty($value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
# Null is always empty, as we cannot send a real "null" value in a query parameter.
|
||||
if ($value === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch ($openApiType) {
|
||||
# For numeric values, false and '' are considered empty.
|
||||
# This comparison is safe for floating point values, since the previous call to empty() will
|
||||
# filter out values that don't match 0.
|
||||
case 'int':
|
||||
case 'integer':
|
||||
return $value !== 0;
|
||||
|
||||
case 'number':
|
||||
case 'float':
|
||||
return $value !== 0 && $value !== 0.0;
|
||||
|
||||
# For boolean values, '' is considered empty
|
||||
case 'bool':
|
||||
case 'boolean':
|
||||
return !in_array($value, [false, 0], true);
|
||||
|
||||
# For all the other types, any value at this point can be considered empty.
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Take query parameter properties and turn it into an array suitable for
|
||||
* native http_build_query or GuzzleHttp\Psr7\Query::build.
|
||||
*
|
||||
* @param mixed $value Parameter value
|
||||
* @param string $paramName Parameter name
|
||||
* @param string $openApiType OpenAPIType eg. array or object
|
||||
* @param string $style Parameter serialization style
|
||||
* @param bool $explode Parameter explode option
|
||||
* @param bool $required Whether query param is required or not
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function toQueryValue(
|
||||
$value,
|
||||
string $paramName,
|
||||
string $openApiType = 'string',
|
||||
string $style = 'form',
|
||||
bool $explode = true,
|
||||
bool $required = true
|
||||
): array {
|
||||
|
||||
# Check if we should omit this parameter from the query. This should only happen when:
|
||||
# - Parameter is NOT required; AND
|
||||
# - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For
|
||||
# example, 0 as "int" or "boolean" is NOT an empty value.
|
||||
if (self::isEmptyValue($value, $openApiType)) {
|
||||
if ($required) {
|
||||
return ["{$paramName}" => ''];
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
# Handle DateTime objects in query
|
||||
if($openApiType === "\\DateTime" && $value instanceof \DateTime) {
|
||||
return ["{$paramName}" => $value->format(self::$dateTimeFormat)];
|
||||
}
|
||||
|
||||
$query = [];
|
||||
$value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value;
|
||||
|
||||
// since \GuzzleHttp\Psr7\Query::build fails with nested arrays
|
||||
// need to flatten array first
|
||||
$flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) {
|
||||
if (!is_array($arr)) return $arr;
|
||||
|
||||
foreach ($arr as $k => $v) {
|
||||
$prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k;
|
||||
|
||||
if (is_array($v)) {
|
||||
$flattenArray($v, $prop, $result);
|
||||
} else {
|
||||
if ($style !== 'deepObject' && !$explode) {
|
||||
// push key itself
|
||||
$result[] = $prop;
|
||||
}
|
||||
$result[$prop] = $v;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
};
|
||||
|
||||
$value = $flattenArray($value, $paramName);
|
||||
|
||||
if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if ('boolean' === $openApiType && is_bool($value)) {
|
||||
$value = self::convertBoolToQueryStringFormat($value);
|
||||
}
|
||||
|
||||
// handle style in serializeCollection
|
||||
$query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style);
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert boolean value to format for query string.
|
||||
*
|
||||
* @param bool $value Boolean value
|
||||
*
|
||||
* @return int|string Boolean value in format
|
||||
*/
|
||||
public static function convertBoolToQueryStringFormat(bool $value)
|
||||
{
|
||||
if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) {
|
||||
return $value ? 'true' : 'false';
|
||||
}
|
||||
|
||||
return (int) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Take value and turn it into a string suitable for inclusion in
|
||||
* the header. If it's a string, pass through unchanged
|
||||
* If it's a datetime object, format it in ISO8601
|
||||
*
|
||||
* @param string $value a string which will be part of the header
|
||||
*
|
||||
* @return string the header string
|
||||
*/
|
||||
public static function toHeaderValue($value)
|
||||
{
|
||||
$callable = [$value, 'toHeaderValue'];
|
||||
if (is_callable($callable)) {
|
||||
return $callable();
|
||||
}
|
||||
|
||||
return self::toString($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Take value and turn it into a string suitable for inclusion in
|
||||
* the http body (form parameter). If it's a string, pass through unchanged
|
||||
* If it's a datetime object, format it in ISO8601
|
||||
*
|
||||
* @param string|\SplFileObject $value the value of the form parameter
|
||||
*
|
||||
* @return string the form string
|
||||
*/
|
||||
public static function toFormValue($value)
|
||||
{
|
||||
if ($value instanceof \SplFileObject) {
|
||||
return $value->getRealPath();
|
||||
} else {
|
||||
return self::toString($value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Take value and turn it into a string suitable for inclusion in
|
||||
* the parameter. If it's a string, pass through unchanged
|
||||
* If it's a datetime object, format it in ISO8601
|
||||
* If it's a boolean, convert it to "true" or "false".
|
||||
*
|
||||
* @param string|bool|\DateTime $value the value of the parameter
|
||||
*
|
||||
* @return string the header string
|
||||
*/
|
||||
public static function toString($value)
|
||||
{
|
||||
if ($value instanceof \DateTime) { // datetime in ISO8601 format
|
||||
return $value->format(self::$dateTimeFormat);
|
||||
} elseif (is_bool($value)) {
|
||||
return $value ? 'true' : 'false';
|
||||
} else {
|
||||
return (string) $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize an array to a string.
|
||||
*
|
||||
* @param array $collection collection to serialize to a string
|
||||
* @param string $style the format use for serialization (csv,
|
||||
* ssv, tsv, pipes, multi)
|
||||
* @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false)
|
||||
{
|
||||
if ($allowCollectionFormatMulti && ('multi' === $style)) {
|
||||
// http_build_query() almost does the job for us. We just
|
||||
// need to fix the result of multidimensional arrays.
|
||||
return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&'));
|
||||
}
|
||||
switch ($style) {
|
||||
case 'pipeDelimited':
|
||||
case 'pipes':
|
||||
return implode('|', $collection);
|
||||
|
||||
case 'tsv':
|
||||
return implode("\t", $collection);
|
||||
|
||||
case 'spaceDelimited':
|
||||
case 'ssv':
|
||||
return implode(' ', $collection);
|
||||
|
||||
case 'simple':
|
||||
case 'csv':
|
||||
// Deliberate fall through. CSV is default format.
|
||||
default:
|
||||
return implode(',', $collection);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserialize a JSON string into an object
|
||||
*
|
||||
* @param mixed $data object or primitive to be deserialized
|
||||
* @param string $class class name is passed as a string
|
||||
* @param string[] $httpHeaders HTTP headers
|
||||
*
|
||||
* @return object|array|null a single or an array of $class instances
|
||||
*/
|
||||
public static function deserialize($data, $class, $httpHeaders = null)
|
||||
{
|
||||
if (null === $data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (strcasecmp(substr($class, -2), '[]') === 0) {
|
||||
$data = is_string($data) ? json_decode($data) : $data;
|
||||
|
||||
if (!is_array($data)) {
|
||||
throw new \InvalidArgumentException("Invalid array '$class'");
|
||||
}
|
||||
|
||||
$subClass = substr($class, 0, -2);
|
||||
$values = [];
|
||||
foreach ($data as $key => $value) {
|
||||
$values[] = self::deserialize($value, $subClass, null);
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
||||
if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array<string,int>
|
||||
$data = is_string($data) ? json_decode($data) : $data;
|
||||
settype($data, 'array');
|
||||
$inner = substr($class, 4, -1);
|
||||
$deserialized = [];
|
||||
if (strrpos($inner, ",") !== false) {
|
||||
$subClass_array = explode(',', $inner, 2);
|
||||
$subClass = $subClass_array[1];
|
||||
foreach ($data as $key => $value) {
|
||||
$deserialized[$key] = self::deserialize($value, $subClass, null);
|
||||
}
|
||||
}
|
||||
return $deserialized;
|
||||
}
|
||||
|
||||
if ($class === 'object') {
|
||||
settype($data, 'array');
|
||||
return $data;
|
||||
} elseif ($class === 'mixed') {
|
||||
settype($data, gettype($data));
|
||||
return $data;
|
||||
}
|
||||
|
||||
if ($class === '\DateTime') {
|
||||
// Some APIs return an invalid, empty string as a
|
||||
// date-time property. DateTime::__construct() will return
|
||||
// the current time for empty input which is probably not
|
||||
// what is meant. The invalid empty string is probably to
|
||||
// be interpreted as a missing field/value. Let's handle
|
||||
// this graceful.
|
||||
if (!empty($data)) {
|
||||
try {
|
||||
return new \DateTime($data);
|
||||
} catch (\Exception $exception) {
|
||||
// Some APIs return a date-time with too high nanosecond
|
||||
// precision for php's DateTime to handle.
|
||||
// With provided regexp 6 digits of microseconds saved
|
||||
return new \DateTime(self::sanitizeTimestamp($data));
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($class === '\SplFileObject') {
|
||||
$data = Utils::streamFor($data);
|
||||
|
||||
/** @var \Psr\Http\Message\StreamInterface $data */
|
||||
|
||||
// determine file name
|
||||
if (
|
||||
is_array($httpHeaders)
|
||||
&& array_key_exists('Content-Disposition', $httpHeaders)
|
||||
&& preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)
|
||||
) {
|
||||
$filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]);
|
||||
} else {
|
||||
$filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), '');
|
||||
}
|
||||
|
||||
$file = fopen($filename, 'w');
|
||||
while ($chunk = $data->read(200)) {
|
||||
fwrite($file, $chunk);
|
||||
}
|
||||
fclose($file);
|
||||
|
||||
return new \SplFileObject($filename, 'r');
|
||||
}
|
||||
|
||||
/** @psalm-suppress ParadoxicalCondition */
|
||||
if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) {
|
||||
settype($data, $class);
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
if (method_exists($class, 'getAllowableEnumValues')) {
|
||||
if (!in_array($data, $class::getAllowableEnumValues(), true)) {
|
||||
$imploded = implode("', '", $class::getAllowableEnumValues());
|
||||
throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'");
|
||||
}
|
||||
return $data;
|
||||
} else {
|
||||
$data = is_string($data) ? json_decode($data) : $data;
|
||||
|
||||
if (is_array($data)) {
|
||||
$data = (object)$data;
|
||||
}
|
||||
|
||||
// If a discriminator is defined and points to a valid subclass, use it.
|
||||
$discriminator = $class::DISCRIMINATOR;
|
||||
if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) {
|
||||
$subclass = '\OpenAPI\Client\Model\\' . $data->{$discriminator};
|
||||
if (is_subclass_of($subclass, $class)) {
|
||||
$class = $subclass;
|
||||
}
|
||||
}
|
||||
|
||||
/** @var ModelInterface $instance */
|
||||
$instance = new $class();
|
||||
foreach ($instance::openAPITypes() as $property => $type) {
|
||||
$propertySetter = $instance::setters()[$property];
|
||||
|
||||
if (!isset($propertySetter)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($data->{$instance::attributeMap()[$property]})) {
|
||||
if ($instance::isNullable($property)) {
|
||||
$instance->$propertySetter(null);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($data->{$instance::attributeMap()[$property]})) {
|
||||
$propertyValue = $data->{$instance::attributeMap()[$property]};
|
||||
$instance->$propertySetter(self::deserialize($propertyValue, $type, null));
|
||||
}
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a query string from an array of key value pairs.
|
||||
*
|
||||
* This function can use the return value of `parse()` to build a query
|
||||
* string. This function does not modify the provided keys when an array is
|
||||
* encountered (like `http_build_query()` would).
|
||||
*
|
||||
* The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112
|
||||
* with a modification which is described in https://github.com/guzzle/psr7/pull/603
|
||||
*
|
||||
* @param array $params Query string parameters.
|
||||
* @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986
|
||||
* to encode using RFC3986, or PHP_QUERY_RFC1738
|
||||
* to encode using RFC1738.
|
||||
* @param bool $treatBooleansAsInts When `true` values are cast to int (e.g. ['foo' => false] gives `foo=0`).
|
||||
* When `false` values are cast to strings (e.g. ['foo' => false] gives `foo=false`).
|
||||
*/
|
||||
public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986, bool $treatBooleansAsInts = true): string
|
||||
{
|
||||
if (!$params) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($encoding === false) {
|
||||
$encoder = function (string $str): string {
|
||||
return $str;
|
||||
};
|
||||
} elseif ($encoding === PHP_QUERY_RFC3986) {
|
||||
$encoder = 'rawurlencode';
|
||||
} elseif ($encoding === PHP_QUERY_RFC1738) {
|
||||
$encoder = 'urlencode';
|
||||
} else {
|
||||
throw new \InvalidArgumentException('Invalid type');
|
||||
}
|
||||
|
||||
$castBool = $treatBooleansAsInts
|
||||
? function ($v) { return (int) $v; }
|
||||
: function ($v) { return $v ? 'true' : 'false'; };
|
||||
|
||||
$qs = '';
|
||||
foreach ($params as $k => $v) {
|
||||
$k = $encoder((string) $k);
|
||||
if (!is_array($v)) {
|
||||
$qs .= $k;
|
||||
$v = is_bool($v) ? $castBool($v) : $v;
|
||||
if ($v !== null) {
|
||||
$qs .= '='.$encoder((string) $v);
|
||||
}
|
||||
$qs .= '&';
|
||||
} else {
|
||||
foreach ($v as $vv) {
|
||||
$qs .= $k;
|
||||
$vv = is_bool($vv) ? $castBool($vv) : $vv;
|
||||
if ($vv !== null) {
|
||||
$qs .= '='.$encoder((string) $vv);
|
||||
}
|
||||
$qs .= '&';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $qs ? (string) substr($qs, 0, -1) : '';
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
path:
|
||||
- src/
|
||||
- tests/
|
||||
jobs: 10
|
||||
extensions:
|
||||
- php
|
||||
exclude:
|
||||
- vendor
|
||||
warning: true
|
||||
memory-limit: -1
|
||||
no-cache: false
|
||||
log-json: false
|
||||
log-junit: false
|
@ -1,72 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>PhpPetstoreOAS3Tests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>PHP OpenAPI OAS3 Client</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>bundle-install</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>composer</executable>
|
||||
<arguments>
|
||||
<argument>install</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>check-php-syntax</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>vendor/bin/phplint</executable>
|
||||
<arguments>
|
||||
<argument>--configuration=phplint.dist.yml</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>bundle-test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>vendor/bin/phpunit</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -1,409 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CatAllOf
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* CatAllOf Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class CatAllOf implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'Cat_allOf';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'declawed' => 'bool'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'declawed' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'declawed' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'declawed' => 'declawed'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'declawed' => 'setDeclawed'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'declawed' => 'getDeclawed'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('declawed', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets declawed
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
public function getDeclawed()
|
||||
{
|
||||
return $this->container['declawed'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets declawed
|
||||
*
|
||||
* @param bool|null $declawed declawed
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setDeclawed($declawed)
|
||||
{
|
||||
if (is_null($declawed)) {
|
||||
throw new \InvalidArgumentException('non-nullable declawed cannot be null');
|
||||
}
|
||||
$this->container['declawed'] = $declawed;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,409 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* DogAllOf
|
||||
*
|
||||
* PHP version 8.0
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* DogAllOf Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
* @implements \ArrayAccess<string, mixed>
|
||||
*/
|
||||
class DogAllOf implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
public const DISCRIMINATOR = null;
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $openAPIModelName = 'Dog_allOf';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $openAPITypes = [
|
||||
'breed' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string|null>
|
||||
* @psalm-var array<string, string|null>
|
||||
*/
|
||||
protected static $openAPIFormats = [
|
||||
'breed' => null
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of nullable properties. Used for (de)serialization
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected static array $openAPINullables = [
|
||||
'breed' => false
|
||||
];
|
||||
|
||||
/**
|
||||
* If a nullable field gets set to null, insert it here
|
||||
*
|
||||
* @var boolean[]
|
||||
*/
|
||||
protected array $openAPINullablesSetToNull = [];
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPITypes()
|
||||
{
|
||||
return self::$openAPITypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function openAPIFormats()
|
||||
{
|
||||
return self::$openAPIFormats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function openAPINullables(): array
|
||||
{
|
||||
return self::$openAPINullables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @return boolean[]
|
||||
*/
|
||||
private function getOpenAPINullablesSetToNull(): array
|
||||
{
|
||||
return $this->openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter - Array of nullable field names deliberately set to null
|
||||
*
|
||||
* @param boolean[] $openAPINullablesSetToNull
|
||||
*/
|
||||
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
||||
{
|
||||
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a property is nullable
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNullable(string $property): bool
|
||||
{
|
||||
return self::openAPINullables()[$property] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a nullable property is set to null.
|
||||
*
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullableSetToNull(string $property): bool
|
||||
{
|
||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
'breed' => 'breed'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
'breed' => 'setBreed'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
'breed' => 'getBreed'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function attributeMap()
|
||||
{
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setters()
|
||||
{
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getters()
|
||||
{
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModelName()
|
||||
{
|
||||
return self::$openAPIModelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->setIfExists('breed', $data ?? [], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
||||
* $this->openAPINullablesSetToNull array
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param array $fields
|
||||
* @param mixed $defaultValue
|
||||
*/
|
||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
||||
{
|
||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
||||
$this->openAPINullablesSetToNull[] = $variableName;
|
||||
}
|
||||
|
||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return count($this->listInvalidProperties()) === 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets breed
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getBreed()
|
||||
{
|
||||
return $this->container['breed'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets breed
|
||||
*
|
||||
* @param string|null $breed breed
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setBreed($breed)
|
||||
{
|
||||
if (is_null($breed)) {
|
||||
throw new \InvalidArgumentException('non-nullable breed cannot be null');
|
||||
}
|
||||
$this->container['breed'] = $breed;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->container[$offset] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
*
|
||||
* @param int|null $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->container[] = $value;
|
||||
} else {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
||||
* of any type other than a resource.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return ObjectSerializer::sanitizeForSerialization($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return json_encode(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a header-safe presentation of the object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHeaderValue()
|
||||
{
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,87 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use OpenAPI\Client\Api\PetApi;
|
||||
use OpenAPI\Client\Model\Pet;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class AsyncTest extends TestCase
|
||||
{
|
||||
/** @var PetApi */
|
||||
private $api;
|
||||
|
||||
/** @var int */
|
||||
private $petId;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->api = new Api\PetApi();
|
||||
|
||||
$this->petId = 10005;
|
||||
$pet = new Model\Pet;
|
||||
$pet->setId($this->petId);
|
||||
$pet->setName("PHP Unit Test");
|
||||
$pet->setPhotoUrls(array("http://test_php_unit_test.com"));
|
||||
// new tag
|
||||
$tag= new Model\Tag;
|
||||
$tag->setId($this->petId); // use the same id as pet
|
||||
$tag->setName("test php tag");
|
||||
// new category
|
||||
$category = new Model\Category;
|
||||
$category->setId($this->petId); // use the same id as pet
|
||||
$category->setName("test php category");
|
||||
|
||||
$pet->setTags(array($tag));
|
||||
$pet->setCategory($category);
|
||||
|
||||
$pet_api = new Api\PetApi();
|
||||
// add a new pet (model)
|
||||
$add_response = $pet_api->addPet($pet);
|
||||
}
|
||||
|
||||
public function testAsyncRequest()
|
||||
{
|
||||
$promise = $this->api->getPetByIdAsync(10005);
|
||||
|
||||
$promise2 = $this->api->getPetByIdAsync(10005);
|
||||
|
||||
$pet = $promise->wait();
|
||||
$pet2 = $promise2->wait();
|
||||
$this->assertInstanceOf(Pet::class, $pet);
|
||||
$this->assertInstanceOf(Pet::class, $pet2);
|
||||
}
|
||||
|
||||
public function testAsyncRequestWithHttpInfo()
|
||||
{
|
||||
$promise = $this->api->getPetByIdAsyncWithHttpInfo($this->petId);
|
||||
|
||||
list($pet, $status, $headers) = $promise->wait();
|
||||
$this->assertEquals(200, $status);
|
||||
$this->assertIsArray($headers);
|
||||
$this->assertInstanceOf(Pet::class, $pet);
|
||||
}
|
||||
|
||||
public function testAsyncThrowingException()
|
||||
{
|
||||
$this->expectException(\OpenAPI\Client\ApiException::class);
|
||||
$promise = $this->api->getPetByIdAsync(0);
|
||||
$promise->wait();
|
||||
}
|
||||
|
||||
/**
|
||||
* @doesNotPerformAssertions
|
||||
*/
|
||||
public function testAsyncApiExceptionWithoutWaitIsNotThrown()
|
||||
{
|
||||
$promise = $this->api->getPetByIdAsync(0);
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
public function testAsyncHttpInfoThrowingException()
|
||||
{
|
||||
$this->expectException(\OpenAPI\Client\ApiException::class);
|
||||
$promise = $this->api->getPetByIdAsyncWithHttpInfo(0);
|
||||
$promise->wait();
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use OpenAPI\Client\Api\FakeApi;
|
||||
use OpenAPI\Client\Api\PetApi;
|
||||
use OpenAPI\Client\Model\Pet;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
require_once __DIR__ . '/FakeHttpClient.php';
|
||||
|
||||
class AuthTest extends TestCase
|
||||
{
|
||||
public function testCustomApiKeyHeader()
|
||||
{
|
||||
$authConfig = new Configuration();
|
||||
$authConfig->setApiKey('api_key', '123qwe');
|
||||
|
||||
$fakeHttpClient = new FakeHttpClient();
|
||||
$api = new PetApi($fakeHttpClient, $authConfig);
|
||||
$api->getPetById(123);
|
||||
|
||||
$headers = $fakeHttpClient->getLastRequest()->getHeaders();
|
||||
|
||||
$this->assertArrayHasKey('api_key', $headers);
|
||||
$this->assertEquals(['123qwe'], $headers['api_key']);
|
||||
}
|
||||
|
||||
public function testApiToken()
|
||||
{
|
||||
$authConfig = new Configuration();
|
||||
$authConfig->setAccessToken('asd123');
|
||||
|
||||
$fakeHttpClient = new FakeHttpClient();
|
||||
$api = new PetApi($fakeHttpClient, $authConfig);
|
||||
$api->addPet(new Pet(array('name' => 'testing', 'photo_urls' => array('http://a.com'))));
|
||||
|
||||
$headers = $fakeHttpClient->getLastRequest()->getHeaders();
|
||||
|
||||
$this->assertArrayHasKey('Authorization', $headers);
|
||||
$this->assertEquals(['Bearer asd123'], $headers['Authorization']);
|
||||
}
|
||||
|
||||
public function testBasicAuth()
|
||||
{
|
||||
$username = 'user';
|
||||
$password = 'password';
|
||||
|
||||
$authConfig = new Configuration();
|
||||
$authConfig->setUsername($username);
|
||||
$authConfig->setPassword($password);
|
||||
|
||||
$fakeHttpClient = new FakeHttpClient();
|
||||
$api = new FakeApi($fakeHttpClient, $authConfig);
|
||||
$api->testEndpointParameters(123, 100.1, 'ASD_', 'ASD');
|
||||
|
||||
$headers = $fakeHttpClient->getLastRequest()->getHeaders();
|
||||
|
||||
$this->assertArrayHasKey('Authorization', $headers);
|
||||
$encodedCredentials = base64_encode("$username:$password");
|
||||
$this->assertEquals(["Basic $encodedCredentials"], $headers['Authorization']);
|
||||
}
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ConfigurationTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Test server settings
|
||||
*/
|
||||
public function testMultipleServers()
|
||||
{
|
||||
$config = new Configuration();
|
||||
$servers = $config->getHostSettings();
|
||||
|
||||
$this->assertCount(3, $servers);
|
||||
$this->assertSame("http://{server}.swagger.io:{port}/v2", $servers[0]["url"]);
|
||||
$this->assertSame("petstore", $servers[0]["variables"]["server"]["default_value"]);
|
||||
$this->assertSame("80", $servers[0]["variables"]["port"]["default_value"]);
|
||||
$this->assertSame(array("80", "8080"), $servers[0]["variables"]["port"]["enum_values"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test server settings
|
||||
*/
|
||||
public function testServerUrl()
|
||||
{
|
||||
$config = new Configuration();
|
||||
// default value
|
||||
$url = $config->getHostFromSettings(0);
|
||||
$this->assertSame("http://petstore.swagger.io:80/v2", $url);
|
||||
|
||||
// using a variable
|
||||
$url = $config->getHostFromSettings(0, array("server" => "dev-petstore"));
|
||||
$this->assertSame("http://dev-petstore.swagger.io:80/v2", $url);
|
||||
|
||||
// using 2 variables
|
||||
$url = $config->getHostFromSettings(0, array("server" => "dev-petstore", "port" => "8080"));
|
||||
$this->assertSame("http://dev-petstore.swagger.io:8080/v2", $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test invalid index
|
||||
*/
|
||||
public function testInvalidIndex()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Invalid index 3 when selecting the host. Must be less than 3');
|
||||
$config = new Configuration();
|
||||
$url = $config->getHostFromSettings(3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test host settings with invalid values
|
||||
*/
|
||||
public function testHostUrlWithInvalidValues()
|
||||
{
|
||||
// using 2 variables with invalid values
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('The variable `port` in the host URL has invalid value 8. Must be 80,8080');
|
||||
$config = new Configuration();
|
||||
$url = $config->getHostFromSettings(0, array("server" => "dev-petstore", "port" => "8"));
|
||||
$this->assertSame("http://dev-petstore.swagger.io:8080/v2", $url);
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use OpenAPI\Client\Model\FormatTest;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class DateTimeSerializerTest extends TestCase
|
||||
{
|
||||
public function testDateTimeSanitation()
|
||||
{
|
||||
$dateTime = new \DateTime('April 30, 1973 17:05 CEST');
|
||||
|
||||
$input = new FormatTest([
|
||||
'date_time' => $dateTime,
|
||||
'date' => $dateTime,
|
||||
'number' => 123.45,
|
||||
'password' => 'password',
|
||||
'byte' => '0101'
|
||||
]);
|
||||
|
||||
$data = ObjectSerializer::sanitizeForSerialization($input);
|
||||
|
||||
$this->assertEquals('1973-04-30T17:05:00+02:00', $data->dateTime);
|
||||
|
||||
ObjectSerializer::setDateTimeFormat(\DateTime::RFC3339_EXTENDED);
|
||||
$dataFraction = ObjectSerializer::sanitizeForSerialization($input);
|
||||
$this->assertEquals('1973-04-30T17:05:00.000+02:00', $dataFraction->dateTime);
|
||||
ObjectSerializer::setDateTimeFormat(\DateTime::ATOM);
|
||||
}
|
||||
|
||||
public function testDateSanitation()
|
||||
{
|
||||
$dateTime = new \DateTime('April 30, 1973 17:05 CEST');
|
||||
|
||||
$input = new FormatTest([
|
||||
'date_time' => $dateTime,
|
||||
'date' => $dateTime,
|
||||
'number' => 123.45,
|
||||
'password' => 'password',
|
||||
'byte' => '0101'
|
||||
]);
|
||||
|
||||
$data = ObjectSerializer::sanitizeForSerialization($input);
|
||||
|
||||
$this->assertEquals('1973-04-30', $data->date);
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class DebugTest extends TestCase
|
||||
{
|
||||
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$newPet = new Model\Pet;
|
||||
$newPet->setId(1);
|
||||
$newPet->setName("PHP Unit Test");
|
||||
(new Api\PetApi())->addPetWithHttpInfo($newPet);
|
||||
}
|
||||
|
||||
public function testEnableDebugOutput()
|
||||
{
|
||||
$this->expectOutputRegex('#GET /v2/pet/1 HTTP/1.1#');
|
||||
|
||||
$config = new Configuration();
|
||||
$config->setDebug(true);
|
||||
$api = new Api\PetApi(null, $config);
|
||||
$api->getPetById(1);
|
||||
}
|
||||
|
||||
public function testEnableDebugOutputAsync()
|
||||
{
|
||||
$this->expectOutputRegex('#GET /v2/pet/1 HTTP/1.1#');
|
||||
|
||||
$config = new Configuration();
|
||||
$config->setDebug(true);
|
||||
$api = new Api\PetApi(null, $config);
|
||||
$promise = $api->getPetByIdAsync(1);
|
||||
$promise->wait();
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use OpenAPI\Client\Model\EnumClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class EnumClassTest extends TestCase
|
||||
{
|
||||
public function testPossibleValues()
|
||||
{
|
||||
$this->assertSame(EnumClass::ABC, '_abc');
|
||||
$this->assertSame(EnumClass::EFG, '-efg');
|
||||
$this->assertSame(EnumClass::XYZ, '(xyz)');
|
||||
}
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use OpenAPI\Client\Model\EnumTest;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class EnumTestTest extends TestCase
|
||||
{
|
||||
public function testPossibleValues()
|
||||
{
|
||||
$this->assertSame(EnumTest::ENUM_STRING_UPPER, "UPPER");
|
||||
$this->assertSame(EnumTest::ENUM_STRING_LOWER, "lower");
|
||||
$this->assertSame(EnumTest::ENUM_INTEGER_1, 1);
|
||||
$this->assertSame(EnumTest::ENUM_INTEGER_MINUS_1, -1);
|
||||
$this->assertSame(EnumTest::ENUM_NUMBER_1_DOT_1, 1.1);
|
||||
$this->assertSame(EnumTest::ENUM_NUMBER_MINUS_1_DOT_2, -1.2);
|
||||
}
|
||||
|
||||
public function testStrictValidation()
|
||||
{
|
||||
$enum = new EnumTest([
|
||||
'enum_string' => 0,
|
||||
]);
|
||||
|
||||
$this->assertFalse($enum->valid());
|
||||
|
||||
$expected = [
|
||||
"invalid value '0' for 'enum_string', must be one of 'UPPER', 'lower', ''",
|
||||
"'enum_string_required' can't be null",
|
||||
];
|
||||
$this->assertSame($expected, $enum->listInvalidProperties());
|
||||
}
|
||||
|
||||
public function testThrowExceptionWhenInvalidAmbiguousValueHasPassed()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$enum = new EnumTest();
|
||||
$enum->setEnumString(0);
|
||||
}
|
||||
|
||||
public function testNonRequiredPropertyIsOptional()
|
||||
{
|
||||
$enum = new EnumTest([
|
||||
'enum_string_required' => 'UPPER',
|
||||
]);
|
||||
$this->assertSame([], $enum->listInvalidProperties());
|
||||
$this->assertTrue($enum->valid());
|
||||
}
|
||||
|
||||
public function testRequiredProperty()
|
||||
{
|
||||
$enum = new EnumTest();
|
||||
$this->assertSame(["'enum_string_required' can't be null"], $enum->listInvalidProperties());
|
||||
$this->assertFalse($enum->valid());
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ExceptionTest extends TestCase
|
||||
{
|
||||
public function testNotFound()
|
||||
{
|
||||
$this->expectException(\OpenAPI\Client\ApiException::class);
|
||||
$this->expectExceptionCode(404);
|
||||
$this->expectExceptionMessage('http://petstore.swagger.io/INVALID_URL/store/inventory');
|
||||
$config = new Configuration();
|
||||
$config->setHost('http://petstore.swagger.io/INVALID_URL');
|
||||
|
||||
$api = new Api\StoreApi(
|
||||
new Client(),
|
||||
$config
|
||||
);
|
||||
$api->getInventory();
|
||||
}
|
||||
|
||||
public function testWrongHost()
|
||||
{
|
||||
$this->expectException(\OpenAPI\Client\ApiException::class);
|
||||
$this->expectExceptionMessage('Could not resolve');
|
||||
$this->expectExceptionMessage('wrong_host.zxc');
|
||||
$config = new Configuration();
|
||||
$config->setHost('http://wrong_host.zxc');
|
||||
|
||||
$api = new Api\StoreApi(
|
||||
new Client(),
|
||||
$config
|
||||
);
|
||||
$api->getInventory();
|
||||
}
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use GuzzleHttp\ClientInterface;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use GuzzleHttp\Promise\PromiseInterface;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class FakeHttpClient implements ClientInterface
|
||||
{
|
||||
/** @var RequestInterface|null */
|
||||
private $request;
|
||||
/** @var ResponseInterface|null */
|
||||
private $response;
|
||||
|
||||
/**
|
||||
* @return null|RequestInterface
|
||||
*/
|
||||
public function getLastRequest()
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|ResponseInterface $response
|
||||
*/
|
||||
public function setResponse(ResponseInterface $response = null)
|
||||
{
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an HTTP request.
|
||||
*
|
||||
* @param RequestInterface $request Request to send
|
||||
* @param array $options Request options to apply to the given
|
||||
* request and to the transfer.
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function send(RequestInterface $request, array $options = []): ResponseInterface
|
||||
{
|
||||
$this->request = $request;
|
||||
return $this->response ?: new Response(200);
|
||||
}
|
||||
|
||||
public function sendAsync(RequestInterface $request, array $options = []): PromiseInterface
|
||||
{
|
||||
throw new \RuntimeException('not implemented');
|
||||
}
|
||||
|
||||
public function request($method, $uri, array $options = []): ResponseInterface
|
||||
{
|
||||
throw new \RuntimeException('not implemented');
|
||||
}
|
||||
|
||||
public function requestAsync($method, $uri, array $options = []): PromiseInterface
|
||||
{
|
||||
throw new \RuntimeException('not implemented');
|
||||
}
|
||||
|
||||
public function getConfig($option = null)
|
||||
{
|
||||
throw new \RuntimeException('not implemented');
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
use OpenAPI\Client\Model\FormatTest;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class FormatTestTest extends TestCase
|
||||
{
|
||||
public function testCountTheLengthOfMultiByteStringsCorrectly()
|
||||
{
|
||||
$the64MultiByteStrings = '123456789012345678901234567890123456789012345678901234567890123';
|
||||
|
||||
// Pass the string via constructor.
|
||||
$formatTest = new FormatTest([
|
||||
'password' => $the64MultiByteStrings,
|
||||
// mandatory parameters
|
||||
'number' => 500,
|
||||
'byte' => base64_encode('test'),
|
||||
'date' => new DateTime(),
|
||||
]);
|
||||
|
||||
$this->assertEmpty($formatTest->listInvalidProperties());
|
||||
|
||||
// Pass the strings via setter.
|
||||
// Throws InvalidArgumentException if it doesn't count the length correctly.
|
||||
$formatTest->setPassword($the64MultiByteStrings);
|
||||
}
|
||||
}
|
@ -1,163 +0,0 @@
|
||||
<?php
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* class HeaderSelectorTest
|
||||
*
|
||||
* @package OpenAPI\Client
|
||||
*/
|
||||
class HeaderSelectorTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider headersProvider
|
||||
* @param string[] $accept
|
||||
* @param string $contentType
|
||||
* @param bool $isMultiple
|
||||
* @param string[] $expectedHeaders
|
||||
*/
|
||||
public function testSelectHeaders(array $accept, string $contentType, bool $isMultiple, array $expectedHeaders): void
|
||||
{
|
||||
$selector = new HeaderSelector();
|
||||
|
||||
$headers = $selector->selectHeaders($accept, $contentType, $isMultiple);
|
||||
$this->assertEquals($expectedHeaders, $headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array[][]
|
||||
*/
|
||||
public function headersProvider(): array
|
||||
{
|
||||
$data = [
|
||||
// array $accept, string $contentType, bool $isMultipart, array $expectedHeaders
|
||||
[
|
||||
# No Accept, Content-Type
|
||||
[], 'application/xml', false, ['Content-Type' => 'application/xml'],
|
||||
],
|
||||
[
|
||||
# No Accept, Content-Type, multipart
|
||||
[], 'application/xml', true, [],
|
||||
],
|
||||
[
|
||||
# single Accept, no Content-Type
|
||||
['application/xml'], '', false, ['Accept' => 'application/xml', 'Content-Type' => 'application/json'],
|
||||
],
|
||||
[
|
||||
# single Accept, no Content-Type, multipart
|
||||
['application/xml'], '', true, ['Accept' => 'application/xml'],
|
||||
],
|
||||
[
|
||||
# single Accept, Content-Type
|
||||
['application/xml'], 'application/xml', false, ['Accept' => 'application/xml', 'Content-Type' => 'application/xml'],
|
||||
],
|
||||
[
|
||||
# single Accept, Content-Type, multipart
|
||||
['application/xml'], 'application/xml', true, ['Accept' => 'application/xml'],
|
||||
],
|
||||
[
|
||||
# single Accept with parameters, Content-Type with parameters
|
||||
['application/json;format=flowed'], 'text/plain;format=fixed', false, ['Accept' => 'application/json;format=flowed', 'Content-Type' => 'text/plain;format=fixed'],
|
||||
],
|
||||
|
||||
# Tests for Accept headers - no change on Content-Type or multipart setting
|
||||
[
|
||||
# Multiple Accept without Json
|
||||
['application/xml', 'text/html'], '', true, ['Accept' => 'application/xml,text/html'],
|
||||
],
|
||||
[
|
||||
# Multiple Accept with application/json
|
||||
['application/json', 'text/html'], '', true, ['Accept' => 'application/json,text/html;q=0.9'],
|
||||
],
|
||||
[
|
||||
# Multiple Accept with json-like
|
||||
['text/html', 'application/xml+json'], '', true, ['Accept' => 'application/xml+json,text/html;q=0.9'],
|
||||
],
|
||||
[
|
||||
# Multiple Accept with application/json and json-like
|
||||
['text/html', 'application/json', 'application/xml+json'], '', true, ['Accept' => 'application/json,application/xml+json;q=0.9,text/html;q=0.8'],
|
||||
],
|
||||
[
|
||||
# Multiple Accept, changing priority to application/json
|
||||
['application/xml', 'application/json;q=0.9', 'text/plain;format=flowed;q=0.8'], '', true, ['Accept' => 'application/json,application/xml;q=0.9,text/plain;format=flowed;q=0.8'],
|
||||
],
|
||||
[
|
||||
# Multiple Accept, same priority for two headers, one being application/json
|
||||
['application/xml', 'application/json', 'text/plain;format=flowed;q=0.9'], '', true, ['Accept' => 'application/json,application/xml;q=0.9,text/plain;format=flowed;q=0.8'],
|
||||
],
|
||||
[
|
||||
# Multiple Accept, same priority for two headers, both being application/json
|
||||
['application/json', 'application/json;IEEE754Compatible=true', 'text/plain;format=flowed;q=0.9'], '', true, ['Accept' => 'application/json,application/json;IEEE754Compatible=true,text/plain;format=flowed;q=0.9'],
|
||||
],
|
||||
[
|
||||
# Multiple Accept, same priority for three headers, two being application/json, with changing priority
|
||||
['application/json;q=0.9', 'application/json;IEEE754Compatible=true;q=0.9', 'application/xml', 'text/plain;format=flowed;q=0.9'], '', true, ['Accept' => 'application/json,application/json;IEEE754Compatible=true,application/xml;q=0.9,text/plain;format=flowed;q=0.8'],
|
||||
],
|
||||
];
|
||||
|
||||
# More than 28 Accept headers
|
||||
$data[] = $this->createTestDataForLargeNumberOfAcceptHeaders(30);
|
||||
|
||||
# More than 1000 Accept headers
|
||||
$data[] = $this->createTestDataForLargeNumberOfAcceptHeaders(1000);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $numberOfHeaders
|
||||
* @return array
|
||||
*/
|
||||
private function createTestDataForLargeNumberOfAcceptHeaders(int $numberOfHeaders): array
|
||||
{
|
||||
$acceptHeaders = ['application/json;q=0.9'];
|
||||
$expected = ['application/json'];
|
||||
for ($i=1; $i<$numberOfHeaders; $i++) {
|
||||
$q = rtrim(sprintf('%0.3f', (1000 - $i) / 1000), '0');
|
||||
$acceptHeaders[] = "application/xml;option=$i;q=$q";
|
||||
$expected[] = "application/xml;option=$i;q=$q";
|
||||
}
|
||||
|
||||
return [
|
||||
$acceptHeaders,
|
||||
'',
|
||||
true,
|
||||
['Accept' => implode(',', $expected)]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider nextWeightProvider
|
||||
* @param int $currentWeight
|
||||
* @param bool $bHasMoreThan28Headers
|
||||
* @param int $expected
|
||||
*/
|
||||
public function testGetNextWeight(int $currentWeight, bool $bHasMoreThan28Headers, int $expected): void
|
||||
{
|
||||
$selector = new HeaderSelector();
|
||||
|
||||
self::assertEquals($expected, $selector->getNextWeight($currentWeight, $bHasMoreThan28Headers));
|
||||
}
|
||||
|
||||
public function nextWeightProvider(): array
|
||||
{
|
||||
return [
|
||||
[1000, true, 999],
|
||||
[999, true, 998],
|
||||
[2, true, 1],
|
||||
[1, true, 1],
|
||||
[1000, false, 900],
|
||||
[900, false, 800],
|
||||
[200, false, 100],
|
||||
[100, false, 90],
|
||||
[90, false, 80],
|
||||
[20, false, 10],
|
||||
[10, false, 9],
|
||||
[9, false, 8],
|
||||
[2, false, 1],
|
||||
[1, false, 1],
|
||||
[0, false, 1],
|
||||
];
|
||||
}
|
||||
}
|
@ -1,96 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use OpenAPI\Client\Model\Animal;
|
||||
use OpenAPI\Client\Model\Cat;
|
||||
use OpenAPI\Client\Model\Dog;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Test that Dog properly inherit Animal
|
||||
*
|
||||
* @package OpenAPI\Client
|
||||
*/
|
||||
class ModelInheritanceTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* test if default values works
|
||||
*/
|
||||
public function testDefaultValues()
|
||||
{
|
||||
// add some animals to the farm to make sure the ArrayAccess
|
||||
// interface works
|
||||
$dog = new Dog();
|
||||
$animal = new Animal();
|
||||
|
||||
// assert we can look up the animals in the farm by array
|
||||
// indices (let's try a random order)
|
||||
$this->assertSame('red', $dog->getColor());
|
||||
$this->assertSame('red', $animal->getColor());
|
||||
}
|
||||
|
||||
/**
|
||||
* test inheritance in the model
|
||||
*/
|
||||
public function testInheritance()
|
||||
{
|
||||
$newDog = new Dog;
|
||||
// the object should be an instance of the derived class
|
||||
$this->assertInstanceOf(Dog::class, $newDog);
|
||||
// the object should also be an instance of the parent class
|
||||
$this->assertInstanceOf(Animal::class, $newDog);
|
||||
}
|
||||
|
||||
/**
|
||||
* test inheritance constructor is working with data initialization
|
||||
*/
|
||||
public function testInheritanceConstructorDataInitialization()
|
||||
{
|
||||
// initialize the object with data in the constructor
|
||||
$data = [
|
||||
'class_name' => 'Dog',
|
||||
'breed' => 'Great Dane',
|
||||
];
|
||||
$newDog = new Dog($data);
|
||||
|
||||
// the property on the derived class should be set
|
||||
$this->assertSame('Great Dane', $newDog->getBreed());
|
||||
// the property on the parent class should be set
|
||||
$this->assertSame('Dog', $newDog->getClassName());
|
||||
}
|
||||
|
||||
/**
|
||||
* test if discriminator is initialized automatically
|
||||
*/
|
||||
public function testDiscriminatorInitialization()
|
||||
{
|
||||
$newDog = new Dog();
|
||||
$this->assertSame('Dog', $newDog->getClassName());
|
||||
}
|
||||
|
||||
/**
|
||||
* test if ArrayAccess interface works
|
||||
*/
|
||||
public function testArrayStuff()
|
||||
{
|
||||
// create an array of Animal
|
||||
$farm = array();
|
||||
|
||||
// add some animals to the farm to make sure the ArrayAccess interface works
|
||||
$farm[] = new Dog();
|
||||
$farm[] = new Cat();
|
||||
$farm[] = new Animal();
|
||||
|
||||
// assert we can look up the animals in the farm by array indices (let's try a random order)
|
||||
$this->assertInstanceOf(Cat::class, $farm[1]);
|
||||
$this->assertInstanceOf(Dog::class, $farm[0]);
|
||||
$this->assertInstanceOf(Animal::class, $farm[2]);
|
||||
|
||||
// let's try to `foreach` the animals in the farm and let's try to use the objects we loop through
|
||||
foreach ($farm as $animal) {
|
||||
$this->assertContains($animal->getClassName(), ['Dog', 'Cat', 'Animal']);
|
||||
$this->assertInstanceOf('OpenAPI\Client\Model\Animal', $animal);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use OpenAPI\Client\Model\Name;
|
||||
use OpenAPI\Client\Model\NullableClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* class NullableTest
|
||||
*
|
||||
* @package OpenAPI\Client
|
||||
*/
|
||||
class NullableTest extends TestCase
|
||||
{
|
||||
public function testNotNullableException(): void
|
||||
{
|
||||
$name = new Name();
|
||||
$name->setName(1);
|
||||
$this->assertEquals(1, $name->getName(), 'Non-nullable property can be set and retains its value');
|
||||
|
||||
// comment out below as strict type is now enabled
|
||||
//$this->expectException(InvalidArgumentException::class);
|
||||
//$this->expectExceptionMessage('non-nullable name cannot be null');
|
||||
|
||||
$this->expectException(TypeError::class);
|
||||
$this->expectExceptionMessage('must be of type int, null given');
|
||||
|
||||
//Failed asserting that exception of type "TypeError" matches expected exception "InvalidArgumentException". Message was: "OpenAPI\Client\Model\Name::setName(): Argument #1 ($name) must be of type int, null given, called in /Users/williamcheng/Code/openapi-generator7/samples/client/petstore/php-nextgen/OpenAPIClient-php/test/NullableTest.php on line 26" at
|
||||
$name->setName(null);
|
||||
|
||||
}
|
||||
|
||||
public function testNullableobject(): void
|
||||
{
|
||||
$nullable = new NullableClass();
|
||||
|
||||
$nullable->setIntegerProp(null);
|
||||
$this->assertNull($nullable->getIntegerProp(), 'Nullable property can be set to null retains its value');
|
||||
|
||||
$nullable->setIntegerProp(1);
|
||||
$this->assertEquals(1, $nullable->getIntegerProp(), 'Nullable property can be set and retains its value');
|
||||
}
|
||||
}
|
@ -1,634 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use DateTime;
|
||||
use Generator;
|
||||
use GuzzleHttp\Psr7\Utils;
|
||||
use OpenAPI\Client\Model\Pet;
|
||||
use OpenAPI\Client\Model\Tag;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use SplFileObject;
|
||||
|
||||
/**
|
||||
* class ObjectSerializerTest
|
||||
*
|
||||
* @package OpenAPI\Client
|
||||
*/
|
||||
class ObjectSerializerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Test sanitizeFilename
|
||||
*
|
||||
* @covers ObjectSerializer::sanitizeFilename
|
||||
*/
|
||||
public function testSanitizeFilename(): void
|
||||
{
|
||||
$this->assertSame("sun.gif", ObjectSerializer::sanitizeFilename("sun.gif"));
|
||||
$this->assertSame("sun.gif", ObjectSerializer::sanitizeFilename("../sun.gif"));
|
||||
$this->assertSame("sun.gif", ObjectSerializer::sanitizeFilename("/var/tmp/sun.gif"));
|
||||
$this->assertSame("sun.gif", ObjectSerializer::sanitizeFilename("./sun.gif"));
|
||||
|
||||
$this->assertSame("sun", ObjectSerializer::sanitizeFilename("sun"));
|
||||
$this->assertSame("sun.gif", ObjectSerializer::sanitizeFilename("..\sun.gif"));
|
||||
$this->assertSame("sun.gif", ObjectSerializer::sanitizeFilename("\var\tmp\sun.gif"));
|
||||
$this->assertSame("sun.gif", ObjectSerializer::sanitizeFilename("c:\var\tmp\sun.gif"));
|
||||
$this->assertSame("sun.gif", ObjectSerializer::sanitizeFilename(".\sun.gif"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test SplFileObject class deserialization.
|
||||
*
|
||||
* @see https://github.com/OpenAPITools/openapi-generator/pull/11184
|
||||
* @covers ObjectSerializer::deserialize
|
||||
* @dataProvider provideFileStreams
|
||||
*/
|
||||
public function testDeserializeFile($stream, ?array $httpHeaders = null, ?string $expectedFilename = null): void
|
||||
{
|
||||
$s = new ObjectSerializer();
|
||||
|
||||
/** @var SplFileObject $file */
|
||||
$file = ObjectSerializer::deserialize($stream, '\SplFileObject', $httpHeaders);
|
||||
$this->assertInstanceOf(SplFileObject::class, $file);
|
||||
|
||||
if (is_string($expectedFilename)) {
|
||||
$this->assertEquals($expectedFilename, $file->getFilename());
|
||||
} else {
|
||||
$this->assertNotEquals($expectedFilename, $file->getFilename());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* File Streams Provider
|
||||
* @return array[]
|
||||
*/
|
||||
public function provideFileStreams(): array
|
||||
{
|
||||
return [
|
||||
'File stream without headers' => [
|
||||
Utils::streamFor(\fopen(__FILE__, 'r')),
|
||||
null,
|
||||
null,
|
||||
],
|
||||
'File stream with Content-Disposition header' => [
|
||||
Utils::streamFor(\fopen(__FILE__, 'r')),
|
||||
['Content-Disposition' => 'inline; filename=\'foobar.php\''],
|
||||
'foobar.php',
|
||||
],
|
||||
'File path' => [
|
||||
__FILE__,
|
||||
null,
|
||||
null,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ObjectSerializer::sanitizeTimestamp
|
||||
* @dataProvider provideTimestamps
|
||||
*/
|
||||
public function testSanitizeTimestamp(string $timestamp, string $expected): void
|
||||
{
|
||||
$this->assertEquals($expected, ObjectSerializer::sanitizeTimestamp($timestamp));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test datetime deserialization.
|
||||
*
|
||||
* @covers ObjectSerializer::deserialize
|
||||
* @dataProvider provideTimestamps
|
||||
*
|
||||
* @see https://github.com/OpenAPITools/openapi-generator/issues/7942
|
||||
* @see https://github.com/OpenAPITools/openapi-generator/issues/10548
|
||||
*/
|
||||
public function testDateTimeParseSecondAccuracy(string $timestamp, string $expected): void
|
||||
{
|
||||
$dateTime = ObjectSerializer::deserialize($timestamp, '\DateTime');
|
||||
$this->assertEquals(new DateTime($expected), $dateTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamps provider
|
||||
*
|
||||
* @return string[][]
|
||||
*/
|
||||
public function provideTimestamps(): array
|
||||
{
|
||||
return [
|
||||
'String from #7942' => [
|
||||
'2020-11-11T15:17:58.868722633Z',
|
||||
'2020-11-11T15:17:58.868722Z',
|
||||
],
|
||||
'String from #10548' => [
|
||||
'2021-10-06T20:17:16.076372256Z',
|
||||
'2021-10-06T20:17:16.076372Z',
|
||||
],
|
||||
'Without timezone' => [
|
||||
'2021-10-06T20:17:16.076372256',
|
||||
'2021-10-06T20:17:16.076372',
|
||||
],
|
||||
'Without microseconds' => [
|
||||
'2021-10-06T20:17:16',
|
||||
'2021-10-06T20:17:16',
|
||||
],
|
||||
'Without microseconds with timezone' => [
|
||||
'2021-10-06T20:17:16Z',
|
||||
'2021-10-06T20:17:16Z',
|
||||
],
|
||||
'With numeric timezone' => [
|
||||
'2021-10-06T20:17:16.076372256+03:00',
|
||||
'2021-10-06T20:17:16.076372+03:00',
|
||||
],
|
||||
'With numeric timezone without delimiter' => [
|
||||
'2021-10-06T20:17:16.076372256+0300',
|
||||
'2021-10-06T20:17:16.076372+0300',
|
||||
],
|
||||
'With numeric short timezone' => [
|
||||
'2021-10-06T20:17:16.076372256+03',
|
||||
'2021-10-06T20:17:16.076372+03',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ObjectSerializer::toQueryValue
|
||||
* @dataProvider provideQueryParams
|
||||
*/
|
||||
public function testToQueryValue(
|
||||
$data,
|
||||
string $paramName,
|
||||
string $openApiType,
|
||||
string $style,
|
||||
bool $explode,
|
||||
bool $required,
|
||||
$expected
|
||||
): void {
|
||||
$value = ObjectSerializer::toQueryValue($data, $paramName, $openApiType, $style, $explode, $required);
|
||||
$query = ObjectSerializer::buildQuery($value);
|
||||
$this->assertEquals($expected, $query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query params provider
|
||||
*
|
||||
* @return array[]
|
||||
*/
|
||||
public function provideQueryParams(): array
|
||||
{
|
||||
$array = ['blue', 'black', 'brown'];
|
||||
$object = ['R' => 100, 'G' => 200, 'B' => 150];
|
||||
|
||||
return [
|
||||
// style form
|
||||
// skipValidation
|
||||
'form boolean, explode on, required false' => [
|
||||
false, 'skipValidation', 'boolean', 'form', true, false, 'skipValidation=0',
|
||||
],
|
||||
'form empty boolean, explode on, required false' => [
|
||||
null, 'skipValidation', 'boolean', 'form', true, false, '',
|
||||
],
|
||||
'form empty boolean, explode on, required true' => [
|
||||
null, 'skipValidation', 'boolean', 'form', true, true, 'skipValidation=',
|
||||
],
|
||||
// color=
|
||||
'form empty, explode on, required true' => [
|
||||
'', 'color', 'string', 'form', true, true, 'color=',
|
||||
],
|
||||
'form empty, explode on, required false' => [
|
||||
'', 'color', 'string', 'form', true, false, '',
|
||||
],
|
||||
// color=
|
||||
'form empty, explode off, required true' => [
|
||||
'', 'color', 'string', 'form', false, true, 'color=',
|
||||
],
|
||||
// color=blue
|
||||
'form string, explode on, required true' => [
|
||||
'blue', 'color', 'string', 'form', true, true, 'color=blue',
|
||||
],
|
||||
// color=blue
|
||||
'form string, explode off, required true' => [
|
||||
'blue', 'color', 'string', 'form', false, true, 'color=blue',
|
||||
],
|
||||
// color=blue&color=black&color=brown
|
||||
'form array, explode on, required true' => [
|
||||
$array, 'color', 'array', 'form', true, true, 'color=blue&color=black&color=brown',
|
||||
],
|
||||
// color=blue&color=black&color=brown
|
||||
'form nested array, explode on, required true' => [
|
||||
['foobar' => $array], 'color', 'array', 'form', true, true, 'color=blue&color=black&color=brown',
|
||||
],
|
||||
// color=blue,black,brown
|
||||
'form array, explode off, required true' => [
|
||||
$array, 'color', 'array', 'form', false, true, 'color=blue%2Cblack%2Cbrown',
|
||||
],
|
||||
// color=blue,black,brown
|
||||
'form nested array, explode off, required true' => [
|
||||
['foobar' => $array], 'color', 'array', 'form', false, true, 'color=blue%2Cblack%2Cbrown',
|
||||
],
|
||||
// R=100&G=200&B=150
|
||||
'form object, explode on, required true' => [
|
||||
$object, 'color', 'object', 'form', true, true, 'R=100&G=200&B=150',
|
||||
],
|
||||
// color=R,100,G,200,B,150
|
||||
'form object, explode off, required true' => [
|
||||
$object, 'color', 'object', 'form', false, true, 'color=R%2C100%2CG%2C200%2CB%2C150',
|
||||
],
|
||||
|
||||
// SPACE DELIMITED
|
||||
// color=blue
|
||||
'spaceDelimited primitive, explode off, required true' => [
|
||||
'blue', 'color', 'string', 'spaceDelimited', false, true, 'color=blue',
|
||||
],
|
||||
// color=blue
|
||||
'spaceDelimited primitive, explode on, required true' => [
|
||||
'blue', 'color', 'string', 'spaceDelimited', true, true, 'color=blue',
|
||||
],
|
||||
// color=blue%20black%20brown
|
||||
'spaceDelimited array, explode off, required true' => [
|
||||
$array, 'color', 'array', 'spaceDelimited', false, true, 'color=blue%20black%20brown',
|
||||
],
|
||||
// color=blue&color=black&color=brown
|
||||
'spaceDelimited array, explode on, required true' => [
|
||||
$array, 'color', 'array', 'spaceDelimited', true, true, 'color=blue&color=black&color=brown',
|
||||
],
|
||||
// color=R%20100%20G%20200%20B%20150
|
||||
// swagger editor gives color=R,100,G,200,B,150
|
||||
'spaceDelimited object, explode off, required true' => [
|
||||
$object, 'color', 'object', 'spaceDelimited', false, true, 'color=R%20100%20G%20200%20B%20150',
|
||||
],
|
||||
// R=100&G=200&B=150
|
||||
'spaceDelimited object, explode on, required true' => [
|
||||
$object, 'color', 'object', 'spaceDelimited', true, true, 'R=100&G=200&B=150',
|
||||
],
|
||||
|
||||
// PIPE DELIMITED
|
||||
// color=blue
|
||||
'pipeDelimited primitive, explode off, required true' => [
|
||||
'blue', 'color', 'string', 'pipeDelimited', false, true, 'color=blue',
|
||||
],
|
||||
// color=blue
|
||||
'pipeDelimited primitive, explode on, required true' => [
|
||||
'blue', 'color', 'string', 'pipeDelimited', true, true, 'color=blue',
|
||||
],
|
||||
// color=blue|black|brown
|
||||
'pipeDelimited array, explode off, required true' => [
|
||||
$array, 'color', 'array', 'pipeDelimited', false, true, 'color=blue%7Cblack%7Cbrown',
|
||||
],
|
||||
// color=blue&color=black&color=brown
|
||||
'pipeDelimited array, explode on, required true' => [
|
||||
$array, 'color', 'array', 'pipeDelimited', true, true, 'color=blue&color=black&color=brown',
|
||||
],
|
||||
// color=R|100|G|200|B|150
|
||||
// swagger editor gives color=R,100,G,200,B,150
|
||||
'pipeDelimited object, explode off, required true' => [
|
||||
$object, 'color', 'object', 'pipeDelimited', false, true, 'color=R%7C100%7CG%7C200%7CB%7C150',
|
||||
],
|
||||
// R=100&G=200&B=150
|
||||
'pipeDelimited object, explode on, required true' => [
|
||||
$object, 'color', 'object', 'pipeDelimited', true, true, 'R=100&G=200&B=150',
|
||||
],
|
||||
|
||||
// DEEP OBJECT
|
||||
// color=blue
|
||||
'deepObject primitive, explode off, required true' => [
|
||||
'blue', 'color', 'string', 'deepObject', false, true, 'color=blue',
|
||||
],
|
||||
'deepObject primitive, explode on, required true' => [
|
||||
'blue', 'color', 'string', 'deepObject', true, true, 'color=blue',
|
||||
],
|
||||
// color=blue,black,brown
|
||||
'deepObject array, explode off, required true' => [
|
||||
$array, 'color', 'array', 'deepObject', false, true, 'color=blue%2Cblack%2Cbrown',
|
||||
],
|
||||
// color=blue&color=black&color=brown
|
||||
'deepObject array, explode on, required true' => [
|
||||
$array, 'color', 'array', 'deepObject', true, true, 'color=blue&color=black&color=brown',
|
||||
],
|
||||
// color[R]=100&color[G]=200&color[B]=150
|
||||
'deepObject object, explode off, required true' => [
|
||||
$object, 'color', 'object', 'deepObject', false, true, 'color%5BR%5D=100&color%5BG%5D=200&color%5BB%5D=150',
|
||||
],
|
||||
// color[R]=100&color[G]=200&color[B]=150
|
||||
'deepObject object, explode on, required true' => [
|
||||
$object, 'color', 'object', 'deepObject', true, true, 'color%5BR%5D=100&color%5BG%5D=200&color%5BB%5D=150',
|
||||
],
|
||||
// filter[or][0][name]=John&filter[or][1][email]=john@doe.com
|
||||
'example from @nadar' => [
|
||||
[
|
||||
'or' =>
|
||||
[
|
||||
['name' => 'John'],
|
||||
['email' => 'john@doe.com'],
|
||||
],
|
||||
],
|
||||
'filter',
|
||||
'object',
|
||||
'deepObject',
|
||||
true,
|
||||
true,
|
||||
'filter%5Bor%5D%5B0%5D%5Bname%5D=John&filter%5Bor%5D%5B1%5D%5Bemail%5D=john%40doe.com'
|
||||
],
|
||||
'form DateTime object, explode on, required true' => [
|
||||
new DateTime('2021-10-06T20:17:16'), 'dateTime', '\DateTime', 'form', true, true, 'dateTime=2021-10-06T20%3A17%3A16%2B00%3A00',
|
||||
],
|
||||
'form null DateTime object, explode on, required true' => [
|
||||
null, 'dateTime', '\DateTime', 'form', true, true, 'dateTime=',
|
||||
],
|
||||
'form null DateTime object, explode on, required false' => [
|
||||
null, 'dateTime', '\DateTime', 'form', true, false, '',
|
||||
],
|
||||
'form 1 int, explode on, required false' => [
|
||||
1, 'field', 'int', 'form', true, false, 'field=1',
|
||||
],
|
||||
'form 0 int, explode on, required false' => [
|
||||
0, 'field', 'int', 'form', true, false, 'field=0',
|
||||
],
|
||||
'form 0 int, explode on, required true' => [
|
||||
0, 'field', 'int', 'form', true, true, 'field=0',
|
||||
],
|
||||
'form null int, explode on, required false' => [
|
||||
null, 'field', 'int', 'form', true, false, '',
|
||||
],
|
||||
'form null int, explode on, required true' => [
|
||||
null, 'field', 'int', 'form', true, true, 'field=',
|
||||
],
|
||||
'form 1 integer, explode on, required false' => [
|
||||
1, 'field', 'integer', 'form', true, false, 'field=1',
|
||||
],
|
||||
'form 0 integer, explode on, required false' => [
|
||||
0, 'field', 'integer', 'form', true, false, 'field=0',
|
||||
],
|
||||
'form 0 integer, explode on, required true' => [
|
||||
0, 'field', 'integer', 'form', true, true, 'field=0',
|
||||
],
|
||||
'form null integer, explode on, required false' => [
|
||||
null, 'field', 'integer', 'form', true, false, '',
|
||||
],
|
||||
'form null integer, explode on, required true' => [
|
||||
null, 'field', 'integer', 'form', true, true, 'field=',
|
||||
],
|
||||
'form 1.1 float, explode on, required false' => [
|
||||
1.1, 'field', 'float', 'form', true, false, 'field=1.1',
|
||||
],
|
||||
'form 0 float, explode on, required false' => [
|
||||
0, 'field', 'float', 'form', true, false, 'field=0',
|
||||
],
|
||||
'form 0.0 float, explode on, required false' => [
|
||||
0.0, 'field', 'float', 'form', true, false, 'field=0',
|
||||
],
|
||||
'form 0 float, explode on, required true' => [
|
||||
0, 'field', 'float', 'form', true, true, 'field=0',
|
||||
],
|
||||
'form 0.0 float, explode on, required true' => [
|
||||
0.0, 'field', 'float', 'form', true, true, 'field=0',
|
||||
],
|
||||
'form null float, explode on, required false' => [
|
||||
null, 'field', 'float', 'form', true, false, '',
|
||||
],
|
||||
'form null float, explode on, required true' => [
|
||||
null, 'field', 'float', 'form', true, true, 'field=',
|
||||
],
|
||||
'form 1.1 number, explode on, required false' => [
|
||||
1.1, 'field', 'number', 'form', true, false, 'field=1.1',
|
||||
],
|
||||
'form 0 number, explode on, required false' => [
|
||||
0, 'field', 'number', 'form', true, false, 'field=0',
|
||||
],
|
||||
'form 0.0 number, explode on, required false' => [
|
||||
0.0, 'field', 'number', 'form', true, false, 'field=0',
|
||||
],
|
||||
'form 0 number, explode on, required true' => [
|
||||
0, 'field', 'number', 'form', true, true, 'field=0',
|
||||
],
|
||||
'form 0.0 number, explode on, required true' => [
|
||||
0.0, 'field', 'number', 'form', true, true, 'field=0',
|
||||
],
|
||||
'form null number, explode on, required false' => [
|
||||
null, 'field', 'number', 'form', true, false, '',
|
||||
],
|
||||
'form null number, explode on, required true' => [
|
||||
null, 'field', 'number', 'form', true, true, 'field=',
|
||||
],
|
||||
'form true bool, explode on, required false' => [
|
||||
true, 'field', 'bool', 'form', true, false, 'field=1',
|
||||
],
|
||||
'form false bool, explode on, required false' => [
|
||||
false, 'field', 'bool', 'form', true, false, 'field=0',
|
||||
],
|
||||
'form empty bool, explode on, required false' => [
|
||||
null, 'field', 'bool', 'form', true, false, '',
|
||||
],
|
||||
'form empty bool, explode on, required true' => [
|
||||
null, 'field', 'bool', 'form', true, true, 'field=',
|
||||
],
|
||||
# Entries for "boolean" type are already covered in the beginning of this provider
|
||||
'form 1 bool, explode on, required false' => [
|
||||
1, 'field', 'bool', 'form', true, false, 'field=1',
|
||||
],
|
||||
'form 0 bool, explode on, required false' => [
|
||||
0, 'field', 'bool', 'form', true, false, 'field=0',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ObjectSerializer::toQueryValue
|
||||
* @dataProvider provideDeepObjects
|
||||
*/
|
||||
public function testDeepObjectStyleQueryParam(
|
||||
$data,
|
||||
$paramName,
|
||||
$expected
|
||||
): void {
|
||||
$value = ObjectSerializer::buildQuery(ObjectSerializer::toQueryValue($data, $paramName, 'object', 'deepObject', true));
|
||||
parse_str($value, $result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deep Objects provider
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDeepObjects(): array
|
||||
{
|
||||
return [
|
||||
/** example @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-examples */
|
||||
'example OpenAPISpec doc' => [
|
||||
['R' => 100, 'G' => 200, 'B' => 150],
|
||||
'color',
|
||||
[
|
||||
'color' => [
|
||||
'R' => 100,
|
||||
'G' => 200,
|
||||
'B' => 150,
|
||||
],
|
||||
],
|
||||
],
|
||||
/** example @see https://swagger.io/docs/specification/serialization/ */
|
||||
'example Swagger doc' => [
|
||||
['role' => 'admin', 'firstName' => 'Alex'],
|
||||
'id',
|
||||
[
|
||||
'id' => [
|
||||
'role' => 'admin',
|
||||
'firstName' => 'Alex',
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideToStringInput
|
||||
*/
|
||||
public function testToString($input, string $expected): void
|
||||
{
|
||||
$result = ObjectSerializer::toString($input);
|
||||
|
||||
$this->assertSame($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* toString() input provider
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideToStringInput(): array
|
||||
{
|
||||
return [
|
||||
'int' => [
|
||||
'input' => 1,
|
||||
'expected' => '1',
|
||||
],
|
||||
'int 0' => [
|
||||
'input' => 0,
|
||||
'expected' => '0',
|
||||
],
|
||||
'false' => [
|
||||
'input' => false,
|
||||
'expected' => 'false',
|
||||
],
|
||||
'true' => [
|
||||
'input' => true,
|
||||
'expected' => 'true',
|
||||
],
|
||||
'some string' => [
|
||||
'input' => 'some string',
|
||||
'expected' => 'some string',
|
||||
],
|
||||
'a date' => [
|
||||
'input' => new DateTime('14-04-2022'),
|
||||
'expected' => '2022-04-14T00:00:00+00:00',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ObjectSerializer::toQueryValue
|
||||
* @dataProvider provideQueryParamsWithStringBooleanFormatForQueryString
|
||||
*/
|
||||
public function testToQueryValueWithStringBooleanFormatForQueryString(
|
||||
$data,
|
||||
string $paramName,
|
||||
string $openApiType,
|
||||
string $style,
|
||||
bool $explode,
|
||||
bool $required,
|
||||
$expected
|
||||
): void
|
||||
{
|
||||
$config = new Configuration();
|
||||
$config->setBooleanFormatForQueryString(Configuration::BOOLEAN_FORMAT_STRING);
|
||||
$config::setDefaultConfiguration($config);
|
||||
|
||||
$value = ObjectSerializer::toQueryValue($data, $paramName, $openApiType, $style, $explode, $required);
|
||||
$query = ObjectSerializer::buildQuery($value);
|
||||
$this->assertEquals($expected, $query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query Params with string boolean format provider
|
||||
*
|
||||
* @return array[]
|
||||
*/
|
||||
public function provideQueryParamsWithStringBooleanFormatForQueryString(): array
|
||||
{
|
||||
return [
|
||||
// style form
|
||||
// skipValidation
|
||||
'form boolean, required false' => [
|
||||
false, 'skipValidation', 'boolean', 'form', true, false, 'skipValidation=false',
|
||||
],
|
||||
'form empty boolean, required false' => [
|
||||
null, 'skipValidation', 'boolean', 'form', true, false, '',
|
||||
],
|
||||
'form empty boolean, required true' => [
|
||||
null, 'skipValidation', 'boolean', 'form', true, true, 'skipValidation=',
|
||||
],
|
||||
'form true boolean, required true' => [
|
||||
true, 'skipValidation', 'boolean', 'form', true, false, 'skipValidation=true',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ObjectSerializer::buildQuery
|
||||
* @dataProvider provideBuildQuery
|
||||
*/
|
||||
public function testToBuildQuery(
|
||||
string $expected,
|
||||
array $data,
|
||||
string|null $booleanFormatString = null,
|
||||
): void
|
||||
{
|
||||
$config = new Configuration();
|
||||
if ($booleanFormatString !== null) {
|
||||
$config->setBooleanFormatForQueryString($booleanFormatString);
|
||||
}
|
||||
$config::setDefaultConfiguration($config);
|
||||
|
||||
$query = ObjectSerializer::buildQuery($data);
|
||||
$this->assertEquals($expected, $query);
|
||||
}
|
||||
|
||||
/** @return Generator<string, array{string, array<string, mixed>, 2?: Configuration::BOOLEAN_FORMAT_*}> */
|
||||
public function provideBuildQuery(): Generator
|
||||
{
|
||||
yield 'true as int' => ['foo=1', ['foo' => true]];
|
||||
yield 'true as int as default' => ['foo=1', ['foo' => true], Configuration::BOOLEAN_FORMAT_INT];
|
||||
yield 'false as int' => ['foo=0', ['foo' => false]];
|
||||
yield 'false as int as default' => ['foo=0', ['foo' => false], Configuration::BOOLEAN_FORMAT_INT];
|
||||
yield 'true as string' => ['foo=true', ['foo' => true], Configuration::BOOLEAN_FORMAT_STRING];
|
||||
yield 'false as string' => ['foo=false', ['foo' => false], Configuration::BOOLEAN_FORMAT_STRING];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test array to class deserialization.
|
||||
*
|
||||
* @covers ObjectSerializer::deserialize
|
||||
*
|
||||
* @see https://github.com/OpenAPITools/openapi-generator/pull/12849#issuecomment-1186130098
|
||||
*/
|
||||
public function testArrayGivenAsObjectForDeserialize(): void
|
||||
{
|
||||
$data = [
|
||||
'name' => 'Pet Name',
|
||||
'status' => Pet::STATUS_AVAILABLE,
|
||||
'tags' => [
|
||||
['name' => 'Tag Name'],
|
||||
]
|
||||
];
|
||||
|
||||
/** @var Pet $pet */
|
||||
$pet = ObjectSerializer::deserialize($data, Pet::class);
|
||||
$this->assertEquals('Pet Name', $pet->getName());
|
||||
$this->assertEquals(Pet::STATUS_AVAILABLE, $pet->getStatus());
|
||||
|
||||
$tags = $pet->getTags();
|
||||
$this->assertIsArray($tags);
|
||||
|
||||
$tag = $tags[0];
|
||||
$this->assertInstanceOf(Tag::class, $tag);
|
||||
}
|
||||
}
|
@ -1,150 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class OrderApiTest extends TestCase
|
||||
{
|
||||
|
||||
// add a new pet (id 10005) to ensure the pet object is available for all the tests
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
// for error reporting (need to run with php5.3 to get no warning)
|
||||
//ini_set('display_errors', 1);
|
||||
//error_reporting(~0);
|
||||
}
|
||||
|
||||
// test get inventory
|
||||
public function testOrderEnum()
|
||||
{
|
||||
$this->assertSame(Model\Order::STATUS_PLACED, "placed");
|
||||
$this->assertSame(Model\Order::STATUS_APPROVED, "approved");
|
||||
}
|
||||
|
||||
// test get inventory
|
||||
public function testOrder()
|
||||
{
|
||||
// initialize the API client
|
||||
$order = new Model\Order();
|
||||
|
||||
$order->setStatus("placed");
|
||||
$this->assertSame("placed", $order->getStatus());
|
||||
}
|
||||
|
||||
public function testOrderException()
|
||||
{
|
||||
// initialize the API client
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$order = new Model\Order();
|
||||
$order->setStatus("invalid_value");
|
||||
}
|
||||
|
||||
// test deserialization of order
|
||||
public function testDeserializationOfOrder()
|
||||
{
|
||||
$order_json = <<<ORDER
|
||||
{
|
||||
"id": 10,
|
||||
"petId": 20,
|
||||
"quantity": 30,
|
||||
"shipDate": "2015-08-22T07:13:36.613Z",
|
||||
"status": "placed",
|
||||
"complete": false
|
||||
}
|
||||
ORDER;
|
||||
$order = ObjectSerializer::deserialize(
|
||||
json_decode($order_json),
|
||||
'OpenAPI\Client\Model\Order'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('OpenAPI\Client\Model\Order', $order);
|
||||
$this->assertSame(10, $order->getId());
|
||||
$this->assertSame(20, $order->getPetId());
|
||||
$this->assertSame(30, $order->getQuantity());
|
||||
$this->assertTrue(new \DateTime("2015-08-22T07:13:36.613Z") == $order->getShipDate());
|
||||
$this->assertSame("placed", $order->getStatus());
|
||||
$this->assertSame(false, $order->getComplete());
|
||||
}
|
||||
|
||||
// test deserialization of array of array of order
|
||||
public function testDeserializationOfArrayOfArrayOfOrder()
|
||||
{
|
||||
$order_json = <<<ORDER
|
||||
[[{
|
||||
"id": 10,
|
||||
"petId": 20,
|
||||
"quantity": 30,
|
||||
"shipDate": "2015-08-22T07:13:36.613Z",
|
||||
"status": "placed",
|
||||
"complete": false
|
||||
}]]
|
||||
ORDER;
|
||||
$order = ObjectSerializer::deserialize(
|
||||
json_decode($order_json),
|
||||
'OpenAPI\Client\Model\Order[][]'
|
||||
);
|
||||
|
||||
$this->assertArrayHasKey(0, $order);
|
||||
$this->assertArrayHasKey(0, $order[0]);
|
||||
$_order = $order[0][0];
|
||||
$this->assertInstanceOf('OpenAPI\Client\Model\Order', $_order);
|
||||
$this->assertSame(10, $_order->getId());
|
||||
$this->assertSame(20, $_order->getPetId());
|
||||
$this->assertSame(30, $_order->getQuantity());
|
||||
$this->assertTrue(new \DateTime("2015-08-22T07:13:36.613Z") == $_order->getShipDate());
|
||||
$this->assertSame("placed", $_order->getStatus());
|
||||
$this->assertSame(false, $_order->getComplete());
|
||||
}
|
||||
|
||||
// test deserialization of map of map of order
|
||||
public function testDeserializationOfMapOfMapOfOrder()
|
||||
{
|
||||
$order_json = <<<ORDER
|
||||
{
|
||||
"test": {
|
||||
"test2": {
|
||||
"id": 10,
|
||||
"petId": 20,
|
||||
"quantity": 30,
|
||||
"shipDate": "2015-08-22T07:13:36.613Z",
|
||||
"status": "placed",
|
||||
"complete": false
|
||||
}
|
||||
}
|
||||
}
|
||||
ORDER;
|
||||
// Legacy.
|
||||
$order = ObjectSerializer::deserialize(
|
||||
json_decode($order_json),
|
||||
'map[string,map[string,\OpenAPI\Client\Model\Order]]'
|
||||
);
|
||||
|
||||
$this->assertArrayHasKey('test', $order);
|
||||
$this->assertArrayHasKey('test2', $order['test']);
|
||||
$_order = $order['test']['test2'];
|
||||
$this->assertInstanceOf('OpenAPI\Client\Model\Order', $_order);
|
||||
$this->assertSame(10, $_order->getId());
|
||||
$this->assertSame(20, $_order->getPetId());
|
||||
$this->assertSame(30, $_order->getQuantity());
|
||||
$this->assertTrue(new \DateTime("2015-08-22T07:13:36.613Z") == $_order->getShipDate());
|
||||
$this->assertSame("placed", $_order->getStatus());
|
||||
$this->assertSame(false, $_order->getComplete());
|
||||
|
||||
$order = ObjectSerializer::deserialize(
|
||||
json_decode($order_json),
|
||||
'array<string,array<string,\OpenAPI\Client\Model\Order>>'
|
||||
);
|
||||
|
||||
$this->assertArrayHasKey('test', $order);
|
||||
$this->assertArrayHasKey('test2', $order['test']);
|
||||
$_order = $order['test']['test2'];
|
||||
$this->assertInstanceOf('OpenAPI\Client\Model\Order', $_order);
|
||||
$this->assertSame(10, $_order->getId());
|
||||
$this->assertSame(20, $_order->getPetId());
|
||||
$this->assertSame(30, $_order->getQuantity());
|
||||
$this->assertTrue(new \DateTime("2015-08-22T07:13:36.613Z") == $_order->getShipDate());
|
||||
$this->assertSame("placed", $_order->getStatus());
|
||||
$this->assertSame(false, $_order->getComplete());
|
||||
}
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use OpenAPI\Client\Model\EnumTest;
|
||||
use OpenAPI\Client\Model\OuterEnum;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class OuterEnumTest extends TestCase
|
||||
{
|
||||
public function testDeserialize()
|
||||
{
|
||||
$result = ObjectSerializer::deserialize(
|
||||
"placed",
|
||||
OuterEnum::class
|
||||
);
|
||||
|
||||
$this->assertIsString($result);
|
||||
$this->assertEquals('placed', $result);
|
||||
}
|
||||
|
||||
public function testDeserializeInvalidValue()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Invalid value for enum');
|
||||
ObjectSerializer::deserialize(
|
||||
"lkjfalgkdfjg",
|
||||
OuterEnum::class
|
||||
);
|
||||
}
|
||||
|
||||
public function testDeserializeNested()
|
||||
{
|
||||
$json = '{
|
||||
"enum_string": "UPPER",
|
||||
"enum_integer": -1,
|
||||
"enum_number": -1.2,
|
||||
"outerEnum": "approved"
|
||||
}';
|
||||
|
||||
/** * @var EnumTest $result */
|
||||
$result = ObjectSerializer::deserialize(
|
||||
json_decode($json),
|
||||
EnumTest::class
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(EnumTest::class, $result);
|
||||
$this->assertEquals('approved', $result->getOuterEnum());
|
||||
}
|
||||
|
||||
public function testSanitize()
|
||||
{
|
||||
$json = "placed";
|
||||
|
||||
$result = ObjectSerializer::sanitizeForSerialization(
|
||||
$json
|
||||
);
|
||||
|
||||
$this->assertIsString($result);
|
||||
}
|
||||
|
||||
public function testSanitizeNested()
|
||||
{
|
||||
$input = new EnumTest([
|
||||
'enum_string' => 'UPPER',
|
||||
'enum_integer' => -1,
|
||||
'enum_number' => -1.2,
|
||||
'outer_enum' => 'approved'
|
||||
]);
|
||||
|
||||
$result = ObjectSerializer::sanitizeForSerialization(
|
||||
$input
|
||||
);
|
||||
|
||||
$this->assertIsObject($result);
|
||||
$this->assertInstanceOf(\stdClass::class, $result);
|
||||
|
||||
$this->assertIsString($result->outerEnum);
|
||||
$this->assertEquals('approved', $result->outerEnum);
|
||||
}
|
||||
|
||||
public function testSanitizeNestedInvalidValue()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Invalid value for enum');
|
||||
$input = new EnumTest([
|
||||
'enum_string' => 'UPPER',
|
||||
'enum_integer' => -1,
|
||||
'enum_number' => -1.2,
|
||||
'outer_enum' => 'invalid_value'
|
||||
]);
|
||||
|
||||
ObjectSerializer::sanitizeForSerialization($input);
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use OpenAPI\Client\Api\FakeApi;
|
||||
use OpenAPI\Client\Api\UserApi;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
require_once __DIR__ . '/FakeHttpClient.php';
|
||||
|
||||
class ParametersTest extends TestCase
|
||||
{
|
||||
/** @var FakeHttpClient */
|
||||
private $fakeHttpClient;
|
||||
/** @var FakeApi */
|
||||
private $fakeApi;
|
||||
/** @var UserApi */
|
||||
private $userApi;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->fakeHttpClient = new FakeHttpClient();
|
||||
$this->fakeApi = new Api\FakeApi($this->fakeHttpClient);
|
||||
$this->userApi = new Api\UserApi($this->fakeHttpClient);
|
||||
}
|
||||
|
||||
public function testHeaderParam()
|
||||
{
|
||||
$this->fakeApi->testEnumParameters([], 'something');
|
||||
|
||||
$request = $this->fakeHttpClient->getLastRequest();
|
||||
$headers = $request->getHeaders();
|
||||
|
||||
$this->assertArrayHasKey('enum_header_string', $headers);
|
||||
$this->assertEquals(['something'], $headers['enum_header_string']);
|
||||
}
|
||||
|
||||
public function testHeaderParamCollection()
|
||||
{
|
||||
$this->fakeApi->testEnumParameters(['string1', 'string2']);
|
||||
|
||||
$request = $this->fakeHttpClient->getLastRequest();
|
||||
$headers = $request->getHeaders();
|
||||
|
||||
$this->assertArrayHasKey('enum_header_string_array', $headers);
|
||||
$this->assertEquals(['string1,string2'], $headers['enum_header_string_array']);
|
||||
}
|
||||
|
||||
public function testInlineAdditionalProperties()
|
||||
{
|
||||
$param = new \stdClass();
|
||||
$param->foo = 'bar';
|
||||
$this->fakeApi->testInlineAdditionalProperties(array($param));
|
||||
|
||||
$request = $this->fakeHttpClient->getLastRequest();
|
||||
$this->assertSame('[{"foo":"bar"}]', $request->getBody()->getContents());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://github.com/OpenAPITools/openapi-generator/pull/11225
|
||||
* @dataProvider provideQueryParameters
|
||||
*/
|
||||
public function testQueryParameterCollectionFormatRequest($pipe, $ioutil, $http, $url, $context, $allow_empty, $language, $expected)
|
||||
{
|
||||
$request = $this->fakeApi->testQueryParameterCollectionFormatRequest($pipe, $ioutil, $http, $url, $context, $allow_empty, $language);
|
||||
$this->assertEquals($expected, urldecode($request->getUri()->getQuery()));
|
||||
}
|
||||
|
||||
public function provideQueryParameters()
|
||||
{
|
||||
$array = ['blue', 'black', 'brown'];
|
||||
$object = ['R' => 100, 'G' => 200, 'B' => 150];
|
||||
return [
|
||||
[
|
||||
$array, $array, $array, $array, $array, 'blue', $object, 'pipe=blue|black|brown&ioutil=blue,black,brown&http=blue black brown&url=blue,black,brown&context=blue&context=black&context=brown&R=100&G=200&B=150&allowEmpty=blue',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
// missing example for collection path param in config
|
||||
// public function testPathParamCollection()
|
||||
// {
|
||||
// $this->userApi->getUserByNameWithHttpInfo(['aa', 'bb']);
|
||||
// $request = $this->fakeHttpClient->getLastRequest();
|
||||
// $this->assertEquals('user/aa,bb', urldecode($request->getUri()->getPath()));
|
||||
// }
|
||||
}
|
@ -1,387 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use OpenAPI\Client\Api\PetApi;
|
||||
use OpenAPI\Client\Model\ApiResponse;
|
||||
use OpenAPI\Client\Model\Pet;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit\Framework\Assert;
|
||||
|
||||
require_once __DIR__ . '/FakeHttpClient.php';
|
||||
|
||||
class PetApiTest extends TestCase
|
||||
{
|
||||
|
||||
/** @var PetApi */
|
||||
private $api;
|
||||
|
||||
// add a new pet (id 10005) to ensure the pet object is available for all the tests
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
// increase memory limit to avoid fatal error due to findPetByStatus
|
||||
// returning a lot of data
|
||||
ini_set('memory_limit', '256M');
|
||||
|
||||
// enable debugging
|
||||
//Configuration::$debug = true;
|
||||
|
||||
// new pet
|
||||
$newPetId = 10005;
|
||||
$newPet = new Model\Pet;
|
||||
$newPet->setId($newPetId);
|
||||
$newPet->setName("PHP Unit Test");
|
||||
$newPet->setPhotoUrls(["http://test_php_unit_test.com"]);
|
||||
// new tag
|
||||
$tag = new Model\Tag;
|
||||
$tag->setId($newPetId); // use the same id as pet
|
||||
$tag->setName("test php tag");
|
||||
// new category
|
||||
$category = new Model\Category;
|
||||
$category->setId($newPetId); // use the same id as pet
|
||||
$category->setName("test php category");
|
||||
|
||||
$newPet->setTags(array($tag));
|
||||
$newPet->setCategory($category);
|
||||
|
||||
$config = new Configuration();
|
||||
$petApi = new Api\PetApi(null, $config);
|
||||
|
||||
// add a new pet (model)
|
||||
list(, $status) = $petApi->addPetWithHttpInfo($newPet);
|
||||
Assert::assertEquals(200, $status);
|
||||
}
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->api = new Api\PetApi();
|
||||
}
|
||||
|
||||
public function testGetPetById()
|
||||
{
|
||||
$petId = 10005;
|
||||
|
||||
$pet = $this->api->getPetById($petId);
|
||||
$this->assertSame($petId, $pet->getId());
|
||||
$this->assertSame('PHP Unit Test', $pet->getName());
|
||||
$this->assertSame('http://test_php_unit_test.com', $pet->getPhotoUrls()[0]);
|
||||
$this->assertSame($petId, $pet->getCategory()->getId());
|
||||
$this->assertSame('test php category', $pet->getCategory()->getName());
|
||||
$this->assertSame($petId, $pet->getTags()[0]->getId());
|
||||
$this->assertSame('test php tag', $pet->getTags()[0]->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* comment out as we've removed invalid endpoints from the spec, we'll introduce something
|
||||
* similar in the future when we've time to update the petstore server
|
||||
*
|
||||
* // test getPetById with a Pet object (id 10005)
|
||||
* public function testGetPetByIdInObject()
|
||||
* {
|
||||
* // initialize the API client without host
|
||||
* $pet_id = 10005; // ID of pet that needs to be fetched
|
||||
* $pet_api = new Api\PetApi();
|
||||
* $pet_api->getApiClient()->getConfig()->setApiKey('api_key', '111222333444555');
|
||||
* // return Pet (inline model)
|
||||
* $response = $pet_api->getPetByIdInObject($pet_id);
|
||||
* $this->assertInstanceOf('OpenAPI\Client\Model\InlineResponse200', $response);
|
||||
* $this->assertSame($response->getId(), $pet_id);
|
||||
* $this->assertSame($response->getName(), 'PHP Unit Test');
|
||||
* $this->assertSame($response->getPhotoUrls()[0], 'http://test_php_unit_test.com');
|
||||
*
|
||||
* // category is type "object"
|
||||
* $this->assertInternalType('array', $response->getCategory());
|
||||
* $this->assertSame($response->getCategory()['id'], $pet_id);
|
||||
* $this->assertSame($response->getCategory()['name'], 'test php category');
|
||||
*
|
||||
* $this->assertSame($response->getTags()[0]->getId(), $pet_id);
|
||||
* $this->assertSame($response->getTags()[0]->getName(), 'test php tag');
|
||||
* }
|
||||
*/
|
||||
|
||||
// test getPetByIdWithHttpInfo with a Pet object (id 10005)
|
||||
public function testGetPetByIdWithHttpInfo()
|
||||
{
|
||||
// initialize the API client without host
|
||||
$petId = 10005; // ID of pet that needs to be fetched
|
||||
|
||||
/** @var $pet Pet */
|
||||
list($pet, $status_code, $response_headers) = $this->api->getPetByIdWithHttpInfo($petId);
|
||||
$this->assertSame($petId, $pet->getId());
|
||||
$this->assertSame('PHP Unit Test', $pet->getName());
|
||||
$this->assertSame($petId, $pet->getCategory()->getId());
|
||||
$this->assertSame('test php category', $pet->getCategory()->getName());
|
||||
$this->assertSame($petId, $pet->getTags()[0]->getId());
|
||||
$this->assertSame('test php tag', $pet->getTags()[0]->getName());
|
||||
$this->assertSame(200, $status_code);
|
||||
$this->assertSame(['application/json'], $response_headers['Content-Type']);
|
||||
}
|
||||
|
||||
public function testFindPetByStatus()
|
||||
{
|
||||
$response = $this->api->findPetsByStatus(array('available'));
|
||||
$this->assertGreaterThan(0, count($response)); // at least one object returned
|
||||
|
||||
$this->assertInstanceOf(Pet::class, $response[0]); // verify the object is Pet
|
||||
foreach ($response as $pet) {
|
||||
$this->assertSame('available', $pet->getStatus());
|
||||
}
|
||||
|
||||
$response = $this->api->findPetsByStatus(array('unknown_and_incorrect_status'));
|
||||
$this->assertCount(0, $response);
|
||||
}
|
||||
|
||||
public function testUpdatePet()
|
||||
{
|
||||
$petId = 10001;
|
||||
$updatedPet = new Model\Pet;
|
||||
$updatedPet->setId($petId);
|
||||
$updatedPet->setName('updatePet');
|
||||
$updatedPet->setStatus('pending');
|
||||
$updatedPet->setPhotoUrls(array('http://a.com'));
|
||||
$result = $this->api->updatePet($updatedPet);
|
||||
$this->assertNull($result);
|
||||
|
||||
// verify updated Pet
|
||||
$result = $this->api->getPetById($petId);
|
||||
$this->assertSame($petId, $result->getId());
|
||||
$this->assertSame('pending', $result->getStatus());
|
||||
$this->assertSame('updatePet', $result->getName());
|
||||
}
|
||||
|
||||
// test updatePetWithFormWithHttpInfo and verify by the "name" of the response
|
||||
public function testUpdatePetWithFormWithHttpInfo()
|
||||
{
|
||||
$petId = 10001; // ID of pet that needs to be fetched
|
||||
|
||||
// update Pet (form)
|
||||
list($update_response, $status_code, $http_headers) = $this->api->updatePetWithFormWithHttpInfo(
|
||||
$petId,
|
||||
'update pet with form with http info'
|
||||
);
|
||||
// return nothing (void)
|
||||
$this->assertNull($update_response);
|
||||
$this->assertSame(200, $status_code);
|
||||
$this->assertSame(['application/json'], $http_headers['Content-Type']);
|
||||
$response = $this->api->getPetById($petId);
|
||||
$this->assertSame($petId, $response->getId());
|
||||
$this->assertSame('update pet with form with http info', $response->getName());
|
||||
}
|
||||
|
||||
// test updatePetWithForm and verify by the "name" and "status" of the response
|
||||
public function testUpdatePetWithForm()
|
||||
{
|
||||
$pet_id = 10001; // ID of pet that needs to be fetched
|
||||
$result = $this->api->updatePetWithForm($pet_id, 'update pet with form', 'sold');
|
||||
// return nothing (void)
|
||||
$this->assertNull($result);
|
||||
|
||||
$response = $this->api->getPetById($pet_id);
|
||||
$this->assertSame($pet_id, $response->getId());
|
||||
$this->assertSame('update pet with form', $response->getName());
|
||||
$this->assertSame('sold', $response->getStatus());
|
||||
}
|
||||
|
||||
// test addPet and verify by the "id" and "name" of the response
|
||||
public function testAddPet()
|
||||
{
|
||||
$new_pet_id = 10005;
|
||||
$newPet = new Model\Pet;
|
||||
$newPet->setId($new_pet_id);
|
||||
$newPet->setName("PHP Unit Test 2");
|
||||
$newPet->setPhotoUrls(array("http://a.com"));
|
||||
|
||||
// add a new pet (model)
|
||||
$add_response = $this->api->addPet($newPet);
|
||||
// return nothing (void)
|
||||
$this->assertNull($add_response);
|
||||
|
||||
// verify added Pet
|
||||
$response = $this->api->getPetById($new_pet_id);
|
||||
$this->assertSame($new_pet_id, $response->getId());
|
||||
$this->assertSame('PHP Unit Test 2', $response->getName());
|
||||
$this->assertSame(array("http://a.com"), $response->getPhotoUrls());
|
||||
}
|
||||
|
||||
/*
|
||||
* comment out as we've removed invalid endpoints from the spec, we'll introduce something
|
||||
* similar in the future when we've time to update the petstore server
|
||||
*
|
||||
// test addPetUsingByteArray and verify by the "id" and "name" of the response
|
||||
public function testAddPetUsingByteArray()
|
||||
{
|
||||
// initialize the API client
|
||||
$config = (new Configuration())->setHost('http://petstore.swagger.io/v2');
|
||||
$api_client = new ApiClient($config);
|
||||
|
||||
$new_pet_id = 10005;
|
||||
$new_pet = new Model\Pet;
|
||||
$new_pet->setId($new_pet_id);
|
||||
$new_pet->setName("PHP Unit Test 3");
|
||||
// new tag
|
||||
$tag= new Model\Tag;
|
||||
$tag->setId($new_pet_id); // use the same id as pet
|
||||
$tag->setName("test php tag");
|
||||
// new category
|
||||
$category = new Model\Category;
|
||||
$category->setId($new_pet_id); // use the same id as pet
|
||||
$category->setName("test php category");
|
||||
|
||||
$new_pet->setTags(array($tag));
|
||||
$new_pet->setCategory($category);
|
||||
|
||||
$pet_api = new Api\PetApi($api_client);
|
||||
// add a new pet (model)
|
||||
$object_serializer = new ObjectSerializer();
|
||||
$pet_json_string = json_encode($object_serializer->sanitizeForSerialization($new_pet));
|
||||
$add_response = $pet_api->addPetUsingByteArray($pet_json_string);
|
||||
// return nothing (void)
|
||||
$this->assertSame($add_response, NULL);
|
||||
// verify added Pet
|
||||
$response = $pet_api->getPetById($new_pet_id);
|
||||
$this->assertSame($response->getId(), $new_pet_id);
|
||||
$this->assertSame($response->getName(), 'PHP Unit Test 3');
|
||||
}
|
||||
*/
|
||||
|
||||
// test upload file
|
||||
public function testUploadFile()
|
||||
{
|
||||
// upload file
|
||||
$pet_id = 10001;
|
||||
$response = $this->api->uploadFile($pet_id, 'test meta', __DIR__ . '/../composer.json');
|
||||
// return ApiResponse
|
||||
$this->assertInstanceOf(ApiResponse::class, $response);
|
||||
}
|
||||
|
||||
/*
|
||||
* comment out as we've removed invalid endpoints from the spec, we'll introduce something
|
||||
* similar in the future when we've time to update the petstore server
|
||||
*
|
||||
// test byte array response
|
||||
public function testGetPetByIdWithByteArray()
|
||||
{
|
||||
// initialize the API client
|
||||
$config = new Configuration();
|
||||
$config->setHost('http://petstore.swagger.io/v2');
|
||||
$api_client = new APIClient($config);
|
||||
$pet_api = new Api\PetApi($api_client);
|
||||
// test getPetByIdWithByteArray
|
||||
$pet_id = 10005;
|
||||
$bytes = $pet_api->petPetIdtestingByteArraytrueGet($pet_id);
|
||||
$json = json_decode($bytes, true);
|
||||
|
||||
$this->assertInternalType("string", $bytes);
|
||||
|
||||
$this->assertSame($json['id'], $pet_id);
|
||||
// not testing name as it's tested by addPetUsingByteArray
|
||||
//$this->assertSame($json['name'], 'PHP Unit Test');
|
||||
$this->assertSame($json['category']['id'], $pet_id);
|
||||
$this->assertSame($json['category']['name'], 'test php category');
|
||||
$this->assertSame($json['tags'][0]['id'], $pet_id);
|
||||
$this->assertSame($json['tags'][0]['name'], 'test php tag');
|
||||
}
|
||||
*/
|
||||
|
||||
// test inheritance in the model
|
||||
public function testInheritance()
|
||||
{
|
||||
$new_dog = new Model\Dog;
|
||||
// the object should be an instance of the derived class
|
||||
$this->assertInstanceOf('OpenAPI\Client\Model\Dog', $new_dog);
|
||||
// the object should also be an instance of the parent class
|
||||
$this->assertInstanceOf('OpenAPI\Client\Model\Animal', $new_dog);
|
||||
}
|
||||
|
||||
// test inheritance constructor is working with data
|
||||
// initialization
|
||||
public function testInheritanceConstructorDataInitialization()
|
||||
{
|
||||
// initialize the object with data in the constructor
|
||||
$data = array(
|
||||
'class_name' => 'Dog',
|
||||
'breed' => 'Great Dane'
|
||||
);
|
||||
$new_dog = new Model\Dog($data);
|
||||
|
||||
// the property on the derived class should be set
|
||||
$this->assertSame('Great Dane', $new_dog->getBreed());
|
||||
// the property on the parent class should be set
|
||||
$this->assertSame('Dog', $new_dog->getClassName());
|
||||
}
|
||||
|
||||
// test if discriminator is initialized automatically
|
||||
public function testDiscriminatorInitialization()
|
||||
{
|
||||
$new_dog = new Model\Dog();
|
||||
$this->assertSame('Dog', $new_dog->getClassName());
|
||||
}
|
||||
|
||||
// test if ArrayAccess interface works
|
||||
public function testArrayStuff()
|
||||
{
|
||||
// create an array of Animal
|
||||
$farm = array();
|
||||
|
||||
// add some animals to the farm to make sure the ArrayAccess
|
||||
// interface works
|
||||
$farm[] = new Model\Dog();
|
||||
$farm[] = new Model\Cat();
|
||||
$farm[] = new Model\Animal();
|
||||
|
||||
// assert we can look up the animals in the farm by array
|
||||
// indices (let's try a random order)
|
||||
$this->assertInstanceOf('OpenAPI\Client\Model\Cat', $farm[1]);
|
||||
$this->assertInstanceOf('OpenAPI\Client\Model\Dog', $farm[0]);
|
||||
$this->assertInstanceOf('OpenAPI\Client\Model\Animal', $farm[2]);
|
||||
|
||||
// let's try to `foreach` the animals in the farm and let's
|
||||
// try to use the objects we loop through
|
||||
foreach ($farm as $animal) {
|
||||
$this->assertContains($animal->getClassName(), array('Dog', 'Cat', 'Animal'));
|
||||
$this->assertInstanceOf('OpenAPI\Client\Model\Animal', $animal);
|
||||
}
|
||||
}
|
||||
|
||||
// test if default values works
|
||||
public function testDefaultValues()
|
||||
{
|
||||
// add some animals to the farm to make sure the ArrayAccess
|
||||
// interface works
|
||||
$dog = new Model\Dog();
|
||||
$animal = new Model\Animal();
|
||||
|
||||
// assert we can look up the animals in the farm by array
|
||||
// indices (let's try a random order)
|
||||
$this->assertSame('red', $dog->getColor());
|
||||
$this->assertSame('red', $animal->getColor());
|
||||
}
|
||||
|
||||
/**
|
||||
* test invalid argument
|
||||
*/
|
||||
public function testInvalidArgument()
|
||||
{
|
||||
// the argument is required, and we must specify one or some from 'available', 'pending', 'sold'
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Missing the required parameter $status when calling findPetsByStatus');
|
||||
$this->api->findPetsByStatus([]);
|
||||
}
|
||||
|
||||
// Disabled as currently we don't have any endpoint that would return file
|
||||
// For testing I just replaced url and return type in Api method.
|
||||
// public function testDownloadingLargeFile()
|
||||
// {
|
||||
// $petId = 10005;
|
||||
// $config = new Configuration();
|
||||
// $config->setHost('https://getcomposer.org');
|
||||
// $api = new PetApi(new Client(), $config);
|
||||
// $result = $api->getPetById($petId);
|
||||
// $this->assertInstanceOf(\SplFileObject::class, $result);
|
||||
// var_dump([
|
||||
// 'peak mem (MiB)' => memory_get_peak_usage(true)/1024/1024,
|
||||
// 'file size (MiB)' => $result->getSize()/1024/1024,
|
||||
// 'path' => sys_get_temp_dir() . '/' . $result->getFilename()
|
||||
// ]);
|
||||
// }
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use OpenAPI\Client\Api\FakeApi;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
require_once __DIR__ . '/FakeHttpClient.php';
|
||||
|
||||
class RequestTest extends TestCase
|
||||
{
|
||||
/** @var FakeApi */
|
||||
private $api;
|
||||
/** @var FakeHttpClient */
|
||||
private $fakeClient;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->fakeClient = new FakeHttpClient();
|
||||
$this->api = new Api\FakeApi($this->fakeClient);
|
||||
}
|
||||
|
||||
public function testFormDataEncodingToJson()
|
||||
{
|
||||
$this->api->testJsonFormData('value', 'value2');
|
||||
|
||||
$request = $this->fakeClient->getLastRequest();
|
||||
$contentType = $request->getHeader('Content-Type');
|
||||
$this->assertEquals(['application/x-www-form-urlencoded'], $contentType);
|
||||
|
||||
$requestContent = $request->getBody()->getContents();
|
||||
|
||||
// JSON serialization of form data is not supported
|
||||
$this->assertEquals('param=value¶m2=value2', $requestContent);
|
||||
}
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use OpenAPI\Client\Api\PetApi;
|
||||
use OpenAPI\Client\Model\Pet;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
require_once __DIR__ . '/FakeHttpClient.php';
|
||||
|
||||
class ResponseTypesTest extends TestCase
|
||||
{
|
||||
/** @var PetApi */
|
||||
private $api;
|
||||
/** @var FakeHttpClient */
|
||||
private $fakeHttpClient;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->fakeHttpClient = new FakeHttpClient();
|
||||
$this->api = new PetApi($this->fakeHttpClient);
|
||||
}
|
||||
|
||||
public function testDefined200ReturnType()
|
||||
{
|
||||
$this->fakeHttpClient->setResponse(new Response(200, [], json_encode([])));
|
||||
$result = $this->api->getPetById(123);
|
||||
|
||||
$this->assertInstanceOf(Pet::class, $result);
|
||||
}
|
||||
|
||||
public function testDefault2xxReturnType()
|
||||
{
|
||||
$this->fakeHttpClient->setResponse(new Response(255, [], json_encode([])));
|
||||
$result = $this->api->getPetById(123);
|
||||
|
||||
$this->assertInstanceOf(Pet::class, $result);
|
||||
}
|
||||
|
||||
public function testDefinedErrorException()
|
||||
{
|
||||
$this->expectExceptionCode(400);
|
||||
$this->expectException(\OpenAPI\Client\ApiException::class);
|
||||
$statusCode = 400;
|
||||
|
||||
$this->fakeHttpClient->setResponse(new Response($statusCode, [], '{}'));
|
||||
$this->api->getPetById(123);
|
||||
}
|
||||
|
||||
// missing case in spec:
|
||||
// responses:
|
||||
// '400':
|
||||
// description: failure
|
||||
// schema:
|
||||
// $ref: '#/definitions/Error'
|
||||
// public function testDefinedErrorResponseObject()
|
||||
// {
|
||||
// $result = null;
|
||||
// try {
|
||||
// $this->fakeHttpClient->setResponse(new Response(400, [], '{}'));
|
||||
// $this->api->getPetById(123);
|
||||
// } catch (ApiException $e) {
|
||||
// $result = $e->getResponseObject();
|
||||
// }
|
||||
//
|
||||
// $this->assertInstanceOf(Error::class, $result);
|
||||
// }
|
||||
|
||||
public function testDefaultErrorException()
|
||||
{
|
||||
$this->expectExceptionCode(404);
|
||||
$this->expectException(\OpenAPI\Client\ApiException::class);
|
||||
$statusCode = 404;
|
||||
|
||||
$this->fakeHttpClient->setResponse(new Response($statusCode, [], '{}'));
|
||||
$this->api->getPetById(123);
|
||||
}
|
||||
|
||||
public function testDefaultErrorResponseObject()
|
||||
{
|
||||
$result = null;
|
||||
try {
|
||||
$this->fakeHttpClient->setResponse(new Response(404, [], '{}'));
|
||||
$this->api->getPetById(123);
|
||||
} catch (ApiException $e) {
|
||||
$result = $e->getResponseObject();
|
||||
}
|
||||
|
||||
$this->assertNull($result);
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use OpenAPI\Client\Api\PetApi;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
require_once __DIR__ . '/FakeHttpClient.php';
|
||||
|
||||
/**
|
||||
* Tests for server variables in operations
|
||||
*/
|
||||
class ServerVariablesInOperationTest extends TestCase
|
||||
{
|
||||
private FakeHttpClient $fakeHttpClient;
|
||||
private PetApi $api;
|
||||
private Model\Pet $pet;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->fakeHttpClient = new FakeHttpClient();
|
||||
$this->api = new Api\PetApi($this->fakeHttpClient);
|
||||
$this->pet = new Model\Pet();
|
||||
$this->pet->setName("something");
|
||||
$this->pet->setPhotoUrls(array("https://a.com"));
|
||||
}
|
||||
|
||||
public function testServerVariablesInOperation(): void
|
||||
{
|
||||
# Test default values (if no variables are set)
|
||||
$this->api->addPet($this->pet, 2);
|
||||
$request = $this->fakeHttpClient->getLastRequest();
|
||||
|
||||
$this->assertEquals('petstore.swagger.io', $request->getUri()->getHost(), 'Server variable set to default value.');
|
||||
|
||||
# Test variables substitution
|
||||
$this->api->addPet($this->pet, 2, [ 'server' => 'qa-petstore', 'port' => '8080']);
|
||||
$request = $this->fakeHttpClient->getLastRequest();
|
||||
|
||||
$this->assertEquals('qa-petstore.swagger.io', $request->getUri()->getHost(), 'Server set to "qa-petstore"');
|
||||
$this->assertEquals(8080, $request->getUri()->getPort(), 'Port set to 8080');
|
||||
}
|
||||
|
||||
public function testLegacyServerChoiceInOperation(): void
|
||||
{
|
||||
# Test legacy behavior (set server using api->setHostIndex()
|
||||
$this->api->setHostIndex(1);
|
||||
$this->api->addPet($this->pet);
|
||||
$request = $this->fakeHttpClient->getLastRequest();
|
||||
|
||||
$this->assertEquals('path-server-test.petstore.local', $request->getUri()->getHost(), 'Server set using legacy behavior');
|
||||
}
|
||||
|
||||
public function testInvalidVariableValueInOperation(): void
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$this->api->addPet($this->pet, 2,['server' => 'invalid-value']);
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use OpenAPI\Client\Api\PetApi;
|
||||
use OpenAPI\Client\Api\StoreApi;
|
||||
use OpenAPI\Client\Model\Category;
|
||||
use OpenAPI\Client\Model\Pet;
|
||||
use OpenAPI\Client\Model\Tag;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class StoreApiTest extends TestCase
|
||||
{
|
||||
/** @var StoreApi */
|
||||
private $api;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->api = new StoreApi();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
// add a new pet (id 10005) to ensure the pet object is available for all the tests
|
||||
// new pet
|
||||
$id = 10005;
|
||||
$pet = new Pet();
|
||||
$pet->setId($id);
|
||||
$pet->setName('PHP Unit Test');
|
||||
$pet->setPhotoUrls(array('http://a.com'));
|
||||
$pet->setStatus('available');
|
||||
// new tag
|
||||
$tag = new Tag();
|
||||
$tag->setId($id); // use the same id as pet
|
||||
$tag->setName('test php tag');
|
||||
// new category
|
||||
$category = new Category();
|
||||
$category->setId($id); // use the same id as pet
|
||||
$category->setName('test php category');
|
||||
|
||||
$pet->setTags([$tag]);
|
||||
$pet->setCategory($category);
|
||||
|
||||
$api = new PetApi();
|
||||
$api->addPet($pet);
|
||||
}
|
||||
|
||||
public function testGetInventory()
|
||||
{
|
||||
$result = $this->api->getInventory();
|
||||
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsInt($result['available']);
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use OpenAPI\Client\Api\UserApi;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class UserApiTest extends TestCase
|
||||
{
|
||||
|
||||
/** @var UserApi*/
|
||||
private $api;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->api = new Api\UserApi();
|
||||
}
|
||||
|
||||
// test login use
|
||||
public function testLoginUser()
|
||||
{
|
||||
// initialize the API client
|
||||
// login
|
||||
$response = $this->api->loginUser('xxxxx', 'yyyyyyyy');
|
||||
|
||||
$this->assertIsString($response);
|
||||
|
||||
$pattern = '/logged in user session/';
|
||||
$assertMessage = "response string starts with 'logged in user session'";
|
||||
$this->assertIsString($response);
|
||||
if (method_exists($this, 'assertMatchesRegularExpression')) {
|
||||
$this->assertMatchesRegularExpression($pattern, $response, $assertMessage);
|
||||
} else {
|
||||
$this->assertRegExp($pattern, $response, $assertMessage);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* AnotherFakeApiTest
|
||||
* PHP version 8.0
|
||||
* PHP version 8.1
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
@ -15,8 +14,8 @@
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* Generator version: 7.9.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -27,15 +26,14 @@
|
||||
|
||||
namespace OpenAPI\Client\Test\Api;
|
||||
|
||||
use \OpenAPI\Client\Configuration;
|
||||
use \OpenAPI\Client\ApiException;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
use OpenAPI\Client\Configuration;
|
||||
use OpenAPI\Client\ApiException;
|
||||
use OpenAPI\Client\ObjectSerializer;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* AnotherFakeApiTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
|
@ -1,9 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* DefaultApiTest
|
||||
* PHP version 8.0
|
||||
* PHP version 8.1
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
@ -15,8 +14,8 @@
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* Generator version: 7.9.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -27,15 +26,14 @@
|
||||
|
||||
namespace OpenAPI\Client\Test\Api;
|
||||
|
||||
use \OpenAPI\Client\Configuration;
|
||||
use \OpenAPI\Client\ApiException;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
use OpenAPI\Client\Configuration;
|
||||
use OpenAPI\Client\ApiException;
|
||||
use OpenAPI\Client\ObjectSerializer;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* DefaultApiTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
|
@ -1,9 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* FakeApiTest
|
||||
* PHP version 8.0
|
||||
* PHP version 8.1
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
@ -15,8 +14,8 @@
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* Generator version: 7.9.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -27,15 +26,14 @@
|
||||
|
||||
namespace OpenAPI\Client\Test\Api;
|
||||
|
||||
use \OpenAPI\Client\Configuration;
|
||||
use \OpenAPI\Client\ApiException;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
use OpenAPI\Client\Configuration;
|
||||
use OpenAPI\Client\ApiException;
|
||||
use OpenAPI\Client\ObjectSerializer;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* FakeApiTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
@ -71,6 +69,18 @@ class FakeApiTest extends TestCase
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for fakeBigDecimalMap
|
||||
*
|
||||
* .
|
||||
*
|
||||
*/
|
||||
public function testFakeBigDecimalMap()
|
||||
{
|
||||
// TODO: implement
|
||||
self::markTestIncomplete('Not implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for fakeHealthGet
|
||||
*
|
||||
@ -155,6 +165,18 @@ class FakeApiTest extends TestCase
|
||||
self::markTestIncomplete('Not implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for testAdditionalPropertiesReference
|
||||
*
|
||||
* test referenced additionalProperties.
|
||||
*
|
||||
*/
|
||||
public function testTestAdditionalPropertiesReference()
|
||||
{
|
||||
// TODO: implement
|
||||
self::markTestIncomplete('Not implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for testBodyWithBinary
|
||||
*
|
||||
@ -251,6 +273,18 @@ class FakeApiTest extends TestCase
|
||||
self::markTestIncomplete('Not implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for testInlineFreeformAdditionalProperties
|
||||
*
|
||||
* test inline free-form additionalProperties.
|
||||
*
|
||||
*/
|
||||
public function testTestInlineFreeformAdditionalProperties()
|
||||
{
|
||||
// TODO: implement
|
||||
self::markTestIncomplete('Not implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for testJsonFormData
|
||||
*
|
||||
@ -263,6 +297,18 @@ class FakeApiTest extends TestCase
|
||||
self::markTestIncomplete('Not implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for testNullable
|
||||
*
|
||||
* test nullable parent property.
|
||||
*
|
||||
*/
|
||||
public function testTestNullable()
|
||||
{
|
||||
// TODO: implement
|
||||
self::markTestIncomplete('Not implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for testQueryParameterCollectionFormat
|
||||
*
|
||||
@ -274,4 +320,16 @@ class FakeApiTest extends TestCase
|
||||
// TODO: implement
|
||||
self::markTestIncomplete('Not implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for testStringMapReference
|
||||
*
|
||||
* test referenced string map.
|
||||
*
|
||||
*/
|
||||
public function testTestStringMapReference()
|
||||
{
|
||||
// TODO: implement
|
||||
self::markTestIncomplete('Not implemented');
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* FakeClassnameTags123ApiTest
|
||||
* PHP version 8.0
|
||||
* PHP version 8.1
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
@ -15,8 +14,8 @@
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* Generator version: 7.9.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -27,15 +26,14 @@
|
||||
|
||||
namespace OpenAPI\Client\Test\Api;
|
||||
|
||||
use \OpenAPI\Client\Configuration;
|
||||
use \OpenAPI\Client\ApiException;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
use OpenAPI\Client\Configuration;
|
||||
use OpenAPI\Client\ApiException;
|
||||
use OpenAPI\Client\ObjectSerializer;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* FakeClassnameTags123ApiTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
|
@ -1,9 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* PetApiTest
|
||||
* PHP version 8.0
|
||||
* PHP version 8.1
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
@ -15,8 +14,8 @@
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* Generator version: 7.9.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -27,15 +26,14 @@
|
||||
|
||||
namespace OpenAPI\Client\Test\Api;
|
||||
|
||||
use \OpenAPI\Client\Configuration;
|
||||
use \OpenAPI\Client\ApiException;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
use OpenAPI\Client\Configuration;
|
||||
use OpenAPI\Client\ApiException;
|
||||
use OpenAPI\Client\ObjectSerializer;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* PetApiTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
|
@ -1,9 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* StoreApiTest
|
||||
* PHP version 8.0
|
||||
* PHP version 8.1
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
@ -15,8 +14,8 @@
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* Generator version: 7.9.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -27,15 +26,14 @@
|
||||
|
||||
namespace OpenAPI\Client\Test\Api;
|
||||
|
||||
use \OpenAPI\Client\Configuration;
|
||||
use \OpenAPI\Client\ApiException;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
use OpenAPI\Client\Configuration;
|
||||
use OpenAPI\Client\ApiException;
|
||||
use OpenAPI\Client\ObjectSerializer;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* StoreApiTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
|
@ -1,9 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* UserApiTest
|
||||
* PHP version 8.0
|
||||
* PHP version 8.1
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
@ -15,8 +14,8 @@
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* Generator version: 7.9.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -27,15 +26,14 @@
|
||||
|
||||
namespace OpenAPI\Client\Test\Api;
|
||||
|
||||
use \OpenAPI\Client\Configuration;
|
||||
use \OpenAPI\Client\ApiException;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
use OpenAPI\Client\Configuration;
|
||||
use OpenAPI\Client\ApiException;
|
||||
use OpenAPI\Client\ObjectSerializer;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* UserApiTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
|
@ -2,9 +2,8 @@
|
||||
/**
|
||||
* AdditionalPropertiesClassTest
|
||||
*
|
||||
* PHP version 8.0
|
||||
* PHP version 8.1
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
@ -16,8 +15,8 @@
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 6.3.0-SNAPSHOT
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* Generator version: 7.9.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -33,7 +32,6 @@ use PHPUnit\Framework\TestCase;
|
||||
/**
|
||||
* AdditionalPropertiesClassTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description AdditionalPropertiesClass
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user