@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | |
12 | 12 | abstract class Body |
13 | 13 | { |
14 | - const SWAGGER_PROPERTIES="properties"; |
|
15 | - const SWAGGER_REQUIRED="required"; |
|
14 | + const SWAGGER_PROPERTIES = "properties"; |
|
15 | + const SWAGGER_REQUIRED = "required"; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * @var Schema |
@@ -150,27 +150,27 @@ discard block |
||
150 | 150 | $nullable = isset($schema['nullable']) ? (bool)$schema['nullable'] : $this->schema->isAllowNullValues(); |
151 | 151 | |
152 | 152 | $validators = [ |
153 | - function () use ($name, $body, $type, $nullable) |
|
153 | + function() use ($name, $body, $type, $nullable) |
|
154 | 154 | { |
155 | 155 | return $this->matchNull($name, $body, $type, $nullable); |
156 | 156 | }, |
157 | 157 | |
158 | - function () use ($name, $schema, $body, $type) |
|
158 | + function() use ($name, $schema, $body, $type) |
|
159 | 159 | { |
160 | 160 | return $this->matchString($name, $schema, $body, $type); |
161 | 161 | }, |
162 | 162 | |
163 | - function () use ($name, $body, $type) |
|
163 | + function() use ($name, $body, $type) |
|
164 | 164 | { |
165 | 165 | return $this->matchNumber($name, $body, $type); |
166 | 166 | }, |
167 | 167 | |
168 | - function () use ($name, $body, $type) |
|
168 | + function() use ($name, $body, $type) |
|
169 | 169 | { |
170 | 170 | return $this->matchBool($name, $body, $type); |
171 | 171 | }, |
172 | 172 | |
173 | - function () use ($name, $schema, $body, $type) |
|
173 | + function() use ($name, $schema, $body, $type) |
|
174 | 174 | { |
175 | 175 | return $this->matchArray($name, $schema, $body, $type); |
176 | 176 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | return true; |
271 | 271 | } |
272 | 272 | |
273 | - if(!isset($schema['$ref']) && isset($schema['content'])) { |
|
273 | + if (!isset($schema['$ref']) && isset($schema['content'])) { |
|
274 | 274 | $schema['$ref'] = $schema['content'][key($schema['content'])]['schema']['$ref']; |
275 | 275 | } |
276 | 276 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | throw new InvalidArgumentException('schema must be given as array or JSON string'); |
30 | 30 | } |
31 | 31 | $this->jsonFile = $data; |
32 | - $this->allowNullValues = (bool) $allowNullValues; |
|
32 | + $this->allowNullValues = (bool)$allowNullValues; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function getHttpSchema() |
@@ -121,6 +121,6 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function setAllowNullValues($value) |
123 | 123 | { |
124 | - $this->allowNullValues = (bool) $value; |
|
124 | + $this->allowNullValues = (bool)$value; |
|
125 | 125 | } |
126 | 126 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | return true; |
30 | 30 | } |
31 | 31 | |
32 | - if(!isset($this->structure['content']) && isset($this->structure['$ref'])){ |
|
32 | + if (!isset($this->structure['content']) && isset($this->structure['$ref'])) { |
|
33 | 33 | $defintion = $this->schema->getDefinition($this->structure['$ref']); |
34 | 34 | return $this->matchSchema($this->name, $defintion, $body); |
35 | 35 | } |
@@ -155,6 +155,9 @@ |
||
155 | 155 | $this->psr7Request->withHeader("Accept", "application/json"); |
156 | 156 | } |
157 | 157 | |
158 | + /** |
|
159 | + * @param integer $code |
|
160 | + */ |
|
158 | 161 | public function assertResponseCode($code) |
159 | 162 | { |
160 | 163 | $this->statusExpected = $code; |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | ->withPort($uriSchema->getPort()) |
200 | 200 | ->withPath($uriSchema->getPath() . $this->psr7Request->getUri()->getPath()); |
201 | 201 | |
202 | - if (!preg_match("~^{$this->schema->getBasePath()}~", $this->psr7Request->getUri()->getPath())) { |
|
202 | + if (!preg_match("~^{$this->schema->getBasePath()}~", $this->psr7Request->getUri()->getPath())) { |
|
203 | 203 | $this->psr7Request->getUri()->withPath($this->schema->getBasePath() . $this->psr7Request->getUri()->getPath()); |
204 | 204 | } |
205 | 205 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | // Handle Request |
224 | 224 | $response = $this->handleRequest($this->psr7Request); |
225 | 225 | $responseHeader = $response->getHeaders(); |
226 | - $responseBodyStr = (string) $response->getBody(); |
|
226 | + $responseBodyStr = (string)$response->getBody(); |
|
227 | 227 | $responseBody = json_decode($responseBodyStr, true); |
228 | 228 | $statusReturned = $response->getStatusCode(); |
229 | 229 |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @param array|null $query |
61 | 61 | * @param array|null $requestBody |
62 | 62 | * @param array $requestHeader |
63 | - * @return mixed |
|
63 | + * @return \Psr\Http\Message\ResponseInterface |
|
64 | 64 | * @throws DefinitionNotFoundException |
65 | 65 | * @throws GenericSwaggerException |
66 | 66 | * @throws HttpMethodNotFoundException |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | /** |
103 | 103 | * @param AbstractRequester $request |
104 | - * @return mixed |
|
104 | + * @return \Psr\Http\Message\ResponseInterface |
|
105 | 105 | * @throws DefinitionNotFoundException |
106 | 106 | * @throws GenericSwaggerException |
107 | 107 | * @throws HttpMethodNotFoundException |