[PHP] Remove trailing spaces from templates

This commit is contained in:
Kim Sondrup 2016-05-13 00:31:45 +02:00
parent 153af0c6cb
commit 6bb953d0aa
10 changed files with 63 additions and 63 deletions

View File

@ -160,7 +160,7 @@ class ApiClient
if ($this->config->getCurlTimeout() != 0) { if ($this->config->getCurlTimeout() != 0) {
curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout()); curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout());
} }
// return the result on success, rather than just true // return the result on success, rather than just true
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
@ -300,11 +300,11 @@ class ApiClient
// ref/credit: http://php.net/manual/en/function.http-parse-headers.php#112986 // ref/credit: http://php.net/manual/en/function.http-parse-headers.php#112986
$headers = array(); $headers = array();
$key = ''; $key = '';
foreach(explode("\n", $raw_headers) as $h) foreach(explode("\n", $raw_headers) as $h)
{ {
$h = explode(':', $h, 2); $h = explode(':', $h, 2);
if (isset($h[1])) if (isset($h[1]))
{ {
if (!isset($headers[$h[0]])) if (!isset($headers[$h[0]]))
@ -317,18 +317,18 @@ class ApiClient
{ {
$headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1]))); $headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1])));
} }
$key = $h[0]; $key = $h[0];
} }
else else
{ {
if (substr($h[0], 0, 1) == "\t") if (substr($h[0], 0, 1) == "\t")
$headers[$key] .= "\r\n\t".trim($h[0]); $headers[$key] .= "\r\n\t".trim($h[0]);
elseif (!$key) elseif (!$key)
$headers[0] = trim($h[0]);trim($h[0]); $headers[0] = trim($h[0]);trim($h[0]);
} }
} }
return $headers; return $headers;
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/** /**
* ObjectSerializer * ObjectSerializer
* *
* PHP version 5 * PHP version 5
* *
@ -37,7 +37,7 @@ namespace {{invokerPackage}};
* ObjectSerializer Class Doc Comment * ObjectSerializer Class Doc Comment
* *
* @category Class * @category Class
* @package {{invokerPackage}} * @package {{invokerPackage}}
* @author http://github.com/swagger-api/swagger-codegen * @author http://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
* @link https://github.com/swagger-api/swagger-codegen * @link https://github.com/swagger-api/swagger-codegen
@ -79,7 +79,7 @@ class ObjectSerializer
/** /**
* Sanitize filename by removing path. * Sanitize filename by removing path.
* e.g. ../../sun.gif becomes sun.gif * e.g. ../../sun.gif becomes sun.gif
* *
* @param string $filename filename to be sanitized * @param string $filename filename to be sanitized
* *
@ -270,7 +270,7 @@ class ObjectSerializer
$byte_written = $deserialized->fwrite($data); $byte_written = $deserialized->fwrite($data);
error_log("[INFO] Written $byte_written byte to $filename. Please move the file to a proper folder or delete the temp file after processing.\n", 3, Configuration::getDefaultConfiguration()->getDebugFile()); error_log("[INFO] Written $byte_written byte to $filename. Please move the file to a proper folder or delete the temp file after processing.\n", 3, Configuration::getDefaultConfiguration()->getDebugFile());
return $deserialized; return $deserialized;
} else { } else {
// If a discriminator is defined and points to a valid subclass, use it. // If a discriminator is defined and points to a valid subclass, use it.
if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) {
@ -282,11 +282,11 @@ class ObjectSerializer
$instance = new $class(); $instance = new $class();
foreach ($instance::swaggerTypes() as $property => $type) { foreach ($instance::swaggerTypes() as $property => $type) {
$propertySetter = $instance::setters()[$property]; $propertySetter = $instance::setters()[$property];
if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) {
continue; continue;
} }
$propertyValue = $data->{$instance::attributeMap()[$property]}; $propertyValue = $data->{$instance::attributeMap()[$property]};
if (isset($propertyValue)) { if (isset($propertyValue)) {
$instance->$propertySetter(self::deserialize($propertyValue, $type, null, $discriminator)); $instance->$propertySetter(self::deserialize($propertyValue, $type, null, $discriminator));

View File

@ -46,7 +46,7 @@ Download the files and include `autoload.php`:
require_once('/path/to/{{packagePath}}/autoload.php'); require_once('/path/to/{{packagePath}}/autoload.php');
``` ```
## Tests ## Tests
To run the unit tests: To run the unit tests:
@ -108,7 +108,7 @@ Class | Method | HTTP request | Description
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}} {{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
{{#authMethods}}## {{{name}}} {{#authMethods}}## {{{name}}}
{{#isApiKey}}- **Type**: API key {{#isApiKey}}- **Type**: API key
- **API key parameter name**: {{{keyParamName}}} - **API key parameter name**: {{{keyParamName}}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}} {{/isApiKey}}

View File

@ -26,8 +26,8 @@
*/ */
/** /**
* NOTE: This class is auto generated by the swagger code generator program. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen * https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually. * Do not edit the class manually.
*/ */
@ -55,7 +55,7 @@ use \{{invokerPackage}}\ObjectSerializer;
* @var \{{invokerPackage}}\ApiClient instance of the ApiClient * @var \{{invokerPackage}}\ApiClient instance of the ApiClient
*/ */
protected $apiClient; protected $apiClient;
/** /**
* Constructor * Constructor
* @param \{{invokerPackage}}\ApiClient|null $apiClient The api client to use * @param \{{invokerPackage}}\ApiClient|null $apiClient The api client to use
@ -66,10 +66,10 @@ use \{{invokerPackage}}\ObjectSerializer;
$apiClient = new ApiClient(); $apiClient = new ApiClient();
$apiClient->getConfig()->setHost('{{basePath}}'); $apiClient->getConfig()->setHost('{{basePath}}');
} }
$this->apiClient = $apiClient; $this->apiClient = $apiClient;
} }
/** /**
* Get API client * Get API client
* @return \{{invokerPackage}}\ApiClient get the API client * @return \{{invokerPackage}}\ApiClient get the API client
@ -78,7 +78,7 @@ use \{{invokerPackage}}\ObjectSerializer;
{ {
return $this->apiClient; return $this->apiClient;
} }
/** /**
* Set the API client * Set the API client
* @param \{{invokerPackage}}\ApiClient $apiClient set the API client * @param \{{invokerPackage}}\ApiClient $apiClient set the API client
@ -89,7 +89,7 @@ use \{{invokerPackage}}\ObjectSerializer;
$this->apiClient = $apiClient; $this->apiClient = $apiClient;
return $this; return $this;
} }
{{#operation}} {{#operation}}
/** /**
* {{{operationId}}} * {{{operationId}}}
@ -103,7 +103,7 @@ use \{{invokerPackage}}\ObjectSerializer;
public function {{operationId}}({{#allParams}}${{paramName}}{{^required}} = null{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) public function {{operationId}}({{#allParams}}${{paramName}}{{^required}} = null{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
{ {
list($response) = $this->{{operationId}}WithHttpInfo ({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); list($response) = $this->{{operationId}}WithHttpInfo ({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
return $response; return $response;
} }
@ -153,7 +153,7 @@ use \{{invokerPackage}}\ObjectSerializer;
{{/hasValidation}} {{/hasValidation}}
{{/allParams}} {{/allParams}}
// parse inputs // parse inputs
$resourcePath = "{{path}}"; $resourcePath = "{{path}}";
$httpBody = ''; $httpBody = '';
@ -165,7 +165,7 @@ use \{{invokerPackage}}\ObjectSerializer;
$headerParams['Accept'] = $_header_accept; $headerParams['Accept'] = $_header_accept;
} }
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array({{#consumes}}'{{mediaType}}'{{#hasMore}},{{/hasMore}}{{/consumes}})); $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array({{#consumes}}'{{mediaType}}'{{#hasMore}},{{/hasMore}}{{/consumes}}));
{{#queryParams}}// query params {{#queryParams}}// query params
{{#collectionFormat}} {{#collectionFormat}}
if (is_array(${{paramName}})) { if (is_array(${{paramName}})) {
@ -220,7 +220,7 @@ use \{{invokerPackage}}\ObjectSerializer;
if (isset(${{paramName}})) { if (isset(${{paramName}})) {
$_tempBody = ${{paramName}}; $_tempBody = ${{paramName}};
}{{/bodyParams}} }{{/bodyParams}}
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
@ -264,7 +264,7 @@ use \{{invokerPackage}}\ObjectSerializer;
$e->setResponseObject($data); $e->setResponseObject($data);
break;{{/dataType}}{{/responses}} break;{{/dataType}}{{/responses}}
} }
throw $e; throw $e;
} }
} }

View File

@ -17,7 +17,7 @@ Method | HTTP request | Description
{{{notes}}}{{/notes}} {{{notes}}}{{/notes}}
### Example ### Example
```php ```php
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
@ -37,7 +37,7 @@ $api_instance = new {{invokerPackage}}\Api\{{classname}}();
{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}} {{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
{{/allParams}} {{/allParams}}
try { try {
{{#returnType}}$result = {{/returnType}}$api_instance->{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} {{#returnType}}$result = {{/returnType}}$api_instance->{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
print_r($result);{{/returnType}} print_r($result);{{/returnType}}
} catch (Exception $e) { } catch (Exception $e) {

View File

@ -26,8 +26,8 @@
*/ */
/** /**
* NOTE: This class is auto generated by the swagger code generator program. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen * https://github.com/swagger-api/swagger-codegen
* Please update the test case below to test the endpoint. * Please update the test case below to test the endpoint.
*/ */

View File

@ -1,13 +1,13 @@
<?php <?php
/** /**
* An example of a project-specific implementation. * An example of a project-specific implementation.
* *
* After registering this autoload function with SPL, the following line * After registering this autoload function with SPL, the following line
* would cause the function to attempt to load the \{{invokerPackage}}\Baz\Qux class * would cause the function to attempt to load the \{{invokerPackage}}\Baz\Qux class
* from /path/to/project/{{srcBasePath}}/Baz/Qux.php: * from /path/to/project/{{srcBasePath}}/Baz/Qux.php:
* *
* new \{{invokerPackage}}\Baz\Qux; * new \{{invokerPackage}}\Baz\Qux;
* *
* @param string $class The fully-qualified class name. * @param string $class The fully-qualified class name.
* @return void * @return void
*/ */

View File

@ -28,7 +28,7 @@ git init
# Adds the files in the local repository and stages them for commit. # Adds the files in the local repository and stages them for commit.
git add . git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository. # Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note" git commit -m "$release_note"
# Sets the new remote # Sets the new remote

View File

@ -56,7 +56,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
static $swaggerModelName = '{{name}}'; static $swaggerModelName = '{{name}}';
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* @var string[] * @var string[]
*/ */
static $swaggerTypes = array( static $swaggerTypes = array(
@ -68,7 +68,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
return self::$swaggerTypes{{#parentSchema}} + parent::swaggerTypes(){{/parentSchema}}; return self::$swaggerTypes{{#parentSchema}} + parent::swaggerTypes(){{/parentSchema}};
} }
/** /**
* Array of attributes where the key is the local name, and the value is the original name * Array of attributes where the key is the local name, and the value is the original name
* @var string[] * @var string[]
*/ */
@ -102,7 +102,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
{{#vars}}'{{name}}' => '{{getter}}'{{#hasMore}}, {{#vars}}'{{name}}' => '{{getter}}'{{#hasMore}},
{{/hasMore}}{{/vars}} {{/hasMore}}{{/vars}}
); );
static function getters() { static function getters() {
return {{#parentSchema}}parent::getters() + {{/parentSchema}}self::$getters; return {{#parentSchema}}parent::getters() + {{/parentSchema}}self::$getters;
} }
@ -152,7 +152,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
/** /**
* show all the invalid properties with reasons. * show all the invalid properties with reasons.
* *
* @return array invalid properties with reasons * @return array invalid properties with reasons
*/ */
public function list_invalid_properties() public function list_invalid_properties()
@ -204,8 +204,8 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
/** /**
* validate all the properties in the model * validate all the properties in the model
* return true if all passed * return true if all passed
* *
* @return bool True if all properteis are valid * @return bool True if all properteis are valid
*/ */
public function valid() public function valid()
{ {
@ -309,7 +309,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
{{/vars}} {{/vars}}
/** /**
* Returns true if offset exists. False otherwise. * Returns true if offset exists. False otherwise.
* @param integer $offset Offset * @param integer $offset Offset
* @return boolean * @return boolean
*/ */
public function offsetExists($offset) public function offsetExists($offset)
@ -319,17 +319,17 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
/** /**
* Gets offset. * Gets offset.
* @param integer $offset Offset * @param integer $offset Offset
* @return mixed * @return mixed
*/ */
public function offsetGet($offset) public function offsetGet($offset)
{ {
return isset($this->container[$offset]) ? $this->container[$offset] : null; return isset($this->container[$offset]) ? $this->container[$offset] : null;
} }
/** /**
* Sets value based on offset. * Sets value based on offset.
* @param integer $offset Offset * @param integer $offset Offset
* @param mixed $value Value to be set * @param mixed $value Value to be set
* @return void * @return void
*/ */
@ -341,17 +341,17 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
$this->container[$offset] = $value; $this->container[$offset] = $value;
} }
} }
/** /**
* Unsets offset. * Unsets offset.
* @param integer $offset Offset * @param integer $offset Offset
* @return void * @return void
*/ */
public function offsetUnset($offset) public function offsetUnset($offset)
{ {
unset($this->container[$offset]); unset($this->container[$offset]);
} }
/** /**
* Gets the string presentation of the object * Gets the string presentation of the object
* @return string * @return string

View File

@ -1,19 +1,19 @@
class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayAccess class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayAccess
{ {
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* @var string[] * @var string[]
*/ */
static $swaggerTypes = array( static $swaggerTypes = array(
{{#vars}}'{{name}}' => '{{{datatype}}}'{{#hasMore}}, {{#vars}}'{{name}}' => '{{{datatype}}}'{{#hasMore}},
{{/hasMore}}{{/vars}} {{/hasMore}}{{/vars}}
); );
static function swaggerTypes() { static function swaggerTypes() {
return self::$swaggerTypes{{#parent}} + parent::swaggerTypes(){{/parent}}; return self::$swaggerTypes{{#parent}} + parent::swaggerTypes(){{/parent}};
} }
/** /**
* Array of attributes where the key is the local name, and the value is the original name * Array of attributes where the key is the local name, and the value is the original name
* @var string[] * @var string[]
*/ */
@ -21,7 +21,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
{{#vars}}'{{name}}' => '{{baseName}}'{{#hasMore}}, {{#vars}}'{{name}}' => '{{baseName}}'{{#hasMore}},
{{/hasMore}}{{/vars}} {{/hasMore}}{{/vars}}
); );
static function attributeMap() { static function attributeMap() {
return {{#parent}}parent::attributeMap() + {{/parent}}self::$attributeMap; return {{#parent}}parent::attributeMap() + {{/parent}}self::$attributeMap;
} }
@ -34,7 +34,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
{{#vars}}'{{name}}' => '{{setter}}'{{#hasMore}}, {{#vars}}'{{name}}' => '{{setter}}'{{#hasMore}},
{{/hasMore}}{{/vars}} {{/hasMore}}{{/vars}}
); );
static function setters() { static function setters() {
return {{#parent}}parent::setters() + {{/parent}}self::$setters; return {{#parent}}parent::setters() + {{/parent}}self::$setters;
} }
@ -47,7 +47,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
{{#vars}}'{{name}}' => '{{getter}}'{{#hasMore}}, {{#vars}}'{{name}}' => '{{getter}}'{{#hasMore}},
{{/hasMore}}{{/vars}} {{/hasMore}}{{/vars}}
); );
static function getters() { static function getters() {
return {{#parent}}parent::getters() + {{/parent}}self::$getters; return {{#parent}}parent::getters() + {{/parent}}self::$getters;
} }
@ -115,7 +115,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
{{/vars}} {{/vars}}
/** /**
* Returns true if offset exists. False otherwise. * Returns true if offset exists. False otherwise.
* @param integer $offset Offset * @param integer $offset Offset
* @return boolean * @return boolean
*/ */
public function offsetExists($offset) public function offsetExists($offset)
@ -125,17 +125,17 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
/** /**
* Gets offset. * Gets offset.
* @param integer $offset Offset * @param integer $offset Offset
* @return mixed * @return mixed
*/ */
public function offsetGet($offset) public function offsetGet($offset)
{ {
return $this->$offset; return $this->$offset;
} }
/** /**
* Sets value based on offset. * Sets value based on offset.
* @param integer $offset Offset * @param integer $offset Offset
* @param mixed $value Value to be set * @param mixed $value Value to be set
* @return void * @return void
*/ */
@ -143,17 +143,17 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
{ {
$this->$offset = $value; $this->$offset = $value;
} }
/** /**
* Unsets offset. * Unsets offset.
* @param integer $offset Offset * @param integer $offset Offset
* @return void * @return void
*/ */
public function offsetUnset($offset) public function offsetUnset($offset)
{ {
unset($this->$offset); unset($this->$offset);
} }
/** /**
* Gets the string presentation of the object. * Gets the string presentation of the object.
* @return string * @return string