1 | <?php |
||
15 | trait Property |
||
16 | { |
||
17 | /** |
||
18 | * Returns camel cased property's getter or setter method name. Checks method for existence. |
||
19 | * |
||
20 | * @param string $prefix Prefix of the method e.g. "set" or "get" |
||
21 | * @param string $name Method's name |
||
22 | * |
||
23 | * @return null|string |
||
24 | */ |
||
25 | protected function getSetGetMethodName($prefix, $name) |
||
35 | |||
36 | /** |
||
37 | * Sets properties of the class from array. |
||
38 | * |
||
39 | * @param array $data An associative array with property => value data |
||
40 | */ |
||
41 | protected function setProperties(array $data) |
||
47 | |||
48 | /** |
||
49 | * Sets property of the class. |
||
50 | * |
||
51 | * @param string $name Property name |
||
52 | * @param null|mixed $value Value of the property |
||
53 | */ |
||
54 | protected function setProperty($name, $value = null) |
||
68 | |||
69 | /** |
||
70 | * Returns properties as string. Used for building get query string if GET method was set. |
||
71 | * |
||
72 | * @return string |
||
73 | */ |
||
74 | public function getPropertiesAsString() |
||
80 | |||
81 | /** |
||
82 | * Returns an array with properties. Array with supported properties should be defined |
||
83 | * in the class. |
||
84 | * |
||
85 | * @param bool $validate Flag whether validation for required properties should be applied |
||
86 | * |
||
87 | * @return array |
||
88 | */ |
||
89 | public function getPropertiesArray($validate = true) |
||
118 | |||
119 | public function getPropertiesMultipart($validate = true) |
||
133 | |||
134 | /** |
||
135 | * Validates properties and checks which are required |
||
136 | * |
||
137 | * @param array $properties An associative array of the properties |
||
138 | * |
||
139 | * @throws PropertyException |
||
140 | */ |
||
141 | protected function validateProperties($properties) |
||
149 | |||
150 | /** |
||
151 | * Returns object's properties encoded as JSON string |
||
152 | * |
||
153 | * @param bool $validate Flag whether validation for required properties should be applied |
||
154 | * |
||
155 | * @return string |
||
156 | */ |
||
157 | public function asJson($validate = true) |
||
163 | } |
||
164 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: