[PHP] Validate parent's model first, if any (#4659)

* if model has parent, valid() & listInvalidProperties() will check the parents' first

* Run the ./bin/security/php-petstore.sh
This commit is contained in:
Ainun Nazieb 2017-01-26 21:49:38 +07:00 committed by wing328
parent c0fb30d491
commit 05eea2436c
42 changed files with 846 additions and 141 deletions

View File

@ -117,7 +117,13 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
*/
public function listInvalidProperties()
{
{{#parent}}
$invalid_properties = parent::listInvalidProperties();
{{/parent}}
{{^parent}}
$invalid_properties = [];
{{/parent}}
{{#vars}}
{{#required}}
if ($this->container['{{name}}'] === null) {
@ -185,10 +191,16 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
{{#parent}}
if (!parent::valid()) {
return false;
}
{{/parent}}
{{#vars}}
{{#required}}
if ($this->container['{{name}}'] === null) {

View File

@ -4,7 +4,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod
This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
- Build package: io.swagger.codegen.languages.PhpClientCodegen
## Requirements

View File

@ -9,17 +9,6 @@
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**

View File

@ -8,7 +8,7 @@
"api"
],
"homepage": "http://swagger.io",
"license": "Apache-2.0",
"license": "proprietary",
"authors": [
{
"name": "Swagger and contributors",

View File

@ -5,8 +5,7 @@
*
* @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
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
@ -19,17 +18,6 @@
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
@ -50,8 +38,7 @@ use \Swagger\Client\ObjectSerializer;
*
* @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
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
class FakeApi
@ -72,7 +59,6 @@ class FakeApi
{
if ($apiClient === null) {
$apiClient = new ApiClient();
$apiClient->getConfig()->setHost('https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r');
}
$this->apiClient = $apiClient;

View File

@ -6,8 +6,7 @@
*
* @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
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
@ -20,17 +19,6 @@
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
@ -46,8 +34,7 @@ namespace Swagger\Client;
*
* @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
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
class ApiClient
@ -176,6 +163,11 @@ class ApiClient
if ($this->config->getCurlTimeout() !== 0) {
curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout());
}
// set connect timeout, if needed
if ($this->config->getCurlConnectTimeout() != 0) {
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $this->config->getCurlConnectTimeout());
}
// return the result on success, rather than just true
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
@ -187,6 +179,22 @@ class ApiClient
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
}
if ($this->config->getCurlProxyHost()) {
curl_setopt($curl, CURLOPT_PROXY, $this->config->getCurlProxyHost());
}
if ($this->config->getCurlProxyPort()) {
curl_setopt($curl, CURLOPT_PROXYPORT, $this->config->getCurlProxyPort());
}
if ($this->config->getCurlProxyType()) {
curl_setopt($curl, CURLOPT_PROXYTYPE, $this->config->getCurlProxyType());
}
if ($this->config->getCurlProxyUser()) {
curl_setopt($curl, CURLOPT_PROXYUSERPWD, $this->config->getCurlProxyUser() . ':' .$this->config->getCurlProxyPassword());
}
if (!empty($queryParams)) {
$url = ($url . '?' . http_build_query($queryParams));
}

View File

@ -5,8 +5,7 @@
*
* @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
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
@ -19,17 +18,6 @@
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
@ -47,8 +35,7 @@ use \Exception;
*
* @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
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
class ApiException extends Exception

View File

@ -5,8 +5,7 @@
*
* @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
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
@ -19,17 +18,6 @@
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
@ -46,8 +34,7 @@ namespace Swagger\Client;
*
* @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
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
class Configuration
@ -110,6 +97,13 @@ class Configuration
*/
protected $curlTimeout = 0;
/**
* Timeout (second) of the HTTP connection, by default set to 0, no timeout
*
* @var string
*/
protected $curlConnectTimeout = 0;
/**
* User agent of the HTTP request, set to "PHP-Swagger" by default
*
@ -147,6 +141,42 @@ class Configuration
*/
protected $sslVerification = true;
/**
* Curl proxy host
*
* @var string
*/
protected $proxyHost;
/**
* Curl proxy port
*
* @var integer
*/
protected $proxyPort;
/**
* Curl proxy type, e.g. CURLPROXY_HTTP or CURLPROXY_SOCKS5
*
* @see https://secure.php.net/manual/en/function.curl-setopt.php
* @var integer
*/
protected $proxyType;
/**
* Curl proxy username
*
* @var string
*/
protected $proxyUser;
/**
* Curl proxy password
*
* @var string
*/
protected $proxyPassword;
/**
* Constructor
*/
@ -393,6 +423,149 @@ class Configuration
return $this->curlTimeout;
}
/**
* Sets the HTTP connect timeout value
*
* @param integer $seconds Number of seconds before connection times out [set to 0 for no timeout]
*
* @return Configuration
*/
public function setCurlConnectTimeout($seconds)
{
if (!is_numeric($seconds) || $seconds < 0) {
throw new \InvalidArgumentException('Connect timeout value must be numeric and a non-negative number.');
}
$this->curlConnectTimeout = $seconds;
return $this;
}
/**
* Gets the HTTP connect timeout value
*
* @return string HTTP connect timeout value
*/
public function getCurlConnectTimeout()
{
return $this->curlConnectTimeout;
}
/**
* Sets the HTTP Proxy Host
*
* @param string $proxyHost HTTP Proxy URL
*
* @return ApiClient
*/
public function setCurlProxyHost($proxyHost)
{
$this->proxyHost = $proxyHost;
return $this;
}
/**
* Gets the HTTP Proxy Host
*
* @return string
*/
public function getCurlProxyHost()
{
return $this->proxyHost;
}
/**
* Sets the HTTP Proxy Port
*
* @param integer $proxyPort HTTP Proxy Port
*
* @return ApiClient
*/
public function setCurlProxyPort($proxyPort)
{
$this->proxyPort = $proxyPort;
return $this;
}
/**
* Gets the HTTP Proxy Port
*
* @return integer
*/
public function getCurlProxyPort()
{
return $this->proxyPort;
}
/**
* Sets the HTTP Proxy Type
*
* @param integer $proxyType HTTP Proxy Type
*
* @return ApiClient
*/
public function setCurlProxyType($proxyType)
{
$this->proxyType = $proxyType;
return $this;
}
/**
* Gets the HTTP Proxy Type
*
* @return integer
*/
public function getCurlProxyType()
{
return $this->proxyType;
}
/**
* Sets the HTTP Proxy User
*
* @param string $proxyUser HTTP Proxy User
*
* @return ApiClient
*/
public function setCurlProxyUser($proxyUser)
{
$this->proxyUser = $proxyUser;
return $this;
}
/**
* Gets the HTTP Proxy User
*
* @return string
*/
public function getCurlProxyUser()
{
return $this->proxyUser;
}
/**
* Sets the HTTP Proxy Password
*
* @param string $proxyPassword HTTP Proxy Password
*
* @return ApiClient
*/
public function setCurlProxyPassword($proxyPassword)
{
$this->proxyPassword = $proxyPassword;
return $this;
}
/**
* Gets the HTTP Proxy Password
*
* @return string
*/
public function getCurlProxyPassword()
{
return $this->proxyPassword;
}
/**
* Sets debug flag
*

View File

@ -6,8 +6,7 @@
*
* @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
* @author Swaagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
@ -20,17 +19,6 @@
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
@ -46,12 +34,10 @@ use \ArrayAccess;
/**
* ModelReturn Class Doc Comment
*
* @category Class */
// @description Model for testing reserved words *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
/**
* @category Class
* @description Model for testing reserved words *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
class ModelReturn implements ArrayAccess
@ -145,6 +131,7 @@ class ModelReturn implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -152,10 +139,11 @@ class ModelReturn implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}
@ -239,3 +227,4 @@ class ModelReturn implements ArrayAccess
}
}

View File

@ -6,8 +6,7 @@
*
* @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
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
@ -20,17 +19,6 @@
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
@ -46,8 +34,7 @@ namespace Swagger\Client;
*
* @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
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
class ObjectSerializer

View File

@ -0,0 +1,15 @@
# Capitalization
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**small_camel** | **string** | | [optional]
**capital_camel** | **string** | | [optional]
**small_snake** | **string** | | [optional]
**capital_snake** | **string** | | [optional]
**sca_eth_flow_points** | **string** | | [optional]
**att_name** | **string** | Name of the pet | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -135,6 +135,7 @@ class AdditionalPropertiesClass implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -142,10 +143,11 @@ class AdditionalPropertiesClass implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}

View File

@ -139,6 +139,7 @@ class Animal implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
if ($this->container['class_name'] === null) {
$invalid_properties[] = "'class_name' can't be null";
}
@ -149,10 +150,11 @@ class Animal implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
if ($this->container['class_name'] === null) {
return false;
}

View File

@ -128,7 +128,8 @@ class AnimalFarm implements ArrayAccess
*/
public function listInvalidProperties()
{
$invalid_properties = [];
$invalid_properties = parent::listInvalidProperties();
return $invalid_properties;
}
@ -136,10 +137,14 @@ class AnimalFarm implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
if (!parent::valid()) {
return false;
}
return true;
}

View File

@ -140,6 +140,7 @@ class ApiResponse implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -147,10 +148,11 @@ class ApiResponse implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}

View File

@ -130,6 +130,7 @@ class ArrayOfArrayOfNumberOnly implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -137,10 +138,11 @@ class ArrayOfArrayOfNumberOnly implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}

View File

@ -130,6 +130,7 @@ class ArrayOfNumberOnly implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -137,10 +138,11 @@ class ArrayOfNumberOnly implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}

View File

@ -140,6 +140,7 @@ class ArrayTest implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -147,10 +148,11 @@ class ArrayTest implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}

View File

@ -0,0 +1,359 @@
<?php
/**
* Capitalization
*
* PHP version 5
*
* @category Class
* @package Swagger\Client
* @author Swaagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
/**
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
*/
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
namespace Swagger\Client\Model;
use \ArrayAccess;
/**
* Capitalization Class Doc Comment
*
* @category Class
* @package Swagger\Client
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
class Capitalization implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string
*/
protected static $swaggerModelName = 'Capitalization';
/**
* Array of property to type mappings. Used for (de)serialization
* @var string[]
*/
protected static $swaggerTypes = [
'small_camel' => 'string',
'capital_camel' => 'string',
'small_snake' => 'string',
'capital_snake' => 'string',
'sca_eth_flow_points' => 'string',
'att_name' => 'string'
];
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of attributes where the key is the local name, and the value is the original name
* @var string[]
*/
protected static $attributeMap = [
'small_camel' => 'smallCamel',
'capital_camel' => 'CapitalCamel',
'small_snake' => 'small_Snake',
'capital_snake' => 'Capital_Snake',
'sca_eth_flow_points' => 'SCA_ETH_Flow_Points',
'att_name' => 'ATT_NAME'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
* @var string[]
*/
protected static $setters = [
'small_camel' => 'setSmallCamel',
'capital_camel' => 'setCapitalCamel',
'small_snake' => 'setSmallSnake',
'capital_snake' => 'setCapitalSnake',
'sca_eth_flow_points' => 'setScaEthFlowPoints',
'att_name' => 'setAttName'
];
/**
* Array of attributes to getter functions (for serialization of requests)
* @var string[]
*/
protected static $getters = [
'small_camel' => 'getSmallCamel',
'capital_camel' => 'getCapitalCamel',
'small_snake' => 'getSmallSnake',
'capital_snake' => 'getCapitalSnake',
'sca_eth_flow_points' => 'getScaEthFlowPoints',
'att_name' => 'getAttName'
];
public static function attributeMap()
{
return self::$attributeMap;
}
public static function setters()
{
return self::$setters;
}
public static function getters()
{
return self::$getters;
}
/**
* Associative array for storing property values
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
* @param mixed[] $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
$this->container['small_camel'] = isset($data['small_camel']) ? $data['small_camel'] : null;
$this->container['capital_camel'] = isset($data['capital_camel']) ? $data['capital_camel'] : null;
$this->container['small_snake'] = isset($data['small_snake']) ? $data['small_snake'] : null;
$this->container['capital_snake'] = isset($data['capital_snake']) ? $data['capital_snake'] : null;
$this->container['sca_eth_flow_points'] = isset($data['sca_eth_flow_points']) ? $data['sca_eth_flow_points'] : null;
$this->container['att_name'] = isset($data['att_name']) ? $data['att_name'] : null;
}
/**
* show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
/**
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}
/**
* Gets small_camel
* @return string
*/
public function getSmallCamel()
{
return $this->container['small_camel'];
}
/**
* Sets small_camel
* @param string $small_camel
* @return $this
*/
public function setSmallCamel($small_camel)
{
$this->container['small_camel'] = $small_camel;
return $this;
}
/**
* Gets capital_camel
* @return string
*/
public function getCapitalCamel()
{
return $this->container['capital_camel'];
}
/**
* Sets capital_camel
* @param string $capital_camel
* @return $this
*/
public function setCapitalCamel($capital_camel)
{
$this->container['capital_camel'] = $capital_camel;
return $this;
}
/**
* Gets small_snake
* @return string
*/
public function getSmallSnake()
{
return $this->container['small_snake'];
}
/**
* Sets small_snake
* @param string $small_snake
* @return $this
*/
public function setSmallSnake($small_snake)
{
$this->container['small_snake'] = $small_snake;
return $this;
}
/**
* Gets capital_snake
* @return string
*/
public function getCapitalSnake()
{
return $this->container['capital_snake'];
}
/**
* Sets capital_snake
* @param string $capital_snake
* @return $this
*/
public function setCapitalSnake($capital_snake)
{
$this->container['capital_snake'] = $capital_snake;
return $this;
}
/**
* Gets sca_eth_flow_points
* @return string
*/
public function getScaEthFlowPoints()
{
return $this->container['sca_eth_flow_points'];
}
/**
* Sets sca_eth_flow_points
* @param string $sca_eth_flow_points
* @return $this
*/
public function setScaEthFlowPoints($sca_eth_flow_points)
{
$this->container['sca_eth_flow_points'] = $sca_eth_flow_points;
return $this;
}
/**
* Gets att_name
* @return string
*/
public function getAttName()
{
return $this->container['att_name'];
}
/**
* Sets att_name
* @param string $att_name Name of the pet
* @return $this
*/
public function setAttName($att_name)
{
$this->container['att_name'] = $att_name;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
* @param integer $offset Offset
* @return boolean
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
* @param integer $offset Offset
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
* @param integer $offset Offset
* @param mixed $value Value to be set
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
* @param integer $offset Offset
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
}
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
}
}

View File

@ -131,7 +131,8 @@ class Cat extends Animal implements ArrayAccess
*/
public function listInvalidProperties()
{
$invalid_properties = [];
$invalid_properties = parent::listInvalidProperties();
return $invalid_properties;
}
@ -139,10 +140,14 @@ class Cat extends Animal implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
if (!parent::valid()) {
return false;
}
return true;
}

View File

@ -135,6 +135,7 @@ class Category implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -142,10 +143,11 @@ class Category implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}

View File

@ -131,6 +131,7 @@ class ClassModel implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -138,10 +139,11 @@ class ClassModel implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}

View File

@ -130,6 +130,7 @@ class Client implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -137,10 +138,11 @@ class Client implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}

View File

@ -131,7 +131,8 @@ class Dog extends Animal implements ArrayAccess
*/
public function listInvalidProperties()
{
$invalid_properties = [];
$invalid_properties = parent::listInvalidProperties();
return $invalid_properties;
}
@ -139,10 +140,14 @@ class Dog extends Animal implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
if (!parent::valid()) {
return false;
}
return true;
}

View File

@ -163,6 +163,7 @@ class EnumArrays implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
$allowed_values = [">=", "$"];
if (!in_array($this->container['just_symbol'], $allowed_values)) {
$invalid_properties[] = "invalid value for 'just_symbol', must be one of '>=', '$'.";
@ -175,10 +176,11 @@ class EnumArrays implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
$allowed_values = [">=", "$"];
if (!in_array($this->container['just_symbol'], $allowed_values)) {
return false;

View File

@ -189,6 +189,7 @@ class EnumTest implements ArrayAccess
public function listInvalidProperties()
{
$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 'UPPER', 'lower', ''.";
@ -211,10 +212,11 @@ class EnumTest implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
$allowed_values = ["UPPER", "lower", ""];
if (!in_array($this->container['enum_string'], $allowed_values)) {
return false;

View File

@ -190,6 +190,7 @@ class FormatTest implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
if (!is_null($this->container['integer']) && ($this->container['integer'] > 100)) {
$invalid_properties[] = "invalid value for 'integer', must be smaller than or equal to 100.";
}
@ -261,10 +262,11 @@ class FormatTest implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
if ($this->container['integer'] > 100) {
return false;
}

View File

@ -135,6 +135,7 @@ class HasOnlyReadOnly implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -142,10 +143,11 @@ class HasOnlyReadOnly implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}

View File

@ -149,6 +149,7 @@ class MapTest implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -156,10 +157,11 @@ class MapTest implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}

View File

@ -140,6 +140,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -147,10 +148,11 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}

View File

@ -136,6 +136,7 @@ class Model200Response implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -143,10 +144,11 @@ class Model200Response implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}

View File

@ -130,6 +130,7 @@ class ModelList implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -137,10 +138,11 @@ class ModelList implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}

View File

@ -131,6 +131,7 @@ class ModelReturn implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -138,10 +139,11 @@ class ModelReturn implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}

View File

@ -146,6 +146,7 @@ class Name implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
if ($this->container['name'] === null) {
$invalid_properties[] = "'name' can't be null";
}
@ -156,10 +157,11 @@ class Name implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
if ($this->container['name'] === null) {
return false;
}

View File

@ -130,6 +130,7 @@ class NumberOnly implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -137,10 +138,11 @@ class NumberOnly implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}

View File

@ -171,6 +171,7 @@ class Order implements ArrayAccess
public function listInvalidProperties()
{
$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 'placed', 'approved', 'delivered'.";
@ -183,10 +184,11 @@ class Order implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
$allowed_values = ["placed", "approved", "delivered"];
if (!in_array($this->container['status'], $allowed_values)) {
return false;

View File

@ -171,6 +171,7 @@ class Pet implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
if ($this->container['name'] === null) {
$invalid_properties[] = "'name' can't be null";
}
@ -189,10 +190,11 @@ class Pet implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
if ($this->container['name'] === null) {
return false;
}

View File

@ -135,6 +135,7 @@ class ReadOnlyFirst implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -142,10 +143,11 @@ class ReadOnlyFirst implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}

View File

@ -130,6 +130,7 @@ class SpecialModelName implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -137,10 +138,11 @@ class SpecialModelName implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}

View File

@ -135,6 +135,7 @@ class Tag implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -142,10 +143,11 @@ class Tag implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}

View File

@ -165,6 +165,7 @@ class User implements ArrayAccess
public function listInvalidProperties()
{
$invalid_properties = [];
return $invalid_properties;
}
@ -172,10 +173,11 @@ class User implements ArrayAccess
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
* @return bool True if all properties are valid
*/
public function valid()
{
return true;
}

View File

@ -0,0 +1,133 @@
<?php
/**
* CapitalizationTest
*
* PHP version 5
*
* @category Class
* @package Swagger\Client
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
/**
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
*/
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Please update the test case below to test the model.
*/
namespace Swagger\Client;
/**
* CapitalizationTest Class Doc Comment
*
* @category Class */
// * @description Capitalization
/**
* @package Swagger\Client
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
class CapitalizationTest extends \PHPUnit_Framework_TestCase
{
/**
* Setup before running any test case
*/
public static function setUpBeforeClass()
{
}
/**
* Setup before running each test case
*/
public function setUp()
{
}
/**
* Clean up after running each test case
*/
public function tearDown()
{
}
/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass()
{
}
/**
* Test "Capitalization"
*/
public function testCapitalization()
{
}
/**
* Test attribute "small_camel"
*/
public function testPropertySmallCamel()
{
}
/**
* Test attribute "capital_camel"
*/
public function testPropertyCapitalCamel()
{
}
/**
* Test attribute "small_snake"
*/
public function testPropertySmallSnake()
{
}
/**
* Test attribute "capital_snake"
*/
public function testPropertyCapitalSnake()
{
}
/**
* Test attribute "sca_eth_flow_points"
*/
public function testPropertyScaEthFlowPoints()
{
}
/**
* Test attribute "att_name"
*/
public function testPropertyAttName()
{
}
}