1- class { {classname} } { {#parentSchema} }extends { {{parent} }} { {/parentSchema} }implements ModelInterface, ArrayAccess
1+ class { {classname} } { {#parentSchema} }extends { {{parent} }} { {/parentSchema} }{ {^parentSchema } } implements ModelInterface, ArrayAccess{ {/parentSchema } }
22{
33 const DISCRIMINATOR = {{#discriminator} }'{ {discriminator} }'{ {/discriminator} }{ {^discriminator} }null{ {/discriminator} };
44
55 /**
66 * The original name of the model.
7+ *
78 * @var string
89 */
910 protected static $swaggerModelName = '{ {name} }';
1011
1112 /**
1213 * Array of property to type mappings. Used for (de)serialization
14+ *
1315 * @var string[]
1416 */
1517 protected static $swaggerTypes = [
@@ -19,6 +21,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
1921
2022 /**
2123 * Array of property to format mappings. Used for (de)serialization
24+ *
2225 * @var string[]
2326 */
2427 protected static $swaggerFormats = [
@@ -47,7 +50,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
4750 }
4851
4952 /**
50- * Array of attributes where the key is the local name, and the value is the original name
53+ * Array of attributes where the key is the local name,
54+ * and the value is the original name
55+ *
5156 * @var string[]
5257 */
5358 protected static $attributeMap = [
@@ -57,6 +62,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
5762
5863 /**
5964 * Array of attributes to setter functions (for deserialization of responses)
65+ *
6066 * @var string[]
6167 */
6268 protected static $setters = [
@@ -66,6 +72,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
6672
6773 /**
6874 * Array of attributes to getter functions (for serialization of requests)
75+ *
6976 * @var string[]
7077 */
7178 protected static $getters = [
@@ -74,7 +81,8 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
7481 ];
7582
7683 /**
77- * Array of attributes where the key is the local name, and the value is the original name
84+ * Array of attributes where the key is the local name,
85+ * and the value is the original name
7886 *
7987 * @return array
8088 */
@@ -119,6 +127,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
119127 { {#vars} }{ {#isEnum} }
120128 /**
121129 * Gets allowable values of the enum
130+ *
122131 * @return string[]
123132 */
124133 public function { {getter} }AllowableValues()
@@ -130,15 +139,20 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
130139 }
131140 { {/isEnum} }{ {/vars} }
132141
142+ { {^parentSchema} }
133143 /**
134144 * Associative array for storing property values
145+ *
135146 * @var mixed[]
136147 */
137148 protected $container = [];
149+ { {/parentSchema} }
138150
139151 /**
140152 * Constructor
141- * @param mixed[] $data Associated array of property values initializing the model
153+ *
154+ * @param mixed[] $data Associated array of property values
155+ * initializing the model
142156 */
143157 public function __construct(array $data = null)
144158 {
@@ -165,25 +179,25 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
165179 public function listInvalidProperties()
166180 {
167181 {{#parent} }
168- $invalid_properties = parent::listInvalidProperties();
182+ $invalidProperties = parent::listInvalidProperties();
169183 { {/parent} }
170184 { {^parent} }
171- $invalid_properties = [];
185+ $invalidProperties = [];
172186 { {/parent} }
173187
174188 { {#vars} }
175189 { {#required} }
176190 if ($this->container['{ {name} }'] === null) {
177- $invalid_properties [] = " '{{name}}' can't be null" ;
191+ $invalidProperties [] = " '{{name}}' can't be null" ;
178192 }
179193 { {/required} }
180194 { {#isEnum} }
181195 { {^isContainer} }
182- $allowed_values = $this->{ {getter} }AllowableValues();
183- if (!in_array($this->container['{ {name} }'], $allowed_values )) {
184- $invalid_properties [] = sprintf(
196+ $allowedValues = $this->{ {getter} }AllowableValues();
197+ if (!in_array($this->container['{ {name} }'], $allowedValues )) {
198+ $invalidProperties [] = sprintf(
185199 " invalid value for '{{name}}', must be one of '%s'" ,
186- implode(" ', '" , $allowed_values )
200+ implode(" ', '" , $allowedValues )
187201 );
188202 }
189203
@@ -192,53 +206,53 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
192206 { {#hasValidation} }
193207 { {#maxLength} }
194208 if ({ {^required} }!is_null($this->container['{ {name} }']) && { {/required} }(strlen($this->container['{ {name} }']) > { {maxLength} })) {
195- $invalid_properties [] = " invalid value for '{{name}}', the character length must be smaller than or equal to {{{maxLength}}}." ;
209+ $invalidProperties [] = " invalid value for '{{name}}', the character length must be smaller than or equal to {{{maxLength}}}." ;
196210 }
197211
198212 { {/maxLength} }
199213 { {#minLength} }
200214 if ({ {^required} }!is_null($this->container['{ {name} }']) && { {/required} }(strlen($this->container['{ {name} }']) < { {minLength} })) {
201- $invalid_properties [] = " invalid value for '{{name}}', the character length must be bigger than or equal to {{{minLength}}}." ;
215+ $invalidProperties [] = " invalid value for '{{name}}', the character length must be bigger than or equal to {{{minLength}}}." ;
202216 }
203217
204218 { {/minLength} }
205219 { {#maximum} }
206220 if ({ {^required} }!is_null($this->container['{ {name} }']) && { {/required} }($this->container['{ {name} }'] >{ {#exclusiveMaximum} }={ {/exclusiveMaximum} } { {maximum} })) {
207- $invalid_properties [] = " invalid value for '{{name}}', must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}." ;
221+ $invalidProperties [] = " invalid value for '{{name}}', must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}." ;
208222 }
209223
210224 { {/maximum} }
211225 { {#minimum} }
212226 if ({ {^required} }!is_null($this->container['{ {name} }']) && { {/required} }($this->container['{ {name} }'] <{ {#exclusiveMinimum} }={ {/exclusiveMinimum} } { {minimum} })) {
213- $invalid_properties [] = " invalid value for '{{name}}', must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}." ;
227+ $invalidProperties [] = " invalid value for '{{name}}', must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}." ;
214228 }
215229
216230 { {/minimum} }
217231 { {#pattern} }
218232 if ({ {^required} }!is_null($this->container['{ {name} }']) && { {/required} }!preg_match("{ {{pattern} }}", $this->container['{ {name} }'])) {
219- $invalid_properties [] = " invalid value for '{{name}}', must be conform to the pattern {{{pattern}}}." ;
233+ $invalidProperties [] = " invalid value for '{{name}}', must be conform to the pattern {{{pattern}}}." ;
220234 }
221235
222236 { {/pattern} }
223237 { {#maxItems} }
224238 if ({ {^required} }!is_null($this->container['{ {name} }']) && { {/required} }(count($this->container['{ {name} }']) > { {maxItems} })) {
225- $invalid_properties [] = " invalid value for '{{name}}', number of items must be less than or equal to {{{maxItems}}}." ;
239+ $invalidProperties [] = " invalid value for '{{name}}', number of items must be less than or equal to {{{maxItems}}}." ;
226240 }
227241
228242 { {/maxItems} }
229243 { {#minItems} }
230244 if ({ {^required} }!is_null($this->container['{ {name} }']) && { {/required} }(count($this->container['{ {name} }']) < { {minItems} })) {
231- $invalid_properties [] = " invalid value for '{{name}}', number of items must be greater than or equal to {{{minItems}}}." ;
245+ $invalidProperties [] = " invalid value for '{{name}}', number of items must be greater than or equal to {{{minItems}}}." ;
232246 }
233247
234248 { {/minItems} }
235249 { {/hasValidation} }
236250 { {/vars} }
237- return $invalid_properties ;
251+ return $invalidProperties ;
238252 }
239253
240254 /**
241- * validate all the properties in the model
255+ * Validate all the properties in the model
242256 * return true if all passed
243257 *
244258 * @return bool True if all properties are valid
@@ -259,8 +273,8 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
259273 { {/required} }
260274 { {#isEnum} }
261275 { {^isContainer} }
262- $allowed_values = $this->{ {getter} }AllowableValues();
263- if (!in_array($this->container['{ {name} }'], $allowed_values )) {
276+ $allowedValues = $this->{ {getter} }AllowableValues();
277+ if (!in_array($this->container['{ {name} }'], $allowedValues )) {
264278 return false ;
265279 }
266280 { {/isContainer} }
@@ -310,6 +324,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
310324
311325 /**
312326 * Gets { {name} }
327+ *
313328 * @return { {datatype} }
314329 */
315330 public function { {getter} }()
@@ -319,29 +334,31 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
319334
320335 /**
321336 * Sets { {name} }
337+ *
322338 * @param { {datatype} } ${ {name} }{ {#description} } { {{description} }}{ {/description} }
339+ *
323340 * @return $this
324341 */
325342 public function { {setter} }(${ {name} })
326343 {
327344 {{#isEnum} }
328- $allowed_values = $this->{ {getter} }AllowableValues();
345+ $allowedValues = $this->{ {getter} }AllowableValues();
329346 { {^isContainer} }
330- if ({ {^required} }!is_null(${ {name} }) && { {/required} }!in_array(${ {{name} }}, $allowed_values )) {
347+ if ({ {^required} }!is_null(${ {name} }) && { {/required} }!in_array(${ {{name} }}, $allowedValues )) {
331348 throw new \InvalidArgumentException(
332349 sprintf(
333350 " Invalid value for '{{name}}', must be one of '%s'" ,
334- implode(" ', '" , $allowed_values )
351+ implode(" ', '" , $allowedValues )
335352 )
336353 );
337354 }
338355 { {/isContainer} }
339356 { {#isContainer} }
340- if ({ {^required} }!is_null(${ {name} }) && { {/required} }array_diff(${ {{name} }}, $allowed_values )) {
357+ if ({ {^required} }!is_null(${ {name} }) && { {/required} }array_diff(${ {{name} }}, $allowedValues )) {
341358 throw new \InvalidArgumentException(
342359 sprintf(
343360 " Invalid value for '{{name}}', must be one of '%s'" ,
344- implode(" ', '" , $allowed_values )
361+ implode(" ', '" , $allowedValues )
345362 )
346363 );
347364 }
@@ -389,7 +406,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
389406 { {/vars} }
390407 /**
391408 * Returns true if offset exists. False otherwise.
392- * @param integer $offset Offset
409+ *
410+ * @param integer $offset Offset
411+ *
393412 * @return boolean
394413 */
395414 public function offsetExists($offset)
@@ -399,7 +418,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
399418
400419 /**
401420 * Gets offset.
402- * @param integer $offset Offset
421+ *
422+ * @param integer $offset Offset
423+ *
403424 * @return mixed
404425 */
405426 public function offsetGet($offset)
@@ -409,8 +430,10 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
409430
410431 /**
411432 * Sets value based on offset.
412- * @param integer $offset Offset
413- * @param mixed $value Value to be set
433+ *
434+ * @param integer $offset Offset
435+ * @param mixed $value Value to be set
436+ *
414437 * @return void
415438 */
416439 public function offsetSet($offset, $value)
@@ -424,7 +447,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
424447
425448 /**
426449 * Unsets offset.
427- * @param integer $offset Offset
450+ *
451+ * @param integer $offset Offset
452+ *
428453 * @return void
429454 */
430455 public function offsetUnset($offset)
@@ -434,14 +459,18 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
434459
435460 /**
436461 * Gets the string presentation of the object
462+ *
437463 * @return string
438464 */
439465 public function __toString()
440466 {
441467 if (defined(' JSON_PRETTY_PRINT' )) { // use JSON pretty print
442- return json_encode(\{{invokerPackage} }\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
468+ return json_encode(
469+ ObjectSerializer::sanitizeForSerialization($this ),
470+ JSON_PRETTY_PRINT
471+ );
443472 }
444473
445- return json_encode(\ { {invokerPackage } }\ ObjectSerializer::sanitizeForSerialization($this));
474+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
446475 }
447476}
0 commit comments