Passed
Push — master ( a233e6...8f9ef9 )
by Joao
01:58
created
src/Swagger/SwaggerSchema.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
121 121
      */
122 122
     public function setAllowNullValues($value)
123 123
     {
124
-        $this->allowNullValues = (bool) $value;
124
+        $this->allowNullValues = (bool)$value;
125 125
     }
126 126
 }
Please login to merge, or discard this patch.
src/AbstractRequester.php 3 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -157,6 +157,9 @@  discard block
 block discarded – undo
157 157
         return $this;
158 158
     }
159 159
 
160
+    /**
161
+     * @param integer $code
162
+     */
160 163
     public function assertResponseCode($code)
161 164
     {
162 165
         $this->statusExpected = $code;
@@ -266,6 +269,10 @@  discard block
 block discarded – undo
266 269
         return $response;
267 270
     }
268 271
 
272
+    /**
273
+     * @param string $contentType
274
+     * @param string $body
275
+     */
269 276
     protected function parseMultiPartForm($contentType, $body)
270 277
     {
271 278
         $matchRequest = [];
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -285,8 +285,9 @@
 block discarded – undo
285 285
 
286 286
         // loop data blocks
287 287
         foreach ($blocks as $id => $block) {
288
-            if (empty($block))
289
-                continue;
288
+            if (empty($block)) {
289
+                            continue;
290
+            }
290 291
 
291 292
             if (strpos($block, 'application/octet-stream') !== false) {
292 293
                 preg_match("/name=\"([^\"]*)\".*stream[\n|\r]+([^\n\r].*)?$/s", $block, $matches);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -211,10 +211,10 @@  discard block
 block discarded – undo
211 211
             ->withScheme($uriSchema->getScheme())
212 212
             ->withHost($uriSchema->getHost())
213 213
             ->withPort($uriSchema->getPort())
214
-            ->withPath($uriSchema->getPath() . $this->psr7Request->getUri()->getPath());
214
+            ->withPath($uriSchema->getPath().$this->psr7Request->getUri()->getPath());
215 215
 
216
-        if (!preg_match("~^{$this->schema->getBasePath()}~",  $uri->getPath())) {
217
-            $uri = $uri->withPath($this->schema->getBasePath() . $uri->getPath());
216
+        if (!preg_match("~^{$this->schema->getBasePath()}~", $uri->getPath())) {
217
+            $uri = $uri->withPath($this->schema->getBasePath().$uri->getPath());
218 218
         }
219 219
 
220 220
         $this->psr7Request = $this->psr7Request->withUri($uri);
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
         // Handle Request
242 242
         $response = $this->handleRequest($this->psr7Request);
243 243
         $responseHeader = $response->getHeaders();
244
-        $responseBodyStr = (string) $response->getBody();
244
+        $responseBodyStr = (string)$response->getBody();
245 245
         $responseBody = json_decode($responseBodyStr, true);
246 246
         $statusReturned = $response->getStatusCode();
247 247
 
Please login to merge, or discard this patch.
src/ApiTestCase.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
      * @param array|null $query
62 62
      * @param array|null $requestBody
63 63
      * @param array $requestHeader
64
-     * @return mixed
64
+     * @return \Psr\Http\Message\ResponseInterface
65 65
      * @throws DefinitionNotFoundException
66 66
      * @throws GenericSwaggerException
67 67
      * @throws HttpMethodNotFoundException
Please login to merge, or discard this patch.
src/Swagger/SwaggerResponseBody.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
     {
25 25
         if (!isset($this->structure['schema'])) {
26 26
             if (!empty($body)) {
27
-                throw new NotMatchedException("Expected empty body for " . $this->name);
27
+                throw new NotMatchedException("Expected empty body for ".$this->name);
28 28
             }
29 29
             return true;
30 30
         }
Please login to merge, or discard this patch.
src/Exception/BaseException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     {
14 14
         $this->body = $body;
15 15
         if (!empty($body)) {
16
-            $message = $message . " ->\n" . json_encode($body, JSON_PRETTY_PRINT) . "\n";
16
+            $message = $message." ->\n".json_encode($body, JSON_PRETTY_PRINT)."\n";
17 17
         }
18 18
         parent::__construct($message, $code, $previous);
19 19
     }
Please login to merge, or discard this patch.
src/Base/Schema.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     {
79 79
         $method = strtolower($method);
80 80
 
81
-        $path = preg_replace('~^' . $this->getBasePath() . '~', '', $path);
81
+        $path = preg_replace('~^'.$this->getBasePath().'~', '', $path);
82 82
 
83 83
         $uri = new Uri($path);
84 84
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
                 continue;
97 97
             }
98 98
 
99
-            $pathItemPattern = '~^' . preg_replace('~{(.*?)}~', '(?<\1>[^/]+)', $pathItem) . '$~';
99
+            $pathItemPattern = '~^'.preg_replace('~{(.*?)}~', '(?<\1>[^/]+)', $pathItem).'$~';
100 100
 
101 101
             $matches = [];
102 102
             if (preg_match($pathItemPattern, $uri->getPath(), $matches)) {
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
             }
123 123
         }
124 124
 
125
-        throw new PathNotFoundException('Path "' . $path . '" not found');
125
+        throw new PathNotFoundException('Path "'.$path.'" not found');
126 126
     }
127 127
 
128 128
     /**
Please login to merge, or discard this patch.
src/OpenApi/OpenApiResponseBody.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@
 block discarded – undo
24 24
     {
25 25
         if (empty($this->structure['content']) && !isset($this->structure['$ref'])) {
26 26
             if (!empty($body)) {
27
-                throw new NotMatchedException("Expected empty body for " . $this->name);
27
+                throw new NotMatchedException("Expected empty body for ".$this->name);
28 28
             }
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
         }
Please login to merge, or discard this patch.
src/Base/Body.php 2 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      * @param array $schemaArray
89 89
      * @param string $body
90 90
      * @param string $type
91
-     * @return bool
91
+     * @return null|boolean
92 92
      * @throws NotMatchedException
93 93
      */
94 94
     protected function matchString($name, $schemaArray, $body, $type)
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      * @param array $schemaArray
110 110
      * @param string $body
111 111
      * @param string $type
112
-     * @return bool
112
+     * @return null|boolean
113 113
      */
114 114
     protected function matchFile($name, $schemaArray, $body, $type)
115 115
     {
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      * @param string $name
125 125
      * @param string $body
126 126
      * @param string $type
127
-     * @return bool
127
+     * @return null|boolean
128 128
      * @throws NotMatchedException
129 129
      */
130 130
     protected function matchNumber($name, $body, $type)
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      * @param string $name
145 145
      * @param string $body
146 146
      * @param string $type
147
-     * @return bool
147
+     * @return null|boolean
148 148
      * @throws NotMatchedException
149 149
      */
150 150
     protected function matchBool($name, $body, $type)
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      * @param array $schemaArray
166 166
      * @param string $body
167 167
      * @param string $type
168
-     * @return bool
168
+     * @return null|boolean
169 169
      * @throws DefinitionNotFoundException
170 170
      * @throws GenericSwaggerException
171 171
      * @throws InvalidDefinitionException
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
      * @param string $body
362 362
      * @param string $type
363 363
      * @param bool $nullable
364
-     * @return bool
364
+     * @return null|boolean
365 365
      * @throws NotMatchedException
366 366
      */
367 367
     protected function matchNull($name, $body, $type, $nullable)
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
 
16 16
 abstract class Body
17 17
 {
18
-    const SWAGGER_PROPERTIES="properties";
19
-    const SWAGGER_REQUIRED="required";
18
+    const SWAGGER_PROPERTIES = "properties";
19
+    const SWAGGER_REQUIRED = "required";
20 20
 
21 21
     /**
22 22
      * @var Schema
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             return new OpenApiResponseBody($schema, $name, $structure, $allowNullValues);
79 79
         }
80 80
 
81
-        throw new GenericSwaggerException("Cannot get instance SwaggerBody or SchemaBody from " . get_class($schema));
81
+        throw new GenericSwaggerException("Cannot get instance SwaggerBody or SchemaBody from ".get_class($schema));
82 82
     }
83 83
 
84 84
     abstract public function match($body);
@@ -203,32 +203,32 @@  discard block
 block discarded – undo
203 203
         $nullable = isset($schemaArray['nullable']) ? (bool)$schemaArray['nullable'] : $this->schema->isAllowNullValues();
204 204
 
205 205
         $validators = [
206
-            function () use ($name, $body, $type, $nullable)
206
+            function() use ($name, $body, $type, $nullable)
207 207
             {
208 208
                 return $this->matchNull($name, $body, $type, $nullable);
209 209
             },
210 210
 
211
-            function () use ($name, $schemaArray, $body, $type)
211
+            function() use ($name, $schemaArray, $body, $type)
212 212
             {
213 213
                 return $this->matchString($name, $schemaArray, $body, $type);
214 214
             },
215 215
 
216
-            function () use ($name, $body, $type)
216
+            function() use ($name, $body, $type)
217 217
             {
218 218
                 return $this->matchNumber($name, $body, $type);
219 219
             },
220 220
 
221
-            function () use ($name, $body, $type)
221
+            function() use ($name, $body, $type)
222 222
             {
223 223
                 return $this->matchBool($name, $body, $type);
224 224
             },
225 225
 
226
-            function () use ($name, $schemaArray, $body, $type)
226
+            function() use ($name, $schemaArray, $body, $type)
227 227
             {
228 228
                 return $this->matchArray($name, $schemaArray, $body, $type);
229 229
             },
230 230
 
231
-            function () use ($name, $schemaArray, $body, $type)
231
+            function() use ($name, $schemaArray, $body, $type)
232 232
             {
233 233
                 return $this->matchFile($name, $schemaArray, $body, $type);
234 234
             },
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
             return true;
329 329
         }
330 330
 
331
-        if(!isset($schemaArray['$ref']) && isset($schemaArray['content'])) {
331
+        if (!isset($schemaArray['$ref']) && isset($schemaArray['content'])) {
332 332
             $schemaArray['$ref'] = $schemaArray['content'][key($schemaArray['content'])]['schema']['$ref'];
333 333
         }
334 334
 
Please login to merge, or discard this patch.