@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | |
16 | 16 | abstract class Body |
17 | 17 | { |
18 | - const SWAGGER_PROPERTIES="properties"; |
|
19 | - const SWAGGER_ADDITIONAL_PROPERTIES="additionalProperties"; |
|
20 | - const SWAGGER_REQUIRED="required"; |
|
18 | + const SWAGGER_PROPERTIES = "properties"; |
|
19 | + const SWAGGER_ADDITIONAL_PROPERTIES = "additionalProperties"; |
|
20 | + const SWAGGER_REQUIRED = "required"; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @var Schema |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | return new OpenApiResponseBody($schema, $name, $structure, $allowNullValues); |
80 | 80 | } |
81 | 81 | |
82 | - throw new GenericSwaggerException("Cannot get instance SwaggerBody or SchemaBody from " . get_class($schema)); |
|
82 | + throw new GenericSwaggerException("Cannot get instance SwaggerBody or SchemaBody from ".get_class($schema)); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | abstract public function match($body); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | if (!is_string($body)) { |
110 | - throw new NotMatchedException("Value '" . var_export($body, true) . "' in '$name' is not string. ", $this->structure); |
|
110 | + throw new NotMatchedException("Value '".var_export($body, true)."' in '$name' is not string. ", $this->structure); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return true; |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | |
116 | 116 | private function checkPattern($name, $body, $pattern) |
117 | 117 | { |
118 | - $pattern = '/' . rtrim(ltrim($pattern, '/'), '/') . '/'; |
|
119 | - $isSuccess = (bool) preg_match($pattern, $body, $matches); |
|
118 | + $pattern = '/'.rtrim(ltrim($pattern, '/'), '/').'/'; |
|
119 | + $isSuccess = (bool)preg_match($pattern, $body, $matches); |
|
120 | 120 | |
121 | 121 | if (!$isSuccess) { |
122 | 122 | throw new NotMatchedException("Value '$body' in '$name' not matched in pattern. ", $this->structure); |
@@ -226,32 +226,32 @@ discard block |
||
226 | 226 | $nullable = isset($schemaArray['nullable']) ? (bool)$schemaArray['nullable'] : $this->schema->isAllowNullValues(); |
227 | 227 | |
228 | 228 | $validators = [ |
229 | - function () use ($name, $body, $type, $nullable) |
|
229 | + function() use ($name, $body, $type, $nullable) |
|
230 | 230 | { |
231 | 231 | return $this->matchNull($name, $body, $type, $nullable); |
232 | 232 | }, |
233 | 233 | |
234 | - function () use ($name, $schemaArray, $body, $type) |
|
234 | + function() use ($name, $schemaArray, $body, $type) |
|
235 | 235 | { |
236 | 236 | return $this->matchString($name, $schemaArray, $body, $type); |
237 | 237 | }, |
238 | 238 | |
239 | - function () use ($name, $body, $type) |
|
239 | + function() use ($name, $body, $type) |
|
240 | 240 | { |
241 | 241 | return $this->matchNumber($name, $body, $type); |
242 | 242 | }, |
243 | 243 | |
244 | - function () use ($name, $body, $type) |
|
244 | + function() use ($name, $body, $type) |
|
245 | 245 | { |
246 | 246 | return $this->matchBool($name, $body, $type); |
247 | 247 | }, |
248 | 248 | |
249 | - function () use ($name, $schemaArray, $body, $type) |
|
249 | + function() use ($name, $schemaArray, $body, $type) |
|
250 | 250 | { |
251 | 251 | return $this->matchArray($name, $schemaArray, $body, $type); |
252 | 252 | }, |
253 | 253 | |
254 | - function () use ($name, $schemaArray, $body, $type) |
|
254 | + function() use ($name, $schemaArray, $body, $type) |
|
255 | 255 | { |
256 | 256 | return $this->matchFile($name, $schemaArray, $body, $type); |
257 | 257 | }, |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | return true; |
361 | 361 | } |
362 | 362 | |
363 | - if(!isset($schemaArray['$ref']) && isset($schemaArray['content'])) { |
|
363 | + if (!isset($schemaArray['$ref']) && isset($schemaArray['content'])) { |
|
364 | 364 | $schemaArray['$ref'] = $schemaArray['content'][key($schemaArray['content'])]['schema']['$ref']; |
365 | 365 | } |
366 | 366 |