Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions modules/swagger-codegen/src/main/resources/php/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -129,27 +129,27 @@ use \{{invokerPackage}}\ObjectSerializer;
{{/required}}
{{#hasValidation}}
{{#maxLength}}
if (strlen(${{paramName}}) > {{maxLength}}) {
if ({{^required}}!is_null(${{paramName}}) && {{/required}}(strlen(${{paramName}}) > {{maxLength}})) {
throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.');
}
{{/maxLength}}
{{#minLength}}
if (strlen(${{paramName}}) < {{minLength}}) {
if ({{^required}}!is_null(${{paramName}}) && {{/required}}(strlen(${{paramName}}) < {{minLength}})) {
throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.');
}
{{/minLength}}
{{#maximum}}
if (${{paramName}} > {{maximum}}) {
if ({{^required}}!is_null(${{paramName}}) && {{/required}}(${{paramName}} > {{maximum}})) {
throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maximum}}.');
}
{{/maximum}}
{{#minimum}}
if (${{paramName}} < {{minimum}}) {
if ({{^required}}!is_null(${{paramName}}) && {{/required}}(${{paramName}} < {{minimum}})) {
throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minimum}}.');
}
{{/minimum}}
{{#pattern}}
if (!preg_match("{{pattern}}", ${{paramName}})) {
if ({{^required}}!is_null(${{paramName}}) && {{/required}}!preg_match("{{pattern}}", ${{paramName}})) {
throw new \InvalidArgumentException('invalid value for "{{paramName}}" when calling {{classname}}.{{operationId}}, must conform to the pattern {{pattern}}.');
}
{{/pattern}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,27 +128,27 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
{{/isEnum}}
{{#hasValidation}}
{{#maxLength}}
if (strlen($this->container['{{name}}']) > {{maxLength}}) {
if ({{^required}}!is_null(${{$this->container['{{name}}']}}) && {{/required}}(strlen($this->container['{{name}}']) > {{maxLength}})) {
$invalid_properties[] = "invalid value for '{{name}}', the character length must be smaller than or equal to {{{maxLength}}}.";
}
{{/maxLength}}
{{#minLength}}
if (strlen($this->container['{{name}}']) < {{minLength}}) {
if ({{^required}}!is_null(${{$this->container['{{name}}']}}) && {{/required}}(strlen($this->container['{{name}}']) < {{minLength}})) {
$invalid_properties[] = "invalid value for '{{name}}', the character length must be bigger than or equal to {{{minLength}}}.";
}
{{/minLength}}
{{#maximum}}
if ($this->container['{{name}}'] > {{maximum}}) {
if ({{^required}}!is_null(${{$this->container['{{name}}']}}) && {{/required}}($this->container['{{name}}'] > {{maximum}})) {
$invalid_properties[] = "invalid value for '{{name}}', must be smaller than or equal to {{maximum}}.";
}
{{/maximum}}
{{#minimum}}
if ($this->container['{{name}}'] < {{minimum}}) {
if ({{^required}}!is_null(${{$this->container['{{name}}']}}) && {{/required}}($this->container['{{name}}'] < {{minimum}})) {
$invalid_properties[] = "invalid value for '{{name}}', must be bigger than or equal to {{minimum}}.";
}
{{/minimum}}
{{#pattern}}
if (!preg_match("{{pattern}}", $this->container['{{name}}'])) {
if ({{^required}}!is_null(${{$this->container['{{name}}']}}) && {{/required}}!preg_match("{{pattern}}", $this->container['{{name}}'])) {
$invalid_properties[] = "invalid value for '{{name}}', must be conform to the pattern {{pattern}}.";
}
{{/pattern}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# SwaggerClient-php
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --

This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:

- API version: 1.0.0 *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r
- Build date: 2016-07-12T18:29:31.200+08:00
- API version: 1.0.0 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
- Build date: 2016-07-29T14:59:34.783+02:00
- Build package: class io.swagger.codegen.languages.PhpClientCodegen

## Requirements
Expand Down Expand Up @@ -58,10 +58,10 @@ Please follow the [installation procedure](#installation--usage) and then run th
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\FakeApi();
$test_code_inject____end_rn_n_r = "test_code_inject____end_rn_n_r_example"; // string | To test code injection *_/ ' \" =end \\r\\n \\n \\r
$test_code_inject____end____rn_n_r = "test_code_inject____end____rn_n_r_example"; // string | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r

try {
$api_instance->testCodeInjectEndRnNR($test_code_inject____end_rn_n_r);
$api_instance->testCodeInjectEndRnNR($test_code_inject____end____rn_n_r);
} catch (Exception $e) {
echo 'Exception when calling FakeApi->testCodeInjectEndRnNR: ', $e->getMessage(), PHP_EOL;
}
Expand All @@ -71,11 +71,11 @@ try {

## Documentation for API Endpoints

All URIs are relative to *https://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r*
All URIs are relative to *https://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*FakeApi* | [**testCodeInjectEndRnNR**](docs/Api/FakeApi.md#testcodeinjectendrnnr) | **PUT** /fake | To test code injection *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r
*FakeApi* | [**testCodeInjectEndRnNR**](docs/Api/FakeApi.md#testcodeinjectendrnnr) | **PUT** /fake | To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r


## Documentation For Models
Expand All @@ -86,24 +86,24 @@ Class | Method | HTTP request | Description
## Documentation For Authorization


## api_key

- **Type**: API key
- **API key parameter name**: api_key */ ' " =end \r\n \n \r
- **Location**: HTTP header

## petstore_auth

- **Type**: OAuth
- **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- **write:pets**: modify pets in your account */ ' " =end \r\n \n \r
- **read:pets**: read your pets */ ' " =end \r\n \n \r
- **write:pets**: modify pets in your account */ ' " =end -- \r\n \n \r
- **read:pets**: read your pets */ ' " =end -- \r\n \n \r

## api_key

- **Type**: API key
- **API key parameter name**: api_key */ ' " =end -- \r\n \n \r
- **Location**: HTTP header


## Author

apiteam@swagger.io *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r
apiteam@swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r


Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

/**
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* 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");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# Swagger\Client\FakeApi

All URIs are relative to *https://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r*
All URIs are relative to *https://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r*

Method | HTTP request | Description
------------- | ------------- | -------------
[**testCodeInjectEndRnNR**](FakeApi.md#testCodeInjectEndRnNR) | **PUT** /fake | To test code injection *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r
[**testCodeInjectEndRnNR**](FakeApi.md#testCodeInjectEndRnNR) | **PUT** /fake | To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r


# **testCodeInjectEndRnNR**
> testCodeInjectEndRnNR($test_code_inject____end_rn_n_r)
> testCodeInjectEndRnNR($test_code_inject____end____rn_n_r)

To test code injection *_/ ' \" =end \\r\\n \\n \\r
To test code injection *_/ ' \" =end -- \\r\\n \\n \\r

### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\FakeApi();
$test_code_inject____end_rn_n_r = "test_code_inject____end_rn_n_r_example"; // string | To test code injection *_/ ' \" =end \\r\\n \\n \\r
$test_code_inject____end____rn_n_r = "test_code_inject____end____rn_n_r_example"; // string | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r

try {
$api_instance->testCodeInjectEndRnNR($test_code_inject____end_rn_n_r);
$api_instance->testCodeInjectEndRnNR($test_code_inject____end____rn_n_r);
} catch (Exception $e) {
echo 'Exception when calling FakeApi->testCodeInjectEndRnNR: ', $e->getMessage(), PHP_EOL;
}
Expand All @@ -32,7 +32,7 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**test_code_inject____end_rn_n_r** | **string**| To test code injection *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r | [optional]
**test_code_inject____end____rn_n_r** | **string**| To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r | [optional]

### Return type

Expand All @@ -44,8 +44,8 @@ No authorization required

### HTTP request headers

- **Content-Type**: application/json, *_/ \" =end
- **Accept**: application/json, *_/ \" =end
- **Content-Type**: application/json, *_/ \" =end --
- **Accept**: application/json, *_/ \" =end --

[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**return** | **int** | property description *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r | [optional]
**return** | **int** | property description *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r | [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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
*/

/**
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* 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");
Expand Down Expand Up @@ -73,7 +73,7 @@ public function __construct(\Swagger\Client\ApiClient $apiClient = null)
{
if ($apiClient == null) {
$apiClient = new ApiClient();
$apiClient->getConfig()->setHost('https://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r');
$apiClient->getConfig()->setHost('https://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r');
}

$this->apiClient = $apiClient;
Expand Down Expand Up @@ -105,47 +105,47 @@ public function setApiClient(\Swagger\Client\ApiClient $apiClient)
/**
* Operation testCodeInjectEndRnNR
*
* To test code injection *_/ ' \" =end \\r\\n \\n \\r
* To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
*
* @param string $test_code_inject____end_rn_n_r To test code injection *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r (optional)
* @param string $test_code_inject____end____rn_n_r To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r (optional)
* @return void
* @throws \Swagger\Client\ApiException on non-2xx response
*/
public function testCodeInjectEndRnNR($test_code_inject____end_rn_n_r = null)
public function testCodeInjectEndRnNR($test_code_inject____end____rn_n_r = null)
{
list($response) = $this->testCodeInjectEndRnNRWithHttpInfo($test_code_inject____end_rn_n_r);
list($response) = $this->testCodeInjectEndRnNRWithHttpInfo($test_code_inject____end____rn_n_r);
return $response;
}

/**
* Operation testCodeInjectEndRnNRWithHttpInfo
*
* To test code injection *_/ ' \" =end \\r\\n \\n \\r
* To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
*
* @param string $test_code_inject____end_rn_n_r To test code injection *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r (optional)
* @param string $test_code_inject____end____rn_n_r To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r (optional)
* @return Array of null, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response
*/
public function testCodeInjectEndRnNRWithHttpInfo($test_code_inject____end_rn_n_r = null)
public function testCodeInjectEndRnNRWithHttpInfo($test_code_inject____end____rn_n_r = null)
{
// parse inputs
$resourcePath = "/fake";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', '*_/ \" =end'));
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', '*_/ \" =end --'));
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','*_/ \" =end'));
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','*_/ \" =end --'));

// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);

// form params
if ($test_code_inject____end_rn_n_r !== null) {
$formParams['test code inject */ &#39; &quot; &#x3D;end \r\n \n \r'] = $this->apiClient->getSerializer()->toFormValue($test_code_inject____end_rn_n_r);
if ($test_code_inject____end____rn_n_r !== null) {
$formParams['test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r'] = $this->apiClient->getSerializer()->toFormValue($test_code_inject____end____rn_n_r);
}

// for model (json/xml)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
*/

/**
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* 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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
*/

/**
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* 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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
*/

/**
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* 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");
Expand Down Expand Up @@ -102,7 +102,7 @@ class Configuration
*
* @var string
*/
protected $host = 'https://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r';
protected $host = 'https://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r';

/**
* Timeout (second) of the HTTP request, by default set to 0, no timeout
Expand Down Expand Up @@ -522,7 +522,7 @@ public static function toDebugReport()
$report = 'PHP SDK (Swagger\Client) Debug Report:' . PHP_EOL;
$report .= ' OS: ' . php_uname() . PHP_EOL;
$report .= ' PHP Version: ' . phpversion() . PHP_EOL;
$report .= ' OpenAPI Spec Version: 1.0.0 *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r' . PHP_EOL;
$report .= ' OpenAPI Spec Version: 1.0.0 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r' . PHP_EOL;
$report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL;

return $report;
Expand Down
Loading