@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | protected $allowNullValues; |
21 | 21 | protected $specificationVersion; |
22 | 22 | |
23 | - const SWAGGER_PATHS="paths"; |
|
24 | - const SWAGGER_PARAMETERS="parameters"; |
|
25 | - const SWAGGER_COMPONENTS="components"; |
|
23 | + const SWAGGER_PATHS = "paths"; |
|
24 | + const SWAGGER_PARAMETERS = "parameters"; |
|
25 | + const SWAGGER_COMPONENTS = "components"; |
|
26 | 26 | |
27 | 27 | public function __construct($jsonFile, $allowNullValues = false) |
28 | 28 | { |
29 | 29 | $this->jsonFile = json_decode($jsonFile, true); |
30 | - $this->allowNullValues = (bool) $allowNullValues; |
|
30 | + $this->allowNullValues = (bool)$allowNullValues; |
|
31 | 31 | $this->specificationVersion = isset($this->jsonFile['swagger']) ? '2' : '3'; |
32 | 32 | } |
33 | 33 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | public function getBasePath() |
59 | 59 | { |
60 | 60 | if ($this->getSpecificationVersion() === '3') { |
61 | - $basePath =isset($this->jsonFile['servers']) ? explode('/', $this->jsonFile['servers'][0]['url']) : ''; |
|
61 | + $basePath = isset($this->jsonFile['servers']) ? explode('/', $this->jsonFile['servers'][0]['url']) : ''; |
|
62 | 62 | return is_array($basePath) ? '/' . end($basePath) : $basePath; |
63 | 63 | } |
64 | 64 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | { |
218 | 218 | $structure = $this->getPathDefinition($path, $method); |
219 | 219 | |
220 | - if($this->getSpecificationVersion() === '3') { |
|
220 | + if ($this->getSpecificationVersion() === '3') { |
|
221 | 221 | if (!isset($structure['requestBody'])) { |
222 | 222 | return new SwaggerRequestBody($this, "$method $path", []); |
223 | 223 | } |
@@ -271,6 +271,6 @@ discard block |
||
271 | 271 | */ |
272 | 272 | public function setAllowNullValues($value) |
273 | 273 | { |
274 | - $this->allowNullValues = (bool) $value; |
|
274 | + $this->allowNullValues = (bool)$value; |
|
275 | 275 | } |
276 | 276 | } |
@@ -119,6 +119,9 @@ |
||
119 | 119 | return $this; |
120 | 120 | } |
121 | 121 | |
122 | + /** |
|
123 | + * @param integer $code |
|
124 | + */ |
|
122 | 125 | public function assertResponseCode($code) |
123 | 126 | { |
124 | 127 | $this->statusExpected = $code; |
@@ -9,8 +9,8 @@ discard block |
||
9 | 9 | |
10 | 10 | abstract class SwaggerBody |
11 | 11 | { |
12 | - const SWAGGER_PROPERTIES="properties"; |
|
13 | - const SWAGGER_REQUIRED="required"; |
|
12 | + const SWAGGER_PROPERTIES = "properties"; |
|
13 | + const SWAGGER_REQUIRED = "required"; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * @var SwaggerSchema |
@@ -147,27 +147,27 @@ discard block |
||
147 | 147 | $type = $schema['type']; |
148 | 148 | |
149 | 149 | $validators = [ |
150 | - function () use ($name, $body, $type) |
|
150 | + function() use ($name, $body, $type) |
|
151 | 151 | { |
152 | 152 | return $this->matchNull($name, $body, $type); |
153 | 153 | }, |
154 | 154 | |
155 | - function () use ($name, $schema, $body, $type) |
|
155 | + function() use ($name, $schema, $body, $type) |
|
156 | 156 | { |
157 | 157 | return $this->matchString($name, $schema, $body, $type); |
158 | 158 | }, |
159 | 159 | |
160 | - function () use ($name, $body, $type) |
|
160 | + function() use ($name, $body, $type) |
|
161 | 161 | { |
162 | 162 | return $this->matchNumber($name, $body, $type); |
163 | 163 | }, |
164 | 164 | |
165 | - function () use ($name, $body, $type) |
|
165 | + function() use ($name, $body, $type) |
|
166 | 166 | { |
167 | 167 | return $this->matchBool($name, $body, $type); |
168 | 168 | }, |
169 | 169 | |
170 | - function () use ($name, $schema, $body, $type) |
|
170 | + function() use ($name, $schema, $body, $type) |
|
171 | 171 | { |
172 | 172 | return $this->matchArray($name, $schema, $body, $type); |
173 | 173 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | return true; |
268 | 268 | } |
269 | 269 | |
270 | - if(!isset($schema['$ref']) && isset($schema['content'])) { |
|
270 | + if (!isset($schema['$ref']) && isset($schema['content'])) { |
|
271 | 271 | $schema['$ref'] = $schema['content'][key($schema['content'])]['schema']['$ref']; |
272 | 272 | } |
273 | 273 |