diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java index 9d3a12c8279..610e5da1db5 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java @@ -55,7 +55,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { // clear import mapping (from default generator) as php does not use it // at the moment importMapping.clear(); - + supportsInheritance = true; outputFolder = "generated-code" + File.separator + "php"; @@ -291,6 +291,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { supportingFiles.add(new SupportingFile("autoload.mustache", getPackagePath(), "autoload.php")); supportingFiles.add(new SupportingFile("README.mustache", getPackagePath(), "README.md")); supportingFiles.add(new SupportingFile(".travis.yml", getPackagePath(), ".travis.yml")); + supportingFiles.add(new SupportingFile(".php_cs", getPackagePath(), ".php_cs")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", getPackagePath(), "git_push.sh")); // apache v2 license supportingFiles.add(new SupportingFile("LICENSE", getPackagePath(), "LICENSE")); @@ -447,7 +448,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toModelName(String name) { - // remove [ + // remove [ name = name.replaceAll("\\]", ""); // Note: backslash ("\\") is allowed for e.g. "\\DateTime" @@ -472,7 +473,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { if (!name.matches("^\\\\.*")) { name = modelNamePrefix + name + modelNameSuffix; } - + // camelize the model name // phone_number => PhoneNumber return camelize(name); diff --git a/modules/swagger-codegen/src/main/resources/php/.php_cs b/modules/swagger-codegen/src/main/resources/php/.php_cs new file mode 100644 index 00000000000..6b8e23c818a --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/php/.php_cs @@ -0,0 +1,18 @@ +level(Symfony\CS\FixerInterface::PSR2_LEVEL) + ->setUsingCache(true) + ->fixers( + [ + 'ordered_use', + 'phpdoc_order', + 'short_array_syntax', + 'strict', + 'strict_param' + ] + ) + ->finder( + Symfony\CS\Finder\DefaultFinder::create() + ->in(__DIR__) + ); diff --git a/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache index fc0060adf9d..effdbedb7f8 100644 --- a/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache @@ -31,7 +31,6 @@ namespace {{invokerPackage}}; */ class ApiClient { - public static $PATCH = "PATCH"; public static $POST = "POST"; public static $GET = "GET"; @@ -61,7 +60,7 @@ class ApiClient */ public function __construct(\{{invokerPackage}}\Configuration $config = null) { - if ($config == null) { + if ($config === null) { $config = Configuration::getDefaultConfiguration(); } @@ -130,8 +129,7 @@ class ApiClient */ public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType = null, $endpointPath = null) { - - $headers = array(); + $headers = []; // construct the http header $headerParams = array_merge( @@ -144,9 +142,9 @@ class ApiClient } // form data - if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers)) { + if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers, true)) { $postData = http_build_query($postData); - } elseif ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers)) { // json model + } elseif ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers, true)) { // json model $postData = json_encode(\{{invokerPackage}}\ObjectSerializer::sanitizeForSerialization($postData)); } @@ -154,7 +152,7 @@ class ApiClient $curl = curl_init(); // set timeout, if needed - if ($this->config->getCurlTimeout() != 0) { + if ($this->config->getCurlTimeout() !== 0) { curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout()); } // return the result on success, rather than just true @@ -163,7 +161,7 @@ class ApiClient curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); // disable SSL verification, if needed - if ($this->config->getSSLVerification() == false) { + if ($this->config->getSSLVerification() === false) { curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); } @@ -172,24 +170,24 @@ class ApiClient $url = ($url . '?' . http_build_query($queryParams)); } - if ($method == self::$POST) { + if ($method === self::$POST) { curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } elseif ($method == self::$HEAD) { + } elseif ($method === self::$HEAD) { curl_setopt($curl, CURLOPT_NOBODY, true); - } elseif ($method == self::$OPTIONS) { + } elseif ($method === self::$OPTIONS) { curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "OPTIONS"); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } elseif ($method == self::$PATCH) { + } elseif ($method === self::$PATCH) { curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH"); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } elseif ($method == self::$PUT) { + } elseif ($method === self::$PUT) { curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } elseif ($method == self::$DELETE) { + } elseif ($method === self::$DELETE) { curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } elseif ($method != self::$GET) { + } elseif ($method !== self::$GET) { throw new ApiException('Method ' . $method . ' is not recognized.'); } curl_setopt($curl, CURLOPT_URL, $url); @@ -223,7 +221,7 @@ class ApiClient } // Handle the response - if ($response_info['http_code'] == 0) { + if ($response_info['http_code'] === 0) { $curl_error_message = curl_error($curl); // curl_exec can sometimes fail but still return a blank message from curl_error(). @@ -239,8 +237,8 @@ class ApiClient throw $exception; } elseif ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299) { // return raw body if response is a file - if ($responseType == '\SplFileObject' || $responseType == 'string') { - return array($http_body, $response_info['http_code'], $http_header); + if ($responseType === '\SplFileObject' || $responseType === 'string') { + return [$http_body, $response_info['http_code'], $http_header]; } $data = json_decode($http_body); @@ -260,7 +258,7 @@ class ApiClient $data ); } - return array($data, $response_info['http_code'], $http_header); + return [$data, $response_info['http_code'], $http_header]; } /** @@ -309,7 +307,7 @@ class ApiClient protected function httpParseHeaders($raw_headers) { // ref/credit: http://php.net/manual/en/function.http-parse-headers.php#112986 - $headers = array(); + $headers = []; $key = ''; foreach (explode("\n", $raw_headers) as $h) { @@ -319,14 +317,14 @@ class ApiClient if (!isset($headers[$h[0]])) { $headers[$h[0]] = trim($h[1]); } elseif (is_array($headers[$h[0]])) { - $headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1]))); + $headers[$h[0]] = array_merge($headers[$h[0]], [trim($h[1])]); } else { - $headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1]))); + $headers[$h[0]] = array_merge([$headers[$h[0]]], [trim($h[1])]); } $key = $h[0]; } else { - if (substr($h[0], 0, 1) == "\t") { + if (substr($h[0], 0, 1) === "\t") { $headers[$key] .= "\r\n\t".trim($h[0]); } elseif (!$key) { $headers[0] = trim($h[0]); diff --git a/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache b/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache index ca9ad1d80ec..7208e4c7784 100644 --- a/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache +++ b/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache @@ -31,7 +31,6 @@ namespace {{invokerPackage}}; */ class ObjectSerializer { - /** * Serialize data * @@ -51,7 +50,7 @@ class ObjectSerializer } return $data; } elseif (is_object($data)) { - $values = array(); + $values = []; foreach (array_keys($data::swaggerTypes()) as $property) { $getter = $data::getters()[$property]; if ($data->$getter() !== null) { @@ -213,7 +212,7 @@ class ObjectSerializer return null; } elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int] $inner = substr($class, 4, -1); - $deserialized = array(); + $deserialized = []; if (strrpos($inner, ",") !== false) { $subClass_array = explode(',', $inner, 2); $subClass = $subClass_array[1]; @@ -222,9 +221,9 @@ class ObjectSerializer } } return $deserialized; - } elseif (strcasecmp(substr($class, -2), '[]') == 0) { + } elseif (strcasecmp(substr($class, -2), '[]') === 0) { $subClass = substr($class, 0, -2); - $values = array(); + $values = []; foreach ($data as $key => $value) { $values[] = self::deserialize($value, $subClass, null, $discriminator); } @@ -244,7 +243,7 @@ class ObjectSerializer } else { return null; } - } elseif (in_array($class, array({{&primitives}}))) { + } elseif (in_array($class, [{{&primitives}}], true)) { settype($data, $class); return $data; } elseif ($class === '\SplFileObject') { @@ -257,7 +256,6 @@ class ObjectSerializer } $deserialized = new \SplFileObject($filename, "w"); $byte_written = $deserialized->fwrite($data); - if (Configuration::getDefaultConfiguration()->getDebug()) { error_log("[DEBUG] Written $byte_written byte to $filename. Please move the file to a proper folder or delete the temp file after processing.".PHP_EOL, 3, Configuration::getDefaultConfiguration()->getDebugFile()); } diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index b98d1f2db55..26583a6f3d1 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -19,9 +19,9 @@ namespace {{apiPackage}}; -use \{{invokerPackage}}\Configuration; use \{{invokerPackage}}\ApiClient; use \{{invokerPackage}}\ApiException; +use \{{invokerPackage}}\Configuration; use \{{invokerPackage}}\ObjectSerializer; /** @@ -35,7 +35,6 @@ use \{{invokerPackage}}\ObjectSerializer; */ {{#operations}}class {{classname}} { - /** * API Client * @@ -50,7 +49,7 @@ use \{{invokerPackage}}\ObjectSerializer; */ public function __construct(\{{invokerPackage}}\ApiClient $apiClient = null) { - if ($apiClient == null) { + if ($apiClient === null) { $apiClient = new ApiClient(); $apiClient->getConfig()->setHost('{{basePath}}'); } @@ -80,8 +79,8 @@ use \{{invokerPackage}}\ObjectSerializer; $this->apiClient = $apiClient; return $this; } - {{#operation}} + /** * Operation {{{operationId}}} * @@ -94,8 +93,8 @@ use \{{invokerPackage}}\ObjectSerializer; {{#allParams}} * @param {{dataType}} ${{paramName}} {{description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} {{/allParams}} - * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} * @throws \{{invokerPackage}}\ApiException on non-2xx response + * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} */ public function {{operationId}}({{#allParams}}${{paramName}}{{^required}} = null{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { @@ -114,9 +113,9 @@ use \{{invokerPackage}}\ObjectSerializer; {{/description}} {{#allParams}} * @param {{dataType}} ${{paramName}} {{description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} -{{/allParams}} - * @return array of {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings) +{{/allParams}} * @throws \{{invokerPackage}}\ApiException on non-2xx response + * @return array of {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings) */ public function {{operationId}}WithHttpInfo({{#allParams}}${{paramName}}{{^required}} = null{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { @@ -169,14 +168,14 @@ use \{{invokerPackage}}\ObjectSerializer; // parse inputs $resourcePath = "{{path}}"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array({{#produces}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/produces}})); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept([{{#produces}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/produces}}]); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array({{#consumes}}'{{{mediaType}}}'{{#hasMore}},{{/hasMore}}{{/consumes}})); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([{{#consumes}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/consumes}}]); {{#queryParams}} // query params @@ -287,10 +286,10 @@ use \{{invokerPackage}}\ObjectSerializer; ); {{#returnType}} - return array($this->apiClient->getSerializer()->deserialize($response, '{{returnType}}', $httpHeader{{#discriminator}}, '{{discriminator}}'{{/discriminator}}), $statusCode, $httpHeader); + return [$this->apiClient->getSerializer()->deserialize($response, '{{returnType}}', $httpHeader{{#discriminator}}, '{{discriminator}}'{{/discriminator}}), $statusCode, $httpHeader]; {{/returnType}} {{^returnType}} - return array(null, $statusCode, $httpHeader); + return [null, $statusCode, $httpHeader]; {{/returnType}} } catch (ApiException $e) { switch ($e->getCode()) { @@ -307,7 +306,6 @@ use \{{invokerPackage}}\ObjectSerializer; throw $e; } } - {{/operation}} } -{{/operations}} +{{/operations}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/php/composer.mustache b/modules/swagger-codegen/src/main/resources/php/composer.mustache index da65422ca92..620e74b2c03 100644 --- a/modules/swagger-codegen/src/main/resources/php/composer.mustache +++ b/modules/swagger-codegen/src/main/resources/php/composer.mustache @@ -27,7 +27,8 @@ "require-dev": { "phpunit/phpunit": "~4.8", "satooshi/php-coveralls": "~1.0", - "squizlabs/php_codesniffer": "~2.6" + "squizlabs/php_codesniffer": "~2.6", + "friendsofphp/php-cs-fixer": "~1.12" }, "autoload": { "psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" } diff --git a/modules/swagger-codegen/src/main/resources/php/configuration.mustache b/modules/swagger-codegen/src/main/resources/php/configuration.mustache index df8269907bd..bae256b3bd3 100644 --- a/modules/swagger-codegen/src/main/resources/php/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/php/configuration.mustache @@ -31,7 +31,6 @@ namespace {{invokerPackage}}; */ class Configuration { - private static $defaultConfiguration = null; /** @@ -39,14 +38,14 @@ class Configuration * * @var string[] */ - protected $apiKeys = array(); + protected $apiKeys = []; /** * Associate array to store API prefix (e.g. Bearer) * * @var string[] */ - protected $apiKeyPrefixes = array(); + protected $apiKeyPrefixes = []; /** * Access token for OAuth @@ -74,7 +73,7 @@ class Configuration * * @var array */ - protected $defaultHeaders = array(); + protected $defaultHeaders = []; /** * The host @@ -472,7 +471,7 @@ class Configuration */ public static function getDefaultConfiguration() { - if (self::$defaultConfiguration == null) { + if (self::$defaultConfiguration === null) { self::$defaultConfiguration = new Configuration(); } diff --git a/modules/swagger-codegen/src/main/resources/php/model.mustache b/modules/swagger-codegen/src/main/resources/php/model.mustache index d747db88b7c..efecdf2e596 100644 --- a/modules/swagger-codegen/src/main/resources/php/model.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model.mustache @@ -31,13 +31,11 @@ use \ArrayAccess; {{#description}} // @description {{description}} {{/description}} -/** +/** * @package {{invokerPackage}} * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 * @link https://github.com/swagger-api/swagger-codegen */ {{#isEnum}}{{>model_enum}}{{/isEnum}}{{^isEnum}}{{>model_generic}}{{/isEnum}} - -{{/model}} -{{/models}} +{{/model}}{{/models}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/php/model_enum.mustache b/modules/swagger-codegen/src/main/resources/php/model_enum.mustache index ffb268c6cb9..c9250081b82 100644 --- a/modules/swagger-codegen/src/main/resources/php/model_enum.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model_enum.mustache @@ -15,4 +15,4 @@ class {{classname}} { ]; } {{/isEnum}}{{/vars}} -} +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/php/model_generic.mustache b/modules/swagger-codegen/src/main/resources/php/model_generic.mustache index 072e88ad55d..1e221b78377 100644 --- a/modules/swagger-codegen/src/main/resources/php/model_generic.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model_generic.mustache @@ -10,10 +10,10 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ {{#vars}}'{{name}}' => '{{{datatype}}}'{{#hasMore}}, {{/hasMore}}{{/vars}} - ); + ]; public static function swaggerTypes() { @@ -24,39 +24,41 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + protected static $attributeMap = [ {{#vars}}'{{name}}' => '{{baseName}}'{{#hasMore}}, {{/hasMore}}{{/vars}} - ); + ]; + + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + {{#vars}}'{{name}}' => '{{setter}}'{{#hasMore}}, + {{/hasMore}}{{/vars}} + ]; + + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + {{#vars}}'{{name}}' => '{{getter}}'{{#hasMore}}, + {{/hasMore}}{{/vars}} + ]; public static function attributeMap() { return {{#parentSchema}}parent::attributeMap() + {{/parentSchema}}self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - {{#vars}}'{{name}}' => '{{setter}}'{{#hasMore}}, - {{/hasMore}}{{/vars}} - ); - public static function setters() { return {{#parentSchema}}parent::setters() + {{/parentSchema}}self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - {{#vars}}'{{name}}' => '{{getter}}'{{#hasMore}}, - {{/hasMore}}{{/vars}} - ); - public static function getters() { return {{#parentSchema}}parent::getters() + {{/parentSchema}}self::$getters; @@ -83,7 +85,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -113,7 +115,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; {{#vars}} {{#required}} if ($this->container['{{name}}'] === null) { @@ -122,7 +124,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple {{/required}} {{#isEnum}} {{^isContainer}} - $allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); + $allowed_values = [{{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}]; if (!in_array($this->container['{{name}}'], $allowed_values)) { $invalid_properties[] = "invalid value for '{{name}}', must be one of #{allowed_values}."; } @@ -193,7 +195,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple {{/required}} {{#isEnum}} {{^isContainer}} - $allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); + $allowed_values = [{{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}]; if (!in_array($this->container['{{name}}'], $allowed_values)) { return false; } @@ -368,4 +370,4 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple return json_encode(\{{invokerPackage}}\ObjectSerializer::sanitizeForSerialization($this)); } -} +} \ No newline at end of file diff --git a/samples/client/petstore/php/SwaggerClient-php/.php_cs b/samples/client/petstore/php/SwaggerClient-php/.php_cs new file mode 100644 index 00000000000..6b8e23c818a --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/.php_cs @@ -0,0 +1,18 @@ +level(Symfony\CS\FixerInterface::PSR2_LEVEL) + ->setUsingCache(true) + ->fixers( + [ + 'ordered_use', + 'phpdoc_order', + 'short_array_syntax', + 'strict', + 'strict_param' + ] + ) + ->finder( + Symfony\CS\Finder\DefaultFinder::create() + ->in(__DIR__) + ); diff --git a/samples/client/petstore/php/SwaggerClient-php/composer.json b/samples/client/petstore/php/SwaggerClient-php/composer.json index f4301b5b3e3..78602f3be45 100644 --- a/samples/client/petstore/php/SwaggerClient-php/composer.json +++ b/samples/client/petstore/php/SwaggerClient-php/composer.json @@ -24,7 +24,8 @@ "require-dev": { "phpunit/phpunit": "~4.8", "satooshi/php-coveralls": "~1.0", - "squizlabs/php_codesniffer": "~2.6" + "squizlabs/php_codesniffer": "~2.6", + "friendsofphp/php-cs-fixer": "~1.12" }, "autoload": { "psr-4": { "Swagger\\Client\\" : "lib/" } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php index 8e339dc2aa0..a88a92b4b93 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -40,9 +40,9 @@ namespace Swagger\Client\Api; -use \Swagger\Client\Configuration; use \Swagger\Client\ApiClient; use \Swagger\Client\ApiException; +use \Swagger\Client\Configuration; use \Swagger\Client\ObjectSerializer; /** @@ -56,7 +56,6 @@ use \Swagger\Client\ObjectSerializer; */ class FakeApi { - /** * API Client * @@ -71,7 +70,7 @@ class FakeApi */ public function __construct(\Swagger\Client\ApiClient $apiClient = null) { - if ($apiClient == null) { + if ($apiClient === null) { $apiClient = new ApiClient(); $apiClient->getConfig()->setHost('http://petstore.swagger.io/v2'); } @@ -108,8 +107,8 @@ class FakeApi * To test \"client\" model * * @param \Swagger\Client\Model\Client $body client model (required) - * @return \Swagger\Client\Model\Client * @throws \Swagger\Client\ApiException on non-2xx response + * @return \Swagger\Client\Model\Client */ public function testClientModel($body) { @@ -123,8 +122,8 @@ class FakeApi * To test \"client\" model * * @param \Swagger\Client\Model\Client $body client model (required) - * @return array of \Swagger\Client\Model\Client, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of \Swagger\Client\Model\Client, HTTP status code, HTTP response headers (array of strings) */ public function testClientModelWithHttpInfo($body) { @@ -135,14 +134,14 @@ class FakeApi // parse inputs $resourcePath = "/fake"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json')); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); @@ -171,7 +170,7 @@ class FakeApi '/fake' ); - return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Client', $httpHeader), $statusCode, $httpHeader); + return [$this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Client', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -202,8 +201,8 @@ class FakeApi * @param \DateTime $date None (optional) * @param \DateTime $date_time None (optional) * @param string $password None (optional) - * @return void * @throws \Swagger\Client\ApiException on non-2xx response + * @return void */ public function testEndpointParameters($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null) { @@ -229,8 +228,8 @@ class FakeApi * @param \DateTime $date None (optional) * @param \DateTime $date_time None (optional) * @param string $password None (optional) - * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function testEndpointParametersWithHttpInfo($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null) { @@ -300,14 +299,14 @@ class FakeApi // parse inputs $resourcePath = "/fake"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml; charset=utf-8', 'application/json; charset=utf-8')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/xml; charset=utf-8', 'application/json; charset=utf-8']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/xml; charset=utf-8','application/json; charset=utf-8')); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/xml; charset=utf-8', 'application/json; charset=utf-8']); // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); @@ -387,7 +386,7 @@ class FakeApi '/fake' ); - return array(null, $statusCode, $httpHeader); + return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { } @@ -409,8 +408,8 @@ class FakeApi * @param string $enum_query_string Query parameter enum test (string) (optional, default to -efg) * @param float $enum_query_integer Query parameter enum test (double) (optional) * @param double $enum_query_double Query parameter enum test (double) (optional) - * @return void * @throws \Swagger\Client\ApiException on non-2xx response + * @return void */ public function testEnumParameters($enum_form_string_array = null, $enum_form_string = null, $enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_query_double = null) { @@ -431,22 +430,22 @@ class FakeApi * @param string $enum_query_string Query parameter enum test (string) (optional, default to -efg) * @param float $enum_query_integer Query parameter enum test (double) (optional) * @param double $enum_query_double Query parameter enum test (double) (optional) - * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function testEnumParametersWithHttpInfo($enum_form_string_array = null, $enum_form_string = null, $enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_query_double = null) { // parse inputs $resourcePath = "/fake"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json')); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); // query params if (is_array($enum_query_string_array)) { @@ -508,7 +507,7 @@ class FakeApi '/fake' ); - return array(null, $statusCode, $httpHeader); + return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { } @@ -516,5 +515,4 @@ class FakeApi throw $e; } } - } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php index 1dcd53a9811..791e3c99047 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -40,9 +40,9 @@ namespace Swagger\Client\Api; -use \Swagger\Client\Configuration; use \Swagger\Client\ApiClient; use \Swagger\Client\ApiException; +use \Swagger\Client\Configuration; use \Swagger\Client\ObjectSerializer; /** @@ -56,7 +56,6 @@ use \Swagger\Client\ObjectSerializer; */ class PetApi { - /** * API Client * @@ -71,7 +70,7 @@ class PetApi */ public function __construct(\Swagger\Client\ApiClient $apiClient = null) { - if ($apiClient == null) { + if ($apiClient === null) { $apiClient = new ApiClient(); $apiClient->getConfig()->setHost('http://petstore.swagger.io/v2'); } @@ -108,8 +107,8 @@ class PetApi * Add a new pet to the store * * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) - * @return void * @throws \Swagger\Client\ApiException on non-2xx response + * @return void */ public function addPet($body) { @@ -123,8 +122,8 @@ class PetApi * Add a new pet to the store * * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) - * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function addPetWithHttpInfo($body) { @@ -135,14 +134,14 @@ class PetApi // parse inputs $resourcePath = "/pet"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/xml', 'application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/xml')); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json', 'application/xml']); // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); @@ -175,7 +174,7 @@ class PetApi '/pet' ); - return array(null, $statusCode, $httpHeader); + return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { } @@ -191,8 +190,8 @@ class PetApi * * @param int $pet_id Pet id to delete (required) * @param string $api_key (optional) - * @return void * @throws \Swagger\Client\ApiException on non-2xx response + * @return void */ public function deletePet($pet_id, $api_key = null) { @@ -207,8 +206,8 @@ class PetApi * * @param int $pet_id Pet id to delete (required) * @param string $api_key (optional) - * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function deletePetWithHttpInfo($pet_id, $api_key = null) { @@ -219,14 +218,14 @@ class PetApi // parse inputs $resourcePath = "/pet/{petId}"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/xml', 'application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); // header params if ($api_key !== null) { @@ -266,7 +265,7 @@ class PetApi '/pet/{petId}' ); - return array(null, $statusCode, $httpHeader); + return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { } @@ -281,8 +280,8 @@ class PetApi * Finds Pets by status * * @param string[] $status Status values that need to be considered for filter (required) - * @return \Swagger\Client\Model\Pet[] * @throws \Swagger\Client\ApiException on non-2xx response + * @return \Swagger\Client\Model\Pet[] */ public function findPetsByStatus($status) { @@ -296,8 +295,8 @@ class PetApi * Finds Pets by status * * @param string[] $status Status values that need to be considered for filter (required) - * @return array of \Swagger\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of \Swagger\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) */ public function findPetsByStatusWithHttpInfo($status) { @@ -308,14 +307,14 @@ class PetApi // parse inputs $resourcePath = "/pet/findByStatus"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/xml', 'application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); // query params if (is_array($status)) { @@ -350,7 +349,7 @@ class PetApi '/pet/findByStatus' ); - return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader), $statusCode, $httpHeader); + return [$this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -369,8 +368,8 @@ class PetApi * Finds Pets by tags * * @param string[] $tags Tags to filter by (required) - * @return \Swagger\Client\Model\Pet[] * @throws \Swagger\Client\ApiException on non-2xx response + * @return \Swagger\Client\Model\Pet[] */ public function findPetsByTags($tags) { @@ -384,8 +383,8 @@ class PetApi * Finds Pets by tags * * @param string[] $tags Tags to filter by (required) - * @return array of \Swagger\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of \Swagger\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) */ public function findPetsByTagsWithHttpInfo($tags) { @@ -396,14 +395,14 @@ class PetApi // parse inputs $resourcePath = "/pet/findByTags"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/xml', 'application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); // query params if (is_array($tags)) { @@ -438,7 +437,7 @@ class PetApi '/pet/findByTags' ); - return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader), $statusCode, $httpHeader); + return [$this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -457,8 +456,8 @@ class PetApi * Find pet by ID * * @param int $pet_id ID of pet to return (required) - * @return \Swagger\Client\Model\Pet * @throws \Swagger\Client\ApiException on non-2xx response + * @return \Swagger\Client\Model\Pet */ public function getPetById($pet_id) { @@ -472,8 +471,8 @@ class PetApi * Find pet by ID * * @param int $pet_id ID of pet to return (required) - * @return array of \Swagger\Client\Model\Pet, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of \Swagger\Client\Model\Pet, HTTP status code, HTTP response headers (array of strings) */ public function getPetByIdWithHttpInfo($pet_id) { @@ -484,14 +483,14 @@ class PetApi // parse inputs $resourcePath = "/pet/{petId}"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/xml', 'application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); // path params if ($pet_id !== null) { @@ -528,7 +527,7 @@ class PetApi '/pet/{petId}' ); - return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet', $httpHeader), $statusCode, $httpHeader); + return [$this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -547,8 +546,8 @@ class PetApi * Update an existing pet * * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) - * @return void * @throws \Swagger\Client\ApiException on non-2xx response + * @return void */ public function updatePet($body) { @@ -562,8 +561,8 @@ class PetApi * Update an existing pet * * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) - * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function updatePetWithHttpInfo($body) { @@ -574,14 +573,14 @@ class PetApi // parse inputs $resourcePath = "/pet"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/xml', 'application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/xml')); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json', 'application/xml']); // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); @@ -614,7 +613,7 @@ class PetApi '/pet' ); - return array(null, $statusCode, $httpHeader); + return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { } @@ -631,8 +630,8 @@ class PetApi * @param int $pet_id ID of pet that needs to be updated (required) * @param string $name Updated name of the pet (optional) * @param string $status Updated status of the pet (optional) - * @return void * @throws \Swagger\Client\ApiException on non-2xx response + * @return void */ public function updatePetWithForm($pet_id, $name = null, $status = null) { @@ -648,8 +647,8 @@ class PetApi * @param int $pet_id ID of pet that needs to be updated (required) * @param string $name Updated name of the pet (optional) * @param string $status Updated status of the pet (optional) - * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function updatePetWithFormWithHttpInfo($pet_id, $name = null, $status = null) { @@ -660,14 +659,14 @@ class PetApi // parse inputs $resourcePath = "/pet/{petId}"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/xml', 'application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/x-www-form-urlencoded')); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/x-www-form-urlencoded']); // path params if ($pet_id !== null) { @@ -711,7 +710,7 @@ class PetApi '/pet/{petId}' ); - return array(null, $statusCode, $httpHeader); + return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { } @@ -728,8 +727,8 @@ class PetApi * @param int $pet_id ID of pet to update (required) * @param string $additional_metadata Additional data to pass to server (optional) * @param \SplFileObject $file file to upload (optional) - * @return \Swagger\Client\Model\ApiResponse * @throws \Swagger\Client\ApiException on non-2xx response + * @return \Swagger\Client\Model\ApiResponse */ public function uploadFile($pet_id, $additional_metadata = null, $file = null) { @@ -745,8 +744,8 @@ class PetApi * @param int $pet_id ID of pet to update (required) * @param string $additional_metadata Additional data to pass to server (optional) * @param \SplFileObject $file file to upload (optional) - * @return array of \Swagger\Client\Model\ApiResponse, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of \Swagger\Client\Model\ApiResponse, HTTP status code, HTTP response headers (array of strings) */ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $file = null) { @@ -757,14 +756,14 @@ class PetApi // parse inputs $resourcePath = "/pet/{petId}/uploadImage"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('multipart/form-data')); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['multipart/form-data']); // path params if ($pet_id !== null) { @@ -814,7 +813,7 @@ class PetApi '/pet/{petId}/uploadImage' ); - return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\ApiResponse', $httpHeader), $statusCode, $httpHeader); + return [$this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\ApiResponse', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -826,5 +825,4 @@ class PetApi throw $e; } } - } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php index 8086abea950..7d34e608139 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -40,9 +40,9 @@ namespace Swagger\Client\Api; -use \Swagger\Client\Configuration; use \Swagger\Client\ApiClient; use \Swagger\Client\ApiException; +use \Swagger\Client\Configuration; use \Swagger\Client\ObjectSerializer; /** @@ -56,7 +56,6 @@ use \Swagger\Client\ObjectSerializer; */ class StoreApi { - /** * API Client * @@ -71,7 +70,7 @@ class StoreApi */ public function __construct(\Swagger\Client\ApiClient $apiClient = null) { - if ($apiClient == null) { + if ($apiClient === null) { $apiClient = new ApiClient(); $apiClient->getConfig()->setHost('http://petstore.swagger.io/v2'); } @@ -108,8 +107,8 @@ class StoreApi * Delete purchase order by ID * * @param string $order_id ID of the order that needs to be deleted (required) - * @return void * @throws \Swagger\Client\ApiException on non-2xx response + * @return void */ public function deleteOrder($order_id) { @@ -123,8 +122,8 @@ class StoreApi * Delete purchase order by ID * * @param string $order_id ID of the order that needs to be deleted (required) - * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function deleteOrderWithHttpInfo($order_id) { @@ -139,14 +138,14 @@ class StoreApi // parse inputs $resourcePath = "/store/order/{orderId}"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/xml', 'application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); // path params if ($order_id !== null) { @@ -178,7 +177,7 @@ class StoreApi '/store/order/{orderId}' ); - return array(null, $statusCode, $httpHeader); + return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { } @@ -192,8 +191,8 @@ class StoreApi * * Returns pet inventories by status * - * @return map[string,int] * @throws \Swagger\Client\ApiException on non-2xx response + * @return map[string,int] */ public function getInventory() { @@ -206,22 +205,22 @@ class StoreApi * * Returns pet inventories by status * - * @return array of map[string,int], HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of map[string,int], HTTP status code, HTTP response headers (array of strings) */ public function getInventoryWithHttpInfo() { // parse inputs $resourcePath = "/store/inventory"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); @@ -250,7 +249,7 @@ class StoreApi '/store/inventory' ); - return array($this->apiClient->getSerializer()->deserialize($response, 'map[string,int]', $httpHeader), $statusCode, $httpHeader); + return [$this->apiClient->getSerializer()->deserialize($response, 'map[string,int]', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -269,8 +268,8 @@ class StoreApi * Find purchase order by ID * * @param int $order_id ID of pet that needs to be fetched (required) - * @return \Swagger\Client\Model\Order * @throws \Swagger\Client\ApiException on non-2xx response + * @return \Swagger\Client\Model\Order */ public function getOrderById($order_id) { @@ -284,8 +283,8 @@ class StoreApi * Find purchase order by ID * * @param int $order_id ID of pet that needs to be fetched (required) - * @return array of \Swagger\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of \Swagger\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) */ public function getOrderByIdWithHttpInfo($order_id) { @@ -303,14 +302,14 @@ class StoreApi // parse inputs $resourcePath = "/store/order/{orderId}"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/xml', 'application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); // path params if ($order_id !== null) { @@ -342,7 +341,7 @@ class StoreApi '/store/order/{orderId}' ); - return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order', $httpHeader), $statusCode, $httpHeader); + return [$this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -361,8 +360,8 @@ class StoreApi * Place an order for a pet * * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) - * @return \Swagger\Client\Model\Order * @throws \Swagger\Client\ApiException on non-2xx response + * @return \Swagger\Client\Model\Order */ public function placeOrder($body) { @@ -376,8 +375,8 @@ class StoreApi * Place an order for a pet * * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) - * @return array of \Swagger\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of \Swagger\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) */ public function placeOrderWithHttpInfo($body) { @@ -388,14 +387,14 @@ class StoreApi // parse inputs $resourcePath = "/store/order"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/xml', 'application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); @@ -424,7 +423,7 @@ class StoreApi '/store/order' ); - return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order', $httpHeader), $statusCode, $httpHeader); + return [$this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -436,5 +435,4 @@ class StoreApi throw $e; } } - } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php index 17dbfd78f0b..f4319be34b3 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php @@ -40,9 +40,9 @@ namespace Swagger\Client\Api; -use \Swagger\Client\Configuration; use \Swagger\Client\ApiClient; use \Swagger\Client\ApiException; +use \Swagger\Client\Configuration; use \Swagger\Client\ObjectSerializer; /** @@ -56,7 +56,6 @@ use \Swagger\Client\ObjectSerializer; */ class UserApi { - /** * API Client * @@ -71,7 +70,7 @@ class UserApi */ public function __construct(\Swagger\Client\ApiClient $apiClient = null) { - if ($apiClient == null) { + if ($apiClient === null) { $apiClient = new ApiClient(); $apiClient->getConfig()->setHost('http://petstore.swagger.io/v2'); } @@ -108,8 +107,8 @@ class UserApi * Create user * * @param \Swagger\Client\Model\User $body Created user object (required) - * @return void * @throws \Swagger\Client\ApiException on non-2xx response + * @return void */ public function createUser($body) { @@ -123,8 +122,8 @@ class UserApi * Create user * * @param \Swagger\Client\Model\User $body Created user object (required) - * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function createUserWithHttpInfo($body) { @@ -135,14 +134,14 @@ class UserApi // parse inputs $resourcePath = "/user"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/xml', 'application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); @@ -171,7 +170,7 @@ class UserApi '/user' ); - return array(null, $statusCode, $httpHeader); + return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { } @@ -186,8 +185,8 @@ class UserApi * Creates list of users with given input array * * @param \Swagger\Client\Model\User[] $body List of user object (required) - * @return void * @throws \Swagger\Client\ApiException on non-2xx response + * @return void */ public function createUsersWithArrayInput($body) { @@ -201,8 +200,8 @@ class UserApi * Creates list of users with given input array * * @param \Swagger\Client\Model\User[] $body List of user object (required) - * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function createUsersWithArrayInputWithHttpInfo($body) { @@ -213,14 +212,14 @@ class UserApi // parse inputs $resourcePath = "/user/createWithArray"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/xml', 'application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); @@ -249,7 +248,7 @@ class UserApi '/user/createWithArray' ); - return array(null, $statusCode, $httpHeader); + return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { } @@ -264,8 +263,8 @@ class UserApi * Creates list of users with given input array * * @param \Swagger\Client\Model\User[] $body List of user object (required) - * @return void * @throws \Swagger\Client\ApiException on non-2xx response + * @return void */ public function createUsersWithListInput($body) { @@ -279,8 +278,8 @@ class UserApi * Creates list of users with given input array * * @param \Swagger\Client\Model\User[] $body List of user object (required) - * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function createUsersWithListInputWithHttpInfo($body) { @@ -291,14 +290,14 @@ class UserApi // parse inputs $resourcePath = "/user/createWithList"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/xml', 'application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); @@ -327,7 +326,7 @@ class UserApi '/user/createWithList' ); - return array(null, $statusCode, $httpHeader); + return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { } @@ -342,8 +341,8 @@ class UserApi * Delete user * * @param string $username The name that needs to be deleted (required) - * @return void * @throws \Swagger\Client\ApiException on non-2xx response + * @return void */ public function deleteUser($username) { @@ -357,8 +356,8 @@ class UserApi * Delete user * * @param string $username The name that needs to be deleted (required) - * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function deleteUserWithHttpInfo($username) { @@ -369,14 +368,14 @@ class UserApi // parse inputs $resourcePath = "/user/{username}"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/xml', 'application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); // path params if ($username !== null) { @@ -408,7 +407,7 @@ class UserApi '/user/{username}' ); - return array(null, $statusCode, $httpHeader); + return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { } @@ -423,8 +422,8 @@ class UserApi * Get user by user name * * @param string $username The name that needs to be fetched. Use user1 for testing. (required) - * @return \Swagger\Client\Model\User * @throws \Swagger\Client\ApiException on non-2xx response + * @return \Swagger\Client\Model\User */ public function getUserByName($username) { @@ -438,8 +437,8 @@ class UserApi * Get user by user name * * @param string $username The name that needs to be fetched. Use user1 for testing. (required) - * @return array of \Swagger\Client\Model\User, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of \Swagger\Client\Model\User, HTTP status code, HTTP response headers (array of strings) */ public function getUserByNameWithHttpInfo($username) { @@ -450,14 +449,14 @@ class UserApi // parse inputs $resourcePath = "/user/{username}"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/xml', 'application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); // path params if ($username !== null) { @@ -489,7 +488,7 @@ class UserApi '/user/{username}' ); - return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\User', $httpHeader), $statusCode, $httpHeader); + return [$this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\User', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -509,8 +508,8 @@ class UserApi * * @param string $username The user name for login (required) * @param string $password The password for login in clear text (required) - * @return string * @throws \Swagger\Client\ApiException on non-2xx response + * @return string */ public function loginUser($username, $password) { @@ -525,8 +524,8 @@ class UserApi * * @param string $username The user name for login (required) * @param string $password The password for login in clear text (required) - * @return array of string, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of string, HTTP status code, HTTP response headers (array of strings) */ public function loginUserWithHttpInfo($username, $password) { @@ -541,14 +540,14 @@ class UserApi // parse inputs $resourcePath = "/user/login"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/xml', 'application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); // query params if ($username !== null) { @@ -580,7 +579,7 @@ class UserApi '/user/login' ); - return array($this->apiClient->getSerializer()->deserialize($response, 'string', $httpHeader), $statusCode, $httpHeader); + return [$this->apiClient->getSerializer()->deserialize($response, 'string', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -598,8 +597,8 @@ class UserApi * * Logs out current logged in user session * - * @return void * @throws \Swagger\Client\ApiException on non-2xx response + * @return void */ public function logoutUser() { @@ -612,22 +611,22 @@ class UserApi * * Logs out current logged in user session * - * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function logoutUserWithHttpInfo() { // parse inputs $resourcePath = "/user/logout"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/xml', 'application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); @@ -651,7 +650,7 @@ class UserApi '/user/logout' ); - return array(null, $statusCode, $httpHeader); + return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { } @@ -667,8 +666,8 @@ class UserApi * * @param string $username name that need to be deleted (required) * @param \Swagger\Client\Model\User $body Updated user object (required) - * @return void * @throws \Swagger\Client\ApiException on non-2xx response + * @return void */ public function updateUser($username, $body) { @@ -683,8 +682,8 @@ class UserApi * * @param string $username name that need to be deleted (required) * @param \Swagger\Client\Model\User $body Updated user object (required) - * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function updateUserWithHttpInfo($username, $body) { @@ -699,14 +698,14 @@ class UserApi // parse inputs $resourcePath = "/user/{username}"; $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/xml', 'application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); // path params if ($username !== null) { @@ -743,7 +742,7 @@ class UserApi '/user/{username}' ); - return array(null, $statusCode, $httpHeader); + return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { } @@ -751,5 +750,4 @@ class UserApi throw $e; } } - } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php b/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php index a28d9840e0f..309bbc84760 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php @@ -52,7 +52,6 @@ namespace Swagger\Client; */ class ApiClient { - public static $PATCH = "PATCH"; public static $POST = "POST"; public static $GET = "GET"; @@ -82,7 +81,7 @@ class ApiClient */ public function __construct(\Swagger\Client\Configuration $config = null) { - if ($config == null) { + if ($config === null) { $config = Configuration::getDefaultConfiguration(); } @@ -151,8 +150,7 @@ class ApiClient */ public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType = null, $endpointPath = null) { - - $headers = array(); + $headers = []; // construct the http header $headerParams = array_merge( @@ -165,9 +163,9 @@ class ApiClient } // form data - if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers)) { + if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers, true)) { $postData = http_build_query($postData); - } elseif ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers)) { // json model + } elseif ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers, true)) { // json model $postData = json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($postData)); } @@ -175,7 +173,7 @@ class ApiClient $curl = curl_init(); // set timeout, if needed - if ($this->config->getCurlTimeout() != 0) { + if ($this->config->getCurlTimeout() !== 0) { curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout()); } // return the result on success, rather than just true @@ -184,7 +182,7 @@ class ApiClient curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); // disable SSL verification, if needed - if ($this->config->getSSLVerification() == false) { + if ($this->config->getSSLVerification() === false) { curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); } @@ -193,24 +191,24 @@ class ApiClient $url = ($url . '?' . http_build_query($queryParams)); } - if ($method == self::$POST) { + if ($method === self::$POST) { curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } elseif ($method == self::$HEAD) { + } elseif ($method === self::$HEAD) { curl_setopt($curl, CURLOPT_NOBODY, true); - } elseif ($method == self::$OPTIONS) { + } elseif ($method === self::$OPTIONS) { curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "OPTIONS"); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } elseif ($method == self::$PATCH) { + } elseif ($method === self::$PATCH) { curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH"); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } elseif ($method == self::$PUT) { + } elseif ($method === self::$PUT) { curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } elseif ($method == self::$DELETE) { + } elseif ($method === self::$DELETE) { curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } elseif ($method != self::$GET) { + } elseif ($method !== self::$GET) { throw new ApiException('Method ' . $method . ' is not recognized.'); } curl_setopt($curl, CURLOPT_URL, $url); @@ -244,7 +242,7 @@ class ApiClient } // Handle the response - if ($response_info['http_code'] == 0) { + if ($response_info['http_code'] === 0) { $curl_error_message = curl_error($curl); // curl_exec can sometimes fail but still return a blank message from curl_error(). @@ -260,8 +258,8 @@ class ApiClient throw $exception; } elseif ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299) { // return raw body if response is a file - if ($responseType == '\SplFileObject' || $responseType == 'string') { - return array($http_body, $response_info['http_code'], $http_header); + if ($responseType === '\SplFileObject' || $responseType === 'string') { + return [$http_body, $response_info['http_code'], $http_header]; } $data = json_decode($http_body); @@ -281,7 +279,7 @@ class ApiClient $data ); } - return array($data, $response_info['http_code'], $http_header); + return [$data, $response_info['http_code'], $http_header]; } /** @@ -330,7 +328,7 @@ class ApiClient protected function httpParseHeaders($raw_headers) { // ref/credit: http://php.net/manual/en/function.http-parse-headers.php#112986 - $headers = array(); + $headers = []; $key = ''; foreach (explode("\n", $raw_headers) as $h) { @@ -340,14 +338,14 @@ class ApiClient if (!isset($headers[$h[0]])) { $headers[$h[0]] = trim($h[1]); } elseif (is_array($headers[$h[0]])) { - $headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1]))); + $headers[$h[0]] = array_merge($headers[$h[0]], [trim($h[1])]); } else { - $headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1]))); + $headers[$h[0]] = array_merge([$headers[$h[0]]], [trim($h[1])]); } $key = $h[0]; } else { - if (substr($h[0], 0, 1) == "\t") { + if (substr($h[0], 0, 1) === "\t") { $headers[$key] .= "\r\n\t".trim($h[0]); } elseif (!$key) { $headers[0] = trim($h[0]); diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Configuration.php b/samples/client/petstore/php/SwaggerClient-php/lib/Configuration.php index 2678530e46a..f08db712f37 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Configuration.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Configuration.php @@ -52,7 +52,6 @@ namespace Swagger\Client; */ class Configuration { - private static $defaultConfiguration = null; /** @@ -60,14 +59,14 @@ class Configuration * * @var string[] */ - protected $apiKeys = array(); + protected $apiKeys = []; /** * Associate array to store API prefix (e.g. Bearer) * * @var string[] */ - protected $apiKeyPrefixes = array(); + protected $apiKeyPrefixes = []; /** * Access token for OAuth @@ -95,7 +94,7 @@ class Configuration * * @var array */ - protected $defaultHeaders = array(); + protected $defaultHeaders = []; /** * The host @@ -493,7 +492,7 @@ class Configuration */ public static function getDefaultConfiguration() { - if (self::$defaultConfiguration == null) { + if (self::$defaultConfiguration === null) { self::$defaultConfiguration = new Configuration(); } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/AdditionalPropertiesClass.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/AdditionalPropertiesClass.php index 3167f7b2739..604112c2ba4 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/AdditionalPropertiesClass.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/AdditionalPropertiesClass.php @@ -47,7 +47,7 @@ use \ArrayAccess; * AdditionalPropertiesClass Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,10 +65,10 @@ class AdditionalPropertiesClass implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'map_property' => 'map[string,string]', 'map_of_map_property' => 'map[string,map[string,string]]' - ); + ]; public static function swaggerTypes() { @@ -79,39 +79,41 @@ class AdditionalPropertiesClass implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'map_property' => 'setMapProperty', - 'map_of_map_property' => 'setMapOfMapProperty' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'map_property' => 'getMapProperty', - 'map_of_map_property' => 'getMapOfMapProperty' - ); - public static function getters() { return self::$getters; @@ -125,7 +127,7 @@ class AdditionalPropertiesClass implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -144,7 +146,7 @@ class AdditionalPropertiesClass implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -259,5 +261,3 @@ class AdditionalPropertiesClass implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php index a2fec72d3d5..4f4bd9126ba 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php @@ -47,7 +47,7 @@ use \ArrayAccess; * Animal Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,10 +65,10 @@ class Animal implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'class_name' => 'string', 'color' => 'string' - ); + ]; public static function swaggerTypes() { @@ -79,39 +79,41 @@ class Animal implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'class_name' => 'setClassName', - 'color' => 'setColor' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'class_name' => 'getClassName', - 'color' => 'getColor' - ); - public static function getters() { return self::$getters; @@ -125,7 +127,7 @@ class Animal implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -148,7 +150,7 @@ class Animal implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; if ($this->container['class_name'] === null) { $invalid_properties[] = "'class_name' can't be null"; } @@ -269,5 +271,3 @@ class Animal implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php index 9bcfa87c49f..cf65a9cdc1a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php @@ -47,7 +47,7 @@ use \ArrayAccess; * AnimalFarm Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,9 +65,9 @@ class AnimalFarm implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ - ); + ]; public static function swaggerTypes() { @@ -78,36 +78,38 @@ class AnimalFarm implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + protected static $attributeMap = [ - ); + ]; + + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + + ]; + + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - - ); - public static function getters() { return self::$getters; @@ -121,7 +123,7 @@ class AnimalFarm implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -138,7 +140,7 @@ class AnimalFarm implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -211,5 +213,3 @@ class AnimalFarm implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php index 106e917400e..edd3dcee547 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php @@ -47,7 +47,7 @@ use \ArrayAccess; * ApiResponse Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,11 +65,11 @@ class ApiResponse implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'code' => 'int', 'type' => 'string', 'message' => 'string' - ); + ]; public static function swaggerTypes() { @@ -80,42 +80,44 @@ class ApiResponse implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'code' => 'setCode', - 'type' => 'setType', - 'message' => 'setMessage' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'code' => 'getCode', - 'type' => 'getType', - 'message' => 'getMessage' - ); - public static function getters() { return self::$getters; @@ -129,7 +131,7 @@ class ApiResponse implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -149,7 +151,7 @@ class ApiResponse implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -285,5 +287,3 @@ class ApiResponse implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ArrayOfArrayOfNumberOnly.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ArrayOfArrayOfNumberOnly.php index 3b2375cf14d..ecb06038a08 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ArrayOfArrayOfNumberOnly.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ArrayOfArrayOfNumberOnly.php @@ -47,7 +47,7 @@ use \ArrayAccess; * ArrayOfArrayOfNumberOnly Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,9 +65,9 @@ class ArrayOfArrayOfNumberOnly implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'array_array_number' => 'float[][]' - ); + ]; public static function swaggerTypes() { @@ -78,36 +78,38 @@ class ArrayOfArrayOfNumberOnly implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'array_array_number' => 'setArrayArrayNumber' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'array_array_number' => 'getArrayArrayNumber' - ); - public static function getters() { return self::$getters; @@ -121,7 +123,7 @@ class ArrayOfArrayOfNumberOnly implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -139,7 +141,7 @@ class ArrayOfArrayOfNumberOnly implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -233,5 +235,3 @@ class ArrayOfArrayOfNumberOnly implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ArrayOfNumberOnly.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ArrayOfNumberOnly.php index 98ba2ab632f..961af5b039f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ArrayOfNumberOnly.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ArrayOfNumberOnly.php @@ -47,7 +47,7 @@ use \ArrayAccess; * ArrayOfNumberOnly Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,9 +65,9 @@ class ArrayOfNumberOnly implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'array_number' => 'float[]' - ); + ]; public static function swaggerTypes() { @@ -78,36 +78,38 @@ class ArrayOfNumberOnly implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'array_number' => 'setArrayNumber' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'array_number' => 'getArrayNumber' - ); - public static function getters() { return self::$getters; @@ -121,7 +123,7 @@ class ArrayOfNumberOnly implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -139,7 +141,7 @@ class ArrayOfNumberOnly implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -233,5 +235,3 @@ class ArrayOfNumberOnly implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ArrayTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ArrayTest.php index 1a9a646c11e..790cf9fdaf5 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ArrayTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ArrayTest.php @@ -47,7 +47,7 @@ use \ArrayAccess; * ArrayTest Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,11 +65,11 @@ class ArrayTest implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'array_of_string' => 'string[]', 'array_array_of_integer' => 'int[][]', 'array_array_of_model' => '\Swagger\Client\Model\ReadOnlyFirst[][]' - ); + ]; public static function swaggerTypes() { @@ -80,42 +80,44 @@ class ArrayTest implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'array_of_string' => 'setArrayOfString', - 'array_array_of_integer' => 'setArrayArrayOfInteger', - 'array_array_of_model' => 'setArrayArrayOfModel' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'array_of_string' => 'getArrayOfString', - 'array_array_of_integer' => 'getArrayArrayOfInteger', - 'array_array_of_model' => 'getArrayArrayOfModel' - ); - public static function getters() { return self::$getters; @@ -129,7 +131,7 @@ class ArrayTest implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -149,7 +151,7 @@ class ArrayTest implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -285,5 +287,3 @@ class ArrayTest implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php index 349ac54deb6..a7ff369dd9c 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php @@ -47,7 +47,7 @@ use \ArrayAccess; * Cat Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,9 +65,9 @@ class Cat extends Animal implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'declawed' => 'bool' - ); + ]; public static function swaggerTypes() { @@ -78,36 +78,38 @@ class Cat extends Animal implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return parent::attributeMap() + self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'declawed' => 'setDeclawed' - ); - public static function setters() { return parent::setters() + self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'declawed' => 'getDeclawed' - ); - public static function getters() { return parent::getters() + self::$getters; @@ -121,7 +123,7 @@ class Cat extends Animal implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -141,7 +143,7 @@ class Cat extends Animal implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -235,5 +237,3 @@ class Cat extends Animal implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php index c175e72cf8c..7a1f6d1da1b 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php @@ -47,7 +47,7 @@ use \ArrayAccess; * Category Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,10 +65,10 @@ class Category implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'id' => 'int', 'name' => 'string' - ); + ]; public static function swaggerTypes() { @@ -79,39 +79,41 @@ class Category implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'id' => 'setId', - 'name' => 'setName' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'id' => 'getId', - 'name' => 'getName' - ); - public static function getters() { return self::$getters; @@ -125,7 +127,7 @@ class Category implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -144,7 +146,7 @@ class Category implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -259,5 +261,3 @@ class Category implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Client.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Client.php index cd77d1a33e9..9cb921373be 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Client.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Client.php @@ -47,7 +47,7 @@ use \ArrayAccess; * Client Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,9 +65,9 @@ class Client implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'client' => 'string' - ); + ]; public static function swaggerTypes() { @@ -78,36 +78,38 @@ class Client implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'client' => 'setClient' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'client' => 'getClient' - ); - public static function getters() { return self::$getters; @@ -121,7 +123,7 @@ class Client implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -139,7 +141,7 @@ class Client implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -233,5 +235,3 @@ class Client implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php index 6063cb34f0c..387a4ddb076 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php @@ -47,7 +47,7 @@ use \ArrayAccess; * Dog Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,9 +65,9 @@ class Dog extends Animal implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'breed' => 'string' - ); + ]; public static function swaggerTypes() { @@ -78,36 +78,38 @@ class Dog extends Animal implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return parent::attributeMap() + self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'breed' => 'setBreed' - ); - public static function setters() { return parent::setters() + self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'breed' => 'getBreed' - ); - public static function getters() { return parent::getters() + self::$getters; @@ -121,7 +123,7 @@ class Dog extends Animal implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -141,7 +143,7 @@ class Dog extends Animal implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -235,5 +237,3 @@ class Dog extends Animal implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumArrays.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumArrays.php index 77334dfdee9..4287780f2a5 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumArrays.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumArrays.php @@ -47,7 +47,7 @@ use \ArrayAccess; * EnumArrays Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,10 +65,10 @@ class EnumArrays implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'just_symbol' => 'string', 'array_enum' => 'string[]' - ); + ]; public static function swaggerTypes() { @@ -79,39 +79,41 @@ class EnumArrays implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'just_symbol' => 'setJustSymbol', - 'array_enum' => 'setArrayEnum' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'just_symbol' => 'getJustSymbol', - 'array_enum' => 'getArrayEnum' - ); - public static function getters() { return self::$getters; @@ -153,7 +155,7 @@ class EnumArrays implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -172,8 +174,8 @@ class EnumArrays implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); - $allowed_values = array(">=", "$"); + $invalid_properties = []; + $allowed_values = [">=", "$"]; if (!in_array($this->container['just_symbol'], $allowed_values)) { $invalid_properties[] = "invalid value for 'just_symbol', must be one of #{allowed_values}."; } @@ -189,7 +191,7 @@ class EnumArrays implements ArrayAccess */ public function valid() { - $allowed_values = array(">=", "$"); + $allowed_values = [">=", "$"]; if (!in_array($this->container['just_symbol'], $allowed_values)) { return false; } @@ -304,5 +306,3 @@ class EnumArrays implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php index 2bee3c3960b..33c8405a7eb 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php @@ -47,7 +47,7 @@ use \ArrayAccess; * EnumClass Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -61,5 +61,3 @@ class EnumClass { } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php index cf927c088cf..dbc63779de5 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php @@ -47,7 +47,7 @@ use \ArrayAccess; * EnumTest Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,11 +65,11 @@ class EnumTest implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'enum_string' => 'string', 'enum_integer' => 'int', 'enum_number' => 'double' - ); + ]; public static function swaggerTypes() { @@ -80,42 +80,44 @@ class EnumTest implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + protected static $attributeMap = [ 'enum_string' => 'enum_string', 'enum_integer' => 'enum_integer', 'enum_number' => 'enum_number' - ); + ]; + + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'enum_string' => 'setEnumString', + 'enum_integer' => 'setEnumInteger', + 'enum_number' => 'setEnumNumber' + ]; + + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'enum_string' => 'getEnumString', + 'enum_integer' => 'getEnumInteger', + 'enum_number' => 'getEnumNumber' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'enum_string' => 'setEnumString', - 'enum_integer' => 'setEnumInteger', - 'enum_number' => 'setEnumNumber' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'enum_string' => 'getEnumString', - 'enum_integer' => 'getEnumInteger', - 'enum_number' => 'getEnumNumber' - ); - public static function getters() { return self::$getters; @@ -171,7 +173,7 @@ class EnumTest implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -191,18 +193,18 @@ class EnumTest implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); - $allowed_values = array("UPPER", "lower"); + $invalid_properties = []; + $allowed_values = ["UPPER", "lower"]; if (!in_array($this->container['enum_string'], $allowed_values)) { $invalid_properties[] = "invalid value for 'enum_string', must be one of #{allowed_values}."; } - $allowed_values = array("1", "-1"); + $allowed_values = ["1", "-1"]; if (!in_array($this->container['enum_integer'], $allowed_values)) { $invalid_properties[] = "invalid value for 'enum_integer', must be one of #{allowed_values}."; } - $allowed_values = array("1.1", "-1.2"); + $allowed_values = ["1.1", "-1.2"]; if (!in_array($this->container['enum_number'], $allowed_values)) { $invalid_properties[] = "invalid value for 'enum_number', must be one of #{allowed_values}."; } @@ -218,15 +220,15 @@ class EnumTest implements ArrayAccess */ public function valid() { - $allowed_values = array("UPPER", "lower"); + $allowed_values = ["UPPER", "lower"]; if (!in_array($this->container['enum_string'], $allowed_values)) { return false; } - $allowed_values = array("1", "-1"); + $allowed_values = ["1", "-1"]; if (!in_array($this->container['enum_integer'], $allowed_values)) { return false; } - $allowed_values = array("1.1", "-1.2"); + $allowed_values = ["1.1", "-1.2"]; if (!in_array($this->container['enum_number'], $allowed_values)) { return false; } @@ -366,5 +368,3 @@ class EnumTest implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php index d97ea3b8b8b..76a944104f2 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php @@ -47,7 +47,7 @@ use \ArrayAccess; * FormatTest Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,7 +65,7 @@ class FormatTest implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'integer' => 'int', 'int32' => 'int', 'int64' => 'int', @@ -79,7 +79,7 @@ class FormatTest implements ArrayAccess 'date_time' => '\DateTime', 'uuid' => 'string', 'password' => 'string' - ); + ]; public static function swaggerTypes() { @@ -90,7 +90,7 @@ class FormatTest implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + protected static $attributeMap = [ 'integer' => 'integer', 'int32' => 'int32', 'int64' => 'int64', @@ -104,18 +104,14 @@ class FormatTest implements ArrayAccess 'date_time' => 'dateTime', 'uuid' => 'uuid', 'password' => 'password' - ); + ]; - public static function attributeMap() - { - return self::$attributeMap; - } /** * Array of attributes to setter functions (for deserialization of responses) * @var string[] */ - protected static $setters = array( + protected static $setters = [ 'integer' => 'setInteger', 'int32' => 'setInt32', 'int64' => 'setInt64', @@ -129,18 +125,14 @@ class FormatTest implements ArrayAccess 'date_time' => 'setDateTime', 'uuid' => 'setUuid', 'password' => 'setPassword' - ); + ]; - public static function setters() - { - return self::$setters; - } /** * Array of attributes to getter functions (for serialization of requests) * @var string[] */ - protected static $getters = array( + protected static $getters = [ 'integer' => 'getInteger', 'int32' => 'getInt32', 'int64' => 'getInt64', @@ -154,7 +146,17 @@ class FormatTest implements ArrayAccess 'date_time' => 'getDateTime', 'uuid' => 'getUuid', 'password' => 'getPassword' - ); + ]; + + public static function attributeMap() + { + return self::$attributeMap; + } + + public static function setters() + { + return self::$setters; + } public static function getters() { @@ -169,7 +171,7 @@ class FormatTest implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -199,7 +201,7 @@ class FormatTest implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; if (!is_null($this->container['integer']) && ($this->container['integer'] > 100.0)) { $invalid_properties[] = "invalid value for 'integer', must be smaller than or equal to 100.0."; } @@ -712,5 +714,3 @@ class FormatTest implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/HasOnlyReadOnly.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/HasOnlyReadOnly.php index e099dd19137..f8f0e901a76 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/HasOnlyReadOnly.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/HasOnlyReadOnly.php @@ -47,7 +47,7 @@ use \ArrayAccess; * HasOnlyReadOnly Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,10 +65,10 @@ class HasOnlyReadOnly implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'bar' => 'string', 'foo' => 'string' - ); + ]; public static function swaggerTypes() { @@ -79,39 +79,41 @@ class HasOnlyReadOnly implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'bar' => 'setBar', - 'foo' => 'setFoo' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'bar' => 'getBar', - 'foo' => 'getFoo' - ); - public static function getters() { return self::$getters; @@ -125,7 +127,7 @@ class HasOnlyReadOnly implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -144,7 +146,7 @@ class HasOnlyReadOnly implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -259,5 +261,3 @@ class HasOnlyReadOnly implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/MapTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/MapTest.php index 2c464db1fc1..787447c416a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/MapTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/MapTest.php @@ -47,7 +47,7 @@ use \ArrayAccess; * MapTest Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,10 +65,10 @@ class MapTest implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'map_map_of_string' => 'map[string,map[string,string]]', 'map_of_enum_string' => 'map[string,string]' - ); + ]; public static function swaggerTypes() { @@ -79,39 +79,41 @@ class MapTest implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + protected static $attributeMap = [ 'map_map_of_string' => 'map_map_of_string', 'map_of_enum_string' => 'map_of_enum_string' - ); + ]; + + + /** + * 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' + ]; + + + /** + * 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'map_map_of_string' => 'setMapMapOfString', - 'map_of_enum_string' => 'setMapOfEnumString' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'map_map_of_string' => 'getMapMapOfString', - 'map_of_enum_string' => 'getMapOfEnumString' - ); - public static function getters() { return self::$getters; @@ -139,7 +141,7 @@ class MapTest implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -158,7 +160,7 @@ class MapTest implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -277,5 +279,3 @@ class MapTest implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php index 7fe26b551a8..3d4bbad56cb 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php @@ -47,7 +47,7 @@ use \ArrayAccess; * MixedPropertiesAndAdditionalPropertiesClass Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,11 +65,11 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'uuid' => 'string', 'date_time' => '\DateTime', 'map' => 'map[string,\Swagger\Client\Model\Animal]' - ); + ]; public static function swaggerTypes() { @@ -80,42 +80,44 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'uuid' => 'setUuid', - 'date_time' => 'setDateTime', - 'map' => 'setMap' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'uuid' => 'getUuid', - 'date_time' => 'getDateTime', - 'map' => 'getMap' - ); - public static function getters() { return self::$getters; @@ -129,7 +131,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -149,7 +151,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -285,5 +287,3 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php index d4d5fe73302..8dd86b5e5b3 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php @@ -48,7 +48,7 @@ use \ArrayAccess; * * @category Class */ // @description Model for testing model name starting with number -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -66,10 +66,10 @@ class Model200Response implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'name' => 'int', 'class' => 'string' - ); + ]; public static function swaggerTypes() { @@ -80,39 +80,41 @@ class Model200Response implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'name' => 'setName', - 'class' => 'setClass' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'name' => 'getName', - 'class' => 'getClass' - ); - public static function getters() { return self::$getters; @@ -126,7 +128,7 @@ class Model200Response implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -145,7 +147,7 @@ class Model200Response implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -260,5 +262,3 @@ class Model200Response implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelList.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelList.php index e298fad6faa..885b2dd0417 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelList.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelList.php @@ -47,7 +47,7 @@ use \ArrayAccess; * ModelList Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,9 +65,9 @@ class ModelList implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ '_123_list' => 'string' - ); + ]; public static function swaggerTypes() { @@ -78,36 +78,38 @@ class ModelList implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - '_123_list' => 'set123List' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - '_123_list' => 'get123List' - ); - public static function getters() { return self::$getters; @@ -121,7 +123,7 @@ class ModelList implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -139,7 +141,7 @@ class ModelList implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -233,5 +235,3 @@ class ModelList implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php index 2fee28c2c55..128d0551db0 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php @@ -48,7 +48,7 @@ use \ArrayAccess; * * @category Class */ // @description Model for testing reserved words -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -66,9 +66,9 @@ class ModelReturn implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'return' => 'int' - ); + ]; public static function swaggerTypes() { @@ -79,36 +79,38 @@ class ModelReturn implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'return' => 'setReturn' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'return' => 'getReturn' - ); - public static function getters() { return self::$getters; @@ -122,7 +124,7 @@ class ModelReturn implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -140,7 +142,7 @@ class ModelReturn implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -234,5 +236,3 @@ class ModelReturn implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php index 68f53478a0d..483859c19ef 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php @@ -48,7 +48,7 @@ use \ArrayAccess; * * @category Class */ // @description Model for testing model name same as property name -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -66,12 +66,12 @@ class Name implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'name' => 'int', 'snake_case' => 'int', 'property' => 'string', '_123_number' => 'int' - ); + ]; public static function swaggerTypes() { @@ -82,45 +82,47 @@ class Name implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'name' => 'setName', - 'snake_case' => 'setSnakeCase', - 'property' => 'setProperty', - '_123_number' => 'set123Number' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'name' => 'getName', - 'snake_case' => 'getSnakeCase', - 'property' => 'getProperty', - '_123_number' => 'get123Number' - ); - public static function getters() { return self::$getters; @@ -134,7 +136,7 @@ class Name implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -155,7 +157,7 @@ class Name implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; if ($this->container['name'] === null) { $invalid_properties[] = "'name' can't be null"; } @@ -318,5 +320,3 @@ class Name implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/NumberOnly.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/NumberOnly.php index 629b6b406c1..1012a0cceb8 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/NumberOnly.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/NumberOnly.php @@ -47,7 +47,7 @@ use \ArrayAccess; * NumberOnly Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,9 +65,9 @@ class NumberOnly implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'just_number' => 'float' - ); + ]; public static function swaggerTypes() { @@ -78,36 +78,38 @@ class NumberOnly implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'just_number' => 'setJustNumber' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'just_number' => 'getJustNumber' - ); - public static function getters() { return self::$getters; @@ -121,7 +123,7 @@ class NumberOnly implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -139,7 +141,7 @@ class NumberOnly implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -233,5 +235,3 @@ class NumberOnly implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php index f530d91f930..4daa3318040 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -47,7 +47,7 @@ use \ArrayAccess; * Order Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,14 +65,14 @@ class Order implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'id' => 'int', 'pet_id' => 'int', 'quantity' => 'int', 'ship_date' => '\DateTime', 'status' => 'string', 'complete' => 'bool' - ); + ]; public static function swaggerTypes() { @@ -83,50 +83,52 @@ class Order implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + protected static $attributeMap = [ 'id' => 'id', 'pet_id' => 'petId', 'quantity' => 'quantity', 'ship_date' => 'shipDate', 'status' => 'status', 'complete' => 'complete' - ); + ]; - public static function attributeMap() - { - return self::$attributeMap; - } /** * Array of attributes to setter functions (for deserialization of responses) * @var string[] */ - protected static $setters = array( + protected static $setters = [ 'id' => 'setId', 'pet_id' => 'setPetId', 'quantity' => 'setQuantity', 'ship_date' => 'setShipDate', 'status' => 'setStatus', 'complete' => 'setComplete' - ); + ]; - public static function setters() - { - return self::$setters; - } /** * Array of attributes to getter functions (for serialization of requests) * @var string[] */ - protected static $getters = array( + protected static $getters = [ 'id' => 'getId', 'pet_id' => 'getPetId', 'quantity' => 'getQuantity', 'ship_date' => 'getShipDate', 'status' => 'getStatus', 'complete' => 'getComplete' - ); + ]; + + public static function attributeMap() + { + return self::$attributeMap; + } + + public static function setters() + { + return self::$setters; + } public static function getters() { @@ -157,7 +159,7 @@ class Order implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -180,8 +182,8 @@ class Order implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); - $allowed_values = array("placed", "approved", "delivered"); + $invalid_properties = []; + $allowed_values = ["placed", "approved", "delivered"]; if (!in_array($this->container['status'], $allowed_values)) { $invalid_properties[] = "invalid value for 'status', must be one of #{allowed_values}."; } @@ -197,7 +199,7 @@ class Order implements ArrayAccess */ public function valid() { - $allowed_values = array("placed", "approved", "delivered"); + $allowed_values = ["placed", "approved", "delivered"]; if (!in_array($this->container['status'], $allowed_values)) { return false; } @@ -392,5 +394,3 @@ class Order implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php index e3248c87ee9..bdd0aedae08 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -47,7 +47,7 @@ use \ArrayAccess; * Pet Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,14 +65,14 @@ class Pet implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'id' => 'int', 'category' => '\Swagger\Client\Model\Category', 'name' => 'string', 'photo_urls' => 'string[]', 'tags' => '\Swagger\Client\Model\Tag[]', 'status' => 'string' - ); + ]; public static function swaggerTypes() { @@ -83,50 +83,52 @@ class Pet implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + protected static $attributeMap = [ 'id' => 'id', 'category' => 'category', 'name' => 'name', 'photo_urls' => 'photoUrls', 'tags' => 'tags', 'status' => 'status' - ); + ]; - public static function attributeMap() - { - return self::$attributeMap; - } /** * Array of attributes to setter functions (for deserialization of responses) * @var string[] */ - protected static $setters = array( + protected static $setters = [ 'id' => 'setId', 'category' => 'setCategory', 'name' => 'setName', 'photo_urls' => 'setPhotoUrls', 'tags' => 'setTags', 'status' => 'setStatus' - ); + ]; - public static function setters() - { - return self::$setters; - } /** * Array of attributes to getter functions (for serialization of requests) * @var string[] */ - protected static $getters = array( + protected static $getters = [ 'id' => 'getId', 'category' => 'getCategory', 'name' => 'getName', 'photo_urls' => 'getPhotoUrls', 'tags' => 'getTags', 'status' => 'getStatus' - ); + ]; + + public static function attributeMap() + { + return self::$attributeMap; + } + + public static function setters() + { + return self::$setters; + } public static function getters() { @@ -157,7 +159,7 @@ class Pet implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -180,14 +182,14 @@ class Pet implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; if ($this->container['name'] === null) { $invalid_properties[] = "'name' can't be null"; } if ($this->container['photo_urls'] === null) { $invalid_properties[] = "'photo_urls' can't be null"; } - $allowed_values = array("available", "pending", "sold"); + $allowed_values = ["available", "pending", "sold"]; if (!in_array($this->container['status'], $allowed_values)) { $invalid_properties[] = "invalid value for 'status', must be one of #{allowed_values}."; } @@ -209,7 +211,7 @@ class Pet implements ArrayAccess if ($this->container['photo_urls'] === null) { return false; } - $allowed_values = array("available", "pending", "sold"); + $allowed_values = ["available", "pending", "sold"]; if (!in_array($this->container['status'], $allowed_values)) { return false; } @@ -404,5 +406,3 @@ class Pet implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ReadOnlyFirst.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ReadOnlyFirst.php index 07d09f264ab..44ecad811c4 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ReadOnlyFirst.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ReadOnlyFirst.php @@ -47,7 +47,7 @@ use \ArrayAccess; * ReadOnlyFirst Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,10 +65,10 @@ class ReadOnlyFirst implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'bar' => 'string', 'baz' => 'string' - ); + ]; public static function swaggerTypes() { @@ -79,39 +79,41 @@ class ReadOnlyFirst implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'bar' => 'setBar', - 'baz' => 'setBaz' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'bar' => 'getBar', - 'baz' => 'getBaz' - ); - public static function getters() { return self::$getters; @@ -125,7 +127,7 @@ class ReadOnlyFirst implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -144,7 +146,7 @@ class ReadOnlyFirst implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -259,5 +261,3 @@ class ReadOnlyFirst implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php index 9f638160b87..e6a055551f7 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php @@ -47,7 +47,7 @@ use \ArrayAccess; * SpecialModelName Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,9 +65,9 @@ class SpecialModelName implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'special_property_name' => 'int' - ); + ]; public static function swaggerTypes() { @@ -78,36 +78,38 @@ class SpecialModelName implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'special_property_name' => 'setSpecialPropertyName' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'special_property_name' => 'getSpecialPropertyName' - ); - public static function getters() { return self::$getters; @@ -121,7 +123,7 @@ class SpecialModelName implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -139,7 +141,7 @@ class SpecialModelName implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -233,5 +235,3 @@ class SpecialModelName implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php index bcf4cad8840..cb8c2e0a82b 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php @@ -47,7 +47,7 @@ use \ArrayAccess; * Tag Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,10 +65,10 @@ class Tag implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'id' => 'int', 'name' => 'string' - ); + ]; public static function swaggerTypes() { @@ -79,39 +79,41 @@ class Tag implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + 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' + ]; public static function attributeMap() { return self::$attributeMap; } - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = array( - 'id' => 'setId', - 'name' => 'setName' - ); - public static function setters() { return self::$setters; } - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = array( - 'id' => 'getId', - 'name' => 'getName' - ); - public static function getters() { return self::$getters; @@ -125,7 +127,7 @@ class Tag implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -144,7 +146,7 @@ class Tag implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -259,5 +261,3 @@ class Tag implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php index 0f07b84c954..504eb71204f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php @@ -47,7 +47,7 @@ use \ArrayAccess; * User Class Doc Comment * * @category Class */ -/** +/** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 @@ -65,7 +65,7 @@ class User implements ArrayAccess * Array of property to type mappings. Used for (de)serialization * @var string[] */ - protected static $swaggerTypes = array( + protected static $swaggerTypes = [ 'id' => 'int', 'username' => 'string', 'first_name' => 'string', @@ -74,7 +74,7 @@ class User implements ArrayAccess 'password' => 'string', 'phone' => 'string', 'user_status' => 'int' - ); + ]; public static function swaggerTypes() { @@ -85,7 +85,7 @@ class User implements ArrayAccess * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ - protected static $attributeMap = array( + protected static $attributeMap = [ 'id' => 'id', 'username' => 'username', 'first_name' => 'firstName', @@ -94,18 +94,14 @@ class User implements ArrayAccess 'password' => 'password', 'phone' => 'phone', 'user_status' => 'userStatus' - ); + ]; - public static function attributeMap() - { - return self::$attributeMap; - } /** * Array of attributes to setter functions (for deserialization of responses) * @var string[] */ - protected static $setters = array( + protected static $setters = [ 'id' => 'setId', 'username' => 'setUsername', 'first_name' => 'setFirstName', @@ -114,18 +110,14 @@ class User implements ArrayAccess 'password' => 'setPassword', 'phone' => 'setPhone', 'user_status' => 'setUserStatus' - ); + ]; - public static function setters() - { - return self::$setters; - } /** * Array of attributes to getter functions (for serialization of requests) * @var string[] */ - protected static $getters = array( + protected static $getters = [ 'id' => 'getId', 'username' => 'getUsername', 'first_name' => 'getFirstName', @@ -134,7 +126,17 @@ class User implements ArrayAccess 'password' => 'getPassword', 'phone' => 'getPhone', 'user_status' => 'getUserStatus' - ); + ]; + + public static function attributeMap() + { + return self::$attributeMap; + } + + public static function setters() + { + return self::$setters; + } public static function getters() { @@ -149,7 +151,7 @@ class User implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array(); + protected $container = []; /** * Constructor @@ -174,7 +176,7 @@ class User implements ArrayAccess */ public function listInvalidProperties() { - $invalid_properties = array(); + $invalid_properties = []; return $invalid_properties; } @@ -415,5 +417,3 @@ class User implements ArrayAccess return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php index 6a74bf2e072..f1dd03e2056 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php @@ -52,7 +52,6 @@ namespace Swagger\Client; */ class ObjectSerializer { - /** * Serialize data * @@ -72,7 +71,7 @@ class ObjectSerializer } return $data; } elseif (is_object($data)) { - $values = array(); + $values = []; foreach (array_keys($data::swaggerTypes()) as $property) { $getter = $data::getters()[$property]; if ($data->$getter() !== null) { @@ -234,7 +233,7 @@ class ObjectSerializer return null; } elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int] $inner = substr($class, 4, -1); - $deserialized = array(); + $deserialized = []; if (strrpos($inner, ",") !== false) { $subClass_array = explode(',', $inner, 2); $subClass = $subClass_array[1]; @@ -243,9 +242,9 @@ class ObjectSerializer } } return $deserialized; - } elseif (strcasecmp(substr($class, -2), '[]') == 0) { + } elseif (strcasecmp(substr($class, -2), '[]') === 0) { $subClass = substr($class, 0, -2); - $values = array(); + $values = []; foreach ($data as $key => $value) { $values[] = self::deserialize($value, $subClass, null, $discriminator); } @@ -265,7 +264,7 @@ class ObjectSerializer } else { return null; } - } elseif (in_array($class, array('DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'))) { + } elseif (in_array($class, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { settype($data, $class); return $data; } elseif ($class === '\SplFileObject') { @@ -278,7 +277,6 @@ class ObjectSerializer } $deserialized = new \SplFileObject($filename, "w"); $byte_written = $deserialized->fwrite($data); - if (Configuration::getDefaultConfiguration()->getDebug()) { error_log("[DEBUG] Written $byte_written byte to $filename. Please move the file to a proper folder or delete the temp file after processing.".PHP_EOL, 3, Configuration::getDefaultConfiguration()->getDebugFile()); }