forked from loafle/openapi-generator-original
Merge pull request #2433 from arnested/parent-constructor-and-initialize-discriminator-property
[PHP] Parent constructor
This commit is contained in:
commit
16fe8e84dd
@ -114,6 +114,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
{{#parent}}parent::__construct($data);{{/parent}}
|
||||
if ($data != null) {
|
||||
{{#vars}}$this->{{name}} = $data["{{name}}"];{{#hasMore}}
|
||||
{{/hasMore}}{{/vars}}
|
||||
|
@ -1339,6 +1339,42 @@
|
||||
"xml": {
|
||||
"name": "Name"
|
||||
}
|
||||
},
|
||||
"Dog" : {
|
||||
"allOf" : [ {
|
||||
"$ref" : "#/definitions/Animal"
|
||||
}, {
|
||||
"type" : "object",
|
||||
"properties" : {
|
||||
"breed" : {
|
||||
"type" : "string"
|
||||
}
|
||||
}
|
||||
} ]
|
||||
},
|
||||
"Cat" : {
|
||||
"allOf" : [ {
|
||||
"$ref" : "#/definitions/Animal"
|
||||
}, {
|
||||
"type" : "object",
|
||||
"properties" : {
|
||||
"declawed" : {
|
||||
"type" : "boolean"
|
||||
}
|
||||
}
|
||||
} ]
|
||||
},
|
||||
"Animal" : {
|
||||
"type" : "object",
|
||||
"discriminator": "className",
|
||||
"required": [
|
||||
"className"
|
||||
],
|
||||
"properties" : {
|
||||
"className" : {
|
||||
"type" : "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git
|
||||
|
||||
- API verion: 1.0.0
|
||||
- Package version: 1.0.0
|
||||
- Build date: 2016-03-19T16:11:03.465+08:00
|
||||
- Build date: 2016-03-28T11:19:00.169+02:00
|
||||
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
|
||||
|
||||
## Requirements
|
||||
@ -108,7 +108,10 @@ Class | Method | HTTP request | Description
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
- [Animal](docs/Animal.md)
|
||||
- [Cat](docs/Cat.md)
|
||||
- [Category](docs/Category.md)
|
||||
- [Dog](docs/Dog.md)
|
||||
- [InlineResponse200](docs/InlineResponse200.md)
|
||||
- [Model200Response](docs/Model200Response.md)
|
||||
- [ModelReturn](docs/ModelReturn.md)
|
||||
@ -123,10 +126,25 @@ Class | Method | HTTP request | Description
|
||||
## Documentation For Authorization
|
||||
|
||||
|
||||
## test_api_key_header
|
||||
## petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
- **Flow**: implicit
|
||||
- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||
- **Scopes**:
|
||||
- **write:pets**: modify pets in your account
|
||||
- **read:pets**: read your pets
|
||||
|
||||
## test_api_client_id
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: test_api_key_header
|
||||
- **API key parameter name**: x-test_api_client_id
|
||||
- **Location**: HTTP header
|
||||
|
||||
## test_api_client_secret
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: x-test_api_client_secret
|
||||
- **Location**: HTTP header
|
||||
|
||||
## api_key
|
||||
@ -139,32 +157,17 @@ Class | Method | HTTP request | Description
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
## test_api_client_secret
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: x-test_api_client_secret
|
||||
- **Location**: HTTP header
|
||||
|
||||
## test_api_client_id
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: x-test_api_client_id
|
||||
- **Location**: HTTP header
|
||||
|
||||
## test_api_key_query
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: test_api_key_query
|
||||
- **Location**: URL query string
|
||||
|
||||
## petstore_auth
|
||||
## test_api_key_header
|
||||
|
||||
- **Type**: OAuth
|
||||
- **Flow**: implicit
|
||||
- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||
- **Scopes**:
|
||||
- **write:pets**: modify pets in your account
|
||||
- **read:pets**: read your pets
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: test_api_key_header
|
||||
- **Location**: HTTP header
|
||||
|
||||
|
||||
## Author
|
||||
|
10
samples/client/petstore/php/SwaggerClient-php/docs/Animal.md
Normal file
10
samples/client/petstore/php/SwaggerClient-php/docs/Animal.md
Normal file
@ -0,0 +1,10 @@
|
||||
# Animal
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**class_name** | **string** | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
10
samples/client/petstore/php/SwaggerClient-php/docs/Cat.md
Normal file
10
samples/client/petstore/php/SwaggerClient-php/docs/Cat.md
Normal file
@ -0,0 +1,10 @@
|
||||
# Cat
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**declawed** | **bool** | | [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)
|
||||
|
||||
|
10
samples/client/petstore/php/SwaggerClient-php/docs/Dog.md
Normal file
10
samples/client/petstore/php/SwaggerClient-php/docs/Dog.md
Normal file
@ -0,0 +1,10 @@
|
||||
# Dog
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**breed** | **string** | | [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)
|
||||
|
||||
|
@ -3,12 +3,12 @@
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**tags** | [**\Swagger\Client\Model\Tag[]**](Tag.md) | | [optional]
|
||||
**photo_urls** | **string[]** | | [optional]
|
||||
**name** | **string** | | [optional]
|
||||
**id** | **int** | |
|
||||
**category** | **object** | | [optional]
|
||||
**tags** | [**\Swagger\Client\Model\Tag[]**](Tag.md) | | [optional]
|
||||
**status** | **string** | pet status in the store | [optional]
|
||||
**name** | **string** | | [optional]
|
||||
**photo_urls** | **string[]** | | [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)
|
||||
|
||||
|
@ -268,12 +268,12 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
|
||||
<?php
|
||||
require_once(__DIR__ . '/vendor/autoload.php');
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
|
||||
// Configure API key authorization: api_key
|
||||
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY');
|
||||
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER');
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
|
||||
|
||||
$api_instance = new Swagger\Client\Api\PetApi();
|
||||
$pet_id = 789; // int | ID of pet that needs to be fetched
|
||||
@ -299,7 +299,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
|
||||
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
@ -320,12 +320,12 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
|
||||
<?php
|
||||
require_once(__DIR__ . '/vendor/autoload.php');
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
|
||||
// Configure API key authorization: api_key
|
||||
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY');
|
||||
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER');
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
|
||||
|
||||
$api_instance = new Swagger\Client\Api\PetApi();
|
||||
$pet_id = 789; // int | ID of pet that needs to be fetched
|
||||
@ -351,7 +351,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
|
||||
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
@ -372,12 +372,12 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
|
||||
<?php
|
||||
require_once(__DIR__ . '/vendor/autoload.php');
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
|
||||
// Configure API key authorization: api_key
|
||||
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY');
|
||||
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER');
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
|
||||
|
||||
$api_instance = new Swagger\Client\Api\PetApi();
|
||||
$pet_id = 789; // int | ID of pet that needs to be fetched
|
||||
@ -403,7 +403,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
|
||||
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
|
@ -214,14 +214,14 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
|
||||
<?php
|
||||
require_once(__DIR__ . '/vendor/autoload.php');
|
||||
|
||||
// Configure API key authorization: test_api_key_header
|
||||
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('test_api_key_header', 'YOUR_API_KEY');
|
||||
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('test_api_key_header', 'BEARER');
|
||||
// Configure API key authorization: test_api_key_query
|
||||
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('test_api_key_query', 'YOUR_API_KEY');
|
||||
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('test_api_key_query', 'BEARER');
|
||||
// Configure API key authorization: test_api_key_header
|
||||
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('test_api_key_header', 'YOUR_API_KEY');
|
||||
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('test_api_key_header', 'BEARER');
|
||||
|
||||
$api_instance = new Swagger\Client\Api\StoreApi();
|
||||
$order_id = "order_id_example"; // string | ID of pet that needs to be fetched
|
||||
@ -247,7 +247,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Authorization
|
||||
|
||||
[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query)
|
||||
[test_api_key_query](../README.md#test_api_key_query), [test_api_key_header](../README.md#test_api_key_header)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
|
@ -618,6 +618,11 @@ class PetApi
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
// this endpoint requires OAuth (access token)
|
||||
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
}
|
||||
|
||||
// this endpoint requires API key authentication
|
||||
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
|
||||
if (strlen($apiKey) !== 0) {
|
||||
@ -625,11 +630,6 @@ class PetApi
|
||||
}
|
||||
|
||||
|
||||
// this endpoint requires OAuth (access token)
|
||||
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -725,6 +725,11 @@ class PetApi
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
// this endpoint requires OAuth (access token)
|
||||
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
}
|
||||
|
||||
// this endpoint requires API key authentication
|
||||
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
|
||||
if (strlen($apiKey) !== 0) {
|
||||
@ -732,11 +737,6 @@ class PetApi
|
||||
}
|
||||
|
||||
|
||||
// this endpoint requires OAuth (access token)
|
||||
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -832,6 +832,11 @@ class PetApi
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
// this endpoint requires OAuth (access token)
|
||||
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
}
|
||||
|
||||
// this endpoint requires API key authentication
|
||||
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
|
||||
if (strlen($apiKey) !== 0) {
|
||||
@ -839,11 +844,6 @@ class PetApi
|
||||
}
|
||||
|
||||
|
||||
// this endpoint requires OAuth (access token)
|
||||
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
|
@ -525,16 +525,16 @@ class StoreApi
|
||||
}
|
||||
|
||||
// this endpoint requires API key authentication
|
||||
$apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_header');
|
||||
$apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_query');
|
||||
if (strlen($apiKey) !== 0) {
|
||||
$headerParams['test_api_key_header'] = $apiKey;
|
||||
$queryParams['test_api_key_query'] = $apiKey;
|
||||
}
|
||||
|
||||
|
||||
// this endpoint requires API key authentication
|
||||
$apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_query');
|
||||
$apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_header');
|
||||
if (strlen($apiKey) !== 0) {
|
||||
$queryParams['test_api_key_query'] = $apiKey;
|
||||
$headerParams['test_api_key_header'] = $apiKey;
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,191 @@
|
||||
<?php
|
||||
/**
|
||||
* Animal
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Class
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
*/
|
||||
/**
|
||||
* Copyright 2016 SmartBear Software
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* Animal Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
*/
|
||||
class Animal implements ArrayAccess
|
||||
{
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
* @var string[]
|
||||
*/
|
||||
static $swaggerTypes = array(
|
||||
'class_name' => 'string'
|
||||
);
|
||||
|
||||
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[]
|
||||
*/
|
||||
static $attributeMap = array(
|
||||
'class_name' => 'className'
|
||||
);
|
||||
|
||||
static function attributeMap() {
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
* @var string[]
|
||||
*/
|
||||
static $setters = array(
|
||||
'class_name' => 'setClassName'
|
||||
);
|
||||
|
||||
static function setters() {
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
* @var string[]
|
||||
*/
|
||||
static $getters = array(
|
||||
'class_name' => 'getClassName'
|
||||
);
|
||||
|
||||
static function getters() {
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* $class_name
|
||||
* @var string
|
||||
*/
|
||||
protected $class_name;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param mixed[] $data Associated array of property value initalizing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
|
||||
if ($data != null) {
|
||||
$this->class_name = $data["class_name"];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets class_name
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return $this->class_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets class_name
|
||||
* @param string $class_name
|
||||
* @return $this
|
||||
*/
|
||||
public function setClassName($class_name)
|
||||
{
|
||||
|
||||
$this->class_name = $class_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->$offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
* @param integer $offset Offset
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->$offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
* @param integer $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->$offset = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
* @param integer $offset Offset
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->$offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
191
samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php
Normal file
191
samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php
Normal file
@ -0,0 +1,191 @@
|
||||
<?php
|
||||
/**
|
||||
* Cat
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Class
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
*/
|
||||
/**
|
||||
* Copyright 2016 SmartBear Software
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* Cat Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
*/
|
||||
class Cat extends Animal implements ArrayAccess
|
||||
{
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
* @var string[]
|
||||
*/
|
||||
static $swaggerTypes = array(
|
||||
'declawed' => 'bool'
|
||||
);
|
||||
|
||||
static function swaggerTypes() {
|
||||
return self::$swaggerTypes + parent::swaggerTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name, and the value is the original name
|
||||
* @var string[]
|
||||
*/
|
||||
static $attributeMap = array(
|
||||
'declawed' => 'declawed'
|
||||
);
|
||||
|
||||
static function attributeMap() {
|
||||
return parent::attributeMap() + self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
* @var string[]
|
||||
*/
|
||||
static $setters = array(
|
||||
'declawed' => 'setDeclawed'
|
||||
);
|
||||
|
||||
static function setters() {
|
||||
return parent::setters() + self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
* @var string[]
|
||||
*/
|
||||
static $getters = array(
|
||||
'declawed' => 'getDeclawed'
|
||||
);
|
||||
|
||||
static function getters() {
|
||||
return parent::getters() + self::$getters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* $declawed
|
||||
* @var bool
|
||||
*/
|
||||
protected $declawed;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param mixed[] $data Associated array of property value initalizing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
parent::__construct($data);
|
||||
if ($data != null) {
|
||||
$this->declawed = $data["declawed"];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets declawed
|
||||
* @return bool
|
||||
*/
|
||||
public function getDeclawed()
|
||||
{
|
||||
return $this->declawed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets declawed
|
||||
* @param bool $declawed
|
||||
* @return $this
|
||||
*/
|
||||
public function setDeclawed($declawed)
|
||||
{
|
||||
|
||||
$this->declawed = $declawed;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->$offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
* @param integer $offset Offset
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->$offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
* @param integer $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->$offset = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
* @param integer $offset Offset
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->$offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
@ -118,6 +118,7 @@ class Category implements ArrayAccess
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
|
||||
if ($data != null) {
|
||||
$this->id = $data["id"];
|
||||
$this->name = $data["name"];
|
||||
|
191
samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php
Normal file
191
samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php
Normal file
@ -0,0 +1,191 @@
|
||||
<?php
|
||||
/**
|
||||
* Dog
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Class
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
*/
|
||||
/**
|
||||
* Copyright 2016 SmartBear Software
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* Dog Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
*/
|
||||
class Dog extends Animal implements ArrayAccess
|
||||
{
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
* @var string[]
|
||||
*/
|
||||
static $swaggerTypes = array(
|
||||
'breed' => 'string'
|
||||
);
|
||||
|
||||
static function swaggerTypes() {
|
||||
return self::$swaggerTypes + parent::swaggerTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name, and the value is the original name
|
||||
* @var string[]
|
||||
*/
|
||||
static $attributeMap = array(
|
||||
'breed' => 'breed'
|
||||
);
|
||||
|
||||
static function attributeMap() {
|
||||
return parent::attributeMap() + self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
* @var string[]
|
||||
*/
|
||||
static $setters = array(
|
||||
'breed' => 'setBreed'
|
||||
);
|
||||
|
||||
static function setters() {
|
||||
return parent::setters() + self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
* @var string[]
|
||||
*/
|
||||
static $getters = array(
|
||||
'breed' => 'getBreed'
|
||||
);
|
||||
|
||||
static function getters() {
|
||||
return parent::getters() + self::$getters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* $breed
|
||||
* @var string
|
||||
*/
|
||||
protected $breed;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param mixed[] $data Associated array of property value initalizing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
parent::__construct($data);
|
||||
if ($data != null) {
|
||||
$this->breed = $data["breed"];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets breed
|
||||
* @return string
|
||||
*/
|
||||
public function getBreed()
|
||||
{
|
||||
return $this->breed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets breed
|
||||
* @param string $breed
|
||||
* @return $this
|
||||
*/
|
||||
public function setBreed($breed)
|
||||
{
|
||||
|
||||
$this->breed = $breed;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->$offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
* @param integer $offset Offset
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->$offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
* @param integer $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->$offset = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
* @param integer $offset Offset
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->$offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
@ -51,12 +51,12 @@ class InlineResponse200 implements ArrayAccess
|
||||
* @var string[]
|
||||
*/
|
||||
static $swaggerTypes = array(
|
||||
'tags' => '\Swagger\Client\Model\Tag[]',
|
||||
'photo_urls' => 'string[]',
|
||||
'name' => 'string',
|
||||
'id' => 'int',
|
||||
'category' => 'object',
|
||||
'status' => 'string',
|
||||
'name' => 'string',
|
||||
'photo_urls' => 'string[]'
|
||||
'tags' => '\Swagger\Client\Model\Tag[]',
|
||||
'status' => 'string'
|
||||
);
|
||||
|
||||
static function swaggerTypes() {
|
||||
@ -68,12 +68,12 @@ class InlineResponse200 implements ArrayAccess
|
||||
* @var string[]
|
||||
*/
|
||||
static $attributeMap = array(
|
||||
'tags' => 'tags',
|
||||
'photo_urls' => 'photoUrls',
|
||||
'name' => 'name',
|
||||
'id' => 'id',
|
||||
'category' => 'category',
|
||||
'status' => 'status',
|
||||
'name' => 'name',
|
||||
'photo_urls' => 'photoUrls'
|
||||
'tags' => 'tags',
|
||||
'status' => 'status'
|
||||
);
|
||||
|
||||
static function attributeMap() {
|
||||
@ -85,12 +85,12 @@ class InlineResponse200 implements ArrayAccess
|
||||
* @var string[]
|
||||
*/
|
||||
static $setters = array(
|
||||
'tags' => 'setTags',
|
||||
'photo_urls' => 'setPhotoUrls',
|
||||
'name' => 'setName',
|
||||
'id' => 'setId',
|
||||
'category' => 'setCategory',
|
||||
'status' => 'setStatus',
|
||||
'name' => 'setName',
|
||||
'photo_urls' => 'setPhotoUrls'
|
||||
'tags' => 'setTags',
|
||||
'status' => 'setStatus'
|
||||
);
|
||||
|
||||
static function setters() {
|
||||
@ -102,12 +102,12 @@ class InlineResponse200 implements ArrayAccess
|
||||
* @var string[]
|
||||
*/
|
||||
static $getters = array(
|
||||
'tags' => 'getTags',
|
||||
'photo_urls' => 'getPhotoUrls',
|
||||
'name' => 'getName',
|
||||
'id' => 'getId',
|
||||
'category' => 'getCategory',
|
||||
'status' => 'getStatus',
|
||||
'name' => 'getName',
|
||||
'photo_urls' => 'getPhotoUrls'
|
||||
'tags' => 'getTags',
|
||||
'status' => 'getStatus'
|
||||
);
|
||||
|
||||
static function getters() {
|
||||
@ -116,10 +116,16 @@ class InlineResponse200 implements ArrayAccess
|
||||
|
||||
|
||||
/**
|
||||
* $tags
|
||||
* @var \Swagger\Client\Model\Tag[]
|
||||
* $photo_urls
|
||||
* @var string[]
|
||||
*/
|
||||
protected $tags;
|
||||
protected $photo_urls;
|
||||
|
||||
/**
|
||||
* $name
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* $id
|
||||
@ -133,24 +139,18 @@ class InlineResponse200 implements ArrayAccess
|
||||
*/
|
||||
protected $category;
|
||||
|
||||
/**
|
||||
* $tags
|
||||
* @var \Swagger\Client\Model\Tag[]
|
||||
*/
|
||||
protected $tags;
|
||||
|
||||
/**
|
||||
* $status pet status in the store
|
||||
* @var string
|
||||
*/
|
||||
protected $status;
|
||||
|
||||
/**
|
||||
* $name
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* $photo_urls
|
||||
* @var string[]
|
||||
*/
|
||||
protected $photo_urls;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -158,34 +158,56 @@ class InlineResponse200 implements ArrayAccess
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
|
||||
if ($data != null) {
|
||||
$this->tags = $data["tags"];
|
||||
$this->photo_urls = $data["photo_urls"];
|
||||
$this->name = $data["name"];
|
||||
$this->id = $data["id"];
|
||||
$this->category = $data["category"];
|
||||
$this->tags = $data["tags"];
|
||||
$this->status = $data["status"];
|
||||
$this->name = $data["name"];
|
||||
$this->photo_urls = $data["photo_urls"];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets tags
|
||||
* @return \Swagger\Client\Model\Tag[]
|
||||
* Gets photo_urls
|
||||
* @return string[]
|
||||
*/
|
||||
public function getTags()
|
||||
public function getPhotoUrls()
|
||||
{
|
||||
return $this->tags;
|
||||
return $this->photo_urls;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets tags
|
||||
* @param \Swagger\Client\Model\Tag[] $tags
|
||||
* Sets photo_urls
|
||||
* @param string[] $photo_urls
|
||||
* @return $this
|
||||
*/
|
||||
public function setTags($tags)
|
||||
public function setPhotoUrls($photo_urls)
|
||||
{
|
||||
|
||||
$this->tags = $tags;
|
||||
$this->photo_urls = $photo_urls;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets name
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets name
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -231,6 +253,27 @@ class InlineResponse200 implements ArrayAccess
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets tags
|
||||
* @return \Swagger\Client\Model\Tag[]
|
||||
*/
|
||||
public function getTags()
|
||||
{
|
||||
return $this->tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets tags
|
||||
* @param \Swagger\Client\Model\Tag[] $tags
|
||||
* @return $this
|
||||
*/
|
||||
public function setTags($tags)
|
||||
{
|
||||
|
||||
$this->tags = $tags;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets status
|
||||
* @return string
|
||||
@ -255,48 +298,6 @@ class InlineResponse200 implements ArrayAccess
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets name
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets name
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets photo_urls
|
||||
* @return string[]
|
||||
*/
|
||||
public function getPhotoUrls()
|
||||
{
|
||||
return $this->photo_urls;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets photo_urls
|
||||
* @param string[] $photo_urls
|
||||
* @return $this
|
||||
*/
|
||||
public function setPhotoUrls($photo_urls)
|
||||
{
|
||||
|
||||
$this->photo_urls = $photo_urls;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
|
@ -108,6 +108,7 @@ class Model200Response implements ArrayAccess
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
|
||||
if ($data != null) {
|
||||
$this->name = $data["name"];
|
||||
}
|
||||
|
@ -108,6 +108,7 @@ class ModelReturn implements ArrayAccess
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
|
||||
if ($data != null) {
|
||||
$this->return = $data["return"];
|
||||
}
|
||||
|
@ -118,6 +118,7 @@ class Name implements ArrayAccess
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
|
||||
if ($data != null) {
|
||||
$this->name = $data["name"];
|
||||
$this->snake_case = $data["snake_case"];
|
||||
|
@ -158,6 +158,7 @@ class Order implements ArrayAccess
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
|
||||
if ($data != null) {
|
||||
$this->id = $data["id"];
|
||||
$this->pet_id = $data["pet_id"];
|
||||
|
@ -158,6 +158,7 @@ class Pet implements ArrayAccess
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
|
||||
if ($data != null) {
|
||||
$this->id = $data["id"];
|
||||
$this->category = $data["category"];
|
||||
|
@ -108,6 +108,7 @@ class SpecialModelName implements ArrayAccess
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
|
||||
if ($data != null) {
|
||||
$this->special_property_name = $data["special_property_name"];
|
||||
}
|
||||
|
@ -118,6 +118,7 @@ class Tag implements ArrayAccess
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
|
||||
if ($data != null) {
|
||||
$this->id = $data["id"];
|
||||
$this->name = $data["name"];
|
||||
|
@ -178,6 +178,7 @@ class User implements ArrayAccess
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
|
||||
if ($data != null) {
|
||||
$this->id = $data["id"];
|
||||
$this->username = $data["username"];
|
||||
|
@ -257,7 +257,7 @@ class ObjectSerializer
|
||||
} else {
|
||||
$deserialized = null;
|
||||
}
|
||||
} elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) {
|
||||
} elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) {
|
||||
settype($data, $class);
|
||||
$deserialized = $data;
|
||||
} elseif ($class === '\SplFileObject') {
|
||||
|
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* AnimalTest
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Class
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
*/
|
||||
/**
|
||||
* Copyright 2016 SmartBear Software
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* 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\Model;
|
||||
|
||||
/**
|
||||
* AnimalTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
*/
|
||||
class AnimalTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public static function setUpBeforeClass() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public static function tearDownAfterClass() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Animal
|
||||
*/
|
||||
public function testAnimal() {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* CatTest
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Class
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
*/
|
||||
/**
|
||||
* Copyright 2016 SmartBear Software
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* 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\Model;
|
||||
|
||||
/**
|
||||
* CatTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
*/
|
||||
class CatTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public static function setUpBeforeClass() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public static function tearDownAfterClass() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Cat
|
||||
*/
|
||||
public function testCat() {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* DogTest
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Class
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
*/
|
||||
/**
|
||||
* Copyright 2016 SmartBear Software
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* 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\Model;
|
||||
|
||||
/**
|
||||
* DogTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
*/
|
||||
class DogTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public static function setUpBeforeClass() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public static function tearDownAfterClass() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Dog
|
||||
*/
|
||||
public function testDog() {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -375,6 +375,33 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
}
|
||||
|
||||
// test inheritance in the model
|
||||
public function testInheritance()
|
||||
{
|
||||
$new_dog = new Swagger\Client\Model\Dog;
|
||||
// the object should be an instance of the derived class
|
||||
$this->assertInstanceOf('Swagger\Client\Model\Dog', $new_dog);
|
||||
// the object should also be an instance of the parent class
|
||||
$this->assertInstanceOf('Swagger\Client\Model\Animal', $new_dog);
|
||||
}
|
||||
|
||||
// test inheritance constructor is working with data
|
||||
// initialization
|
||||
public function testInheritanceConstructorDataInitialization()
|
||||
{
|
||||
// initialize the object with data in the constructor
|
||||
$data = array(
|
||||
'class_name' => 'Dog',
|
||||
'breed' => 'Great Dane'
|
||||
);
|
||||
$new_dog = new Swagger\Client\Model\Dog($data);
|
||||
|
||||
// the property on the derived class should be set
|
||||
$this->assertSame('Great Dane', $new_dog->getBreed());
|
||||
// the property on the parent class should be set
|
||||
$this->assertSame('Dog', $new_dog->getClassName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user