@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $filename = $cache->getFilename(); |
68 | 68 | if (empty($filename)) { |
69 | 69 | |
70 | - $cache->setFilename(md5(json_encode($schema)) . '.php'); |
|
70 | + $cache->setFilename(md5(json_encode($schema)).'.php'); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // if cache file exists, require it, if not, validate the schema |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | || (!isset($schema->additionalProperties) && (isset($this->rootSchema->additionalProperties) && !$this->rootSchema->additionalProperties)) |
150 | 150 | ) { |
151 | 151 | // $schema->additionalProperties says NO, log that a fields is missing |
152 | - $this->addError(ValidateException::ERROR_USER_DATA_PROPERTY_IS_NOT_AN_ALLOWED_PROPERTY, [$path . '/' . $property]); |
|
152 | + $this->addError(ValidateException::ERROR_USER_DATA_PROPERTY_IS_NOT_AN_ALLOWED_PROPERTY, [$path.'/'.$property]); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | // Everything else |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | public function validate($schema, $property, $data, $path) |
173 | 173 | { |
174 | 174 | // check if the expected $schema->type matches gettype($data) |
175 | - $type = $this->validateType($schema, $data, ((substr($path, -1) !== '/') ? $path . '/' . $property : $path . $property)); |
|
175 | + $type = $this->validateType($schema, $data, ((substr($path, -1) !== '/') ? $path.'/'.$property : $path.$property)); |
|
176 | 176 | |
177 | 177 | // append /$property to $path |
178 | - $path .= (substr($path, 0, 1) !== '/') ? '/' . $property : $property; |
|
178 | + $path .= (substr($path, 0, 1) !== '/') ? '/'.$property : $property; |
|
179 | 179 | |
180 | 180 | // if $type is an object |
181 | 181 | if ($type === BaseValidator::OBJECT) { |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | && ($schema->type === $type) |
187 | 187 | ) { // everything else except boolean |
188 | 188 | |
189 | - $method = 'validate' . ucfirst($type); |
|
189 | + $method = 'validate'.ucfirst($type); |
|
190 | 190 | $this->$method($data, $schema, $path); |
191 | 191 | |
192 | 192 | // check for format property on schema |
@@ -248,12 +248,12 @@ discard block |
||
248 | 248 | // check if the given schema is not empty |
249 | 249 | if (empty($schemaPropertiesInArray)) { |
250 | 250 | |
251 | - throw new ValidateSchemaException(ValidateSchemaException::ERROR_SCHEMA_CANNOT_BE_EMPTY_IN_PATH, [$path . '/properties']); |
|
251 | + throw new ValidateSchemaException(ValidateSchemaException::ERROR_SCHEMA_CANNOT_BE_EMPTY_IN_PATH, [$path.'/properties']); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | foreach ($schema->properties as $property => $childSchema) { |
255 | 255 | |
256 | - $subPath = $path . '.properties'; |
|
256 | + $subPath = $path.'.properties'; |
|
257 | 257 | |
258 | 258 | // when an object key is empty it becomes '_empty_' by json_decode(), catch it since this is not valid |
259 | 259 | if ($property === '_empty_') { |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | 'Schema', |
271 | 271 | $this->getPreposition(gettype($childSchema)), |
272 | 272 | gettype($childSchema), |
273 | - (' in ' . $subPath) |
|
273 | + (' in '.$subPath) |
|
274 | 274 | ]); |
275 | 275 | } |
276 | 276 | |
277 | 277 | // do recursion |
278 | - $schema->properties->$property = $this->validateSchema($childSchema, ($subPath . '.' . $property)); |
|
278 | + $schema->properties->$property = $this->validateSchema($childSchema, ($subPath.'.'.$property)); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | // check if the optional property 'required' is set on $schema |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | } elseif ($schema->type === BaseValidator::_ARRAY) { |
288 | 288 | |
289 | 289 | // do recursion |
290 | - $schema->items = $this->validateSchema($schema->items, ($path . '.items')); |
|
290 | + $schema->items = $this->validateSchema($schema->items, ($path.'.items')); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | return $schema; |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | */ |
503 | 503 | private function validateSchemaRequiredAgainstProperties($schema, $path) |
504 | 504 | { |
505 | - $requiredPath = $path . '.required'; |
|
505 | + $requiredPath = $path.'.required'; |
|
506 | 506 | |
507 | 507 | // $schema->required must be an array |
508 | 508 | if (!is_array($schema->required)) { |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | |
697 | 697 | $data = str_replace("\n", '', $data); |
698 | 698 | $data = preg_replace("/\r|\n/", '', $data); |
699 | - $data = (strlen($data) < 25) ? $data : substr($data, 0, 25) . ' [...]'; |
|
699 | + $data = (strlen($data) < 25) ? $data : substr($data, 0, 25).' [...]'; |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | $params[] = $data; |