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
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 ({{^required}}!is_null(${{$this->container['{{name}}']}}) && {{/required}}(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 ({{^required}}!is_null(${{$this->container['{{name}}']}}) && {{/required}}(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 ({{^required}}!is_null(${{$this->container['{{name}}']}}) && {{/required}}($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 ({{^required}}!is_null(${{$this->container['{{name}}']}}) && {{/required}}($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 ({{^required}}!is_null(${{$this->container['{{name}}']}}) && {{/required}}!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
Expand Up @@ -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 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
- Build date: 2016-07-29T14:59:34.783+02:00
- Build date: 2016-08-01T11:48:23.775+02:00
- Build package: class io.swagger.codegen.languages.PhpClientCodegen

## Requirements
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/php/SwaggerClient-php/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
- Build date: 2016-07-29T14:59:28.041+02:00
- Build date: 2016-08-01T11:48:17.791+02:00
- Build package: class io.swagger.codegen.languages.PhpClientCodegen

## Requirements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,16 @@ public function __construct(array $data = null)
public function listInvalidProperties()
{
$invalid_properties = array();
if (!is_null(${{$this->container['integer']}}) && ($this->container['integer'] > 100.0)) {
if (!is_null($this->container['integer']) && ($this->container['integer'] > 100.0)) {
$invalid_properties[] = "invalid value for 'integer', must be smaller than or equal to 100.0.";
}
if (!is_null(${{$this->container['integer']}}) && ($this->container['integer'] < 10.0)) {
if (!is_null($this->container['integer']) && ($this->container['integer'] < 10.0)) {
$invalid_properties[] = "invalid value for 'integer', must be bigger than or equal to 10.0.";
}
if (!is_null(${{$this->container['int32']}}) && ($this->container['int32'] > 200.0)) {
if (!is_null($this->container['int32']) && ($this->container['int32'] > 200.0)) {
$invalid_properties[] = "invalid value for 'int32', must be smaller than or equal to 200.0.";
}
if (!is_null(${{$this->container['int32']}}) && ($this->container['int32'] < 20.0)) {
if (!is_null($this->container['int32']) && ($this->container['int32'] < 20.0)) {
$invalid_properties[] = "invalid value for 'int32', must be bigger than or equal to 20.0.";
}
if ($this->container['number'] === null) {
Expand All @@ -221,19 +221,19 @@ public function listInvalidProperties()
if (($this->container['number'] < 32.1)) {
$invalid_properties[] = "invalid value for 'number', must be bigger than or equal to 32.1.";
}
if (!is_null(${{$this->container['float']}}) && ($this->container['float'] > 987.6)) {
if (!is_null($this->container['float']) && ($this->container['float'] > 987.6)) {
$invalid_properties[] = "invalid value for 'float', must be smaller than or equal to 987.6.";
}
if (!is_null(${{$this->container['float']}}) && ($this->container['float'] < 54.3)) {
if (!is_null($this->container['float']) && ($this->container['float'] < 54.3)) {
$invalid_properties[] = "invalid value for 'float', must be bigger than or equal to 54.3.";
}
if (!is_null(${{$this->container['double']}}) && ($this->container['double'] > 123.4)) {
if (!is_null($this->container['double']) && ($this->container['double'] > 123.4)) {
$invalid_properties[] = "invalid value for 'double', must be smaller than or equal to 123.4.";
}
if (!is_null(${{$this->container['double']}}) && ($this->container['double'] < 67.8)) {
if (!is_null($this->container['double']) && ($this->container['double'] < 67.8)) {
$invalid_properties[] = "invalid value for 'double', must be bigger than or equal to 67.8.";
}
if (!is_null(${{$this->container['string']}}) && !preg_match("/[a-z]/i", $this->container['string'])) {
if (!is_null($this->container['string']) && !preg_match("/[a-z]/i", $this->container['string'])) {
$invalid_properties[] = "invalid value for 'string', must be conform to the pattern /[a-z]/i.";
}
if ($this->container['byte'] === null) {
Expand Down