Completed
Pull Request — master (#29)
by Joao
07:15
created
src/SwaggerRequester.php 1 patch
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -33,6 +33,9 @@  discard block
 block discarded – undo
33 33
         $this->guzzleHttpClient = new Client(['headers' => ['User-Agent' => 'Swagger Test']]);
34 34
     }
35 35
 
36
+    /**
37
+     * @param SwaggerSchema $schema
38
+     */
36 39
     public function withSwaggerSchema($schema)
37 40
     {
38 41
         $this->swaggerSchema = $schema;
@@ -105,6 +108,9 @@  discard block
 block discarded – undo
105 108
         return $this;
106 109
     }
107 110
 
111
+    /**
112
+     * @param integer $code
113
+     */
108 114
     public function assertResponseCode($code)
109 115
     {
110 116
         $this->statusExpected = $code;
Please login to merge, or discard this patch.
src/SwaggerBody.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
8 8
 
9 9
 abstract class SwaggerBody
10 10
 {
11
-    const SWAGGER_PROPERTIES="properties";
12
-    const SWAGGER_REQUIRED="required";
11
+    const SWAGGER_PROPERTIES = "properties";
12
+    const SWAGGER_REQUIRED = "required";
13 13
 
14 14
     /**
15 15
      * @var \ByJG\Swagger\SwaggerSchema
@@ -146,27 +146,27 @@  discard block
 block discarded – undo
146 146
         $type = $schema['type'];
147 147
 
148 148
         $validators = [
149
-            function () use ($name, $body, $type)
149
+            function() use ($name, $body, $type)
150 150
             {
151 151
                 return $this->matchNull($name, $body, $type);
152 152
             },
153 153
 
154
-            function () use ($name, $schema, $body, $type)
154
+            function() use ($name, $schema, $body, $type)
155 155
             {
156 156
                 return $this->matchString($name, $schema, $body, $type);
157 157
             },
158 158
 
159
-            function () use ($name, $body, $type)
159
+            function() use ($name, $body, $type)
160 160
             {
161 161
                 return $this->matchNumber($name, $body, $type);
162 162
             },
163 163
 
164
-            function () use ($name, $body, $type)
164
+            function() use ($name, $body, $type)
165 165
             {
166 166
                 return $this->matchBool($name, $body, $type);
167 167
             },
168 168
 
169
-            function () use ($name, $schema, $body, $type)
169
+            function() use ($name, $schema, $body, $type)
170 170
             {
171 171
                 return $this->matchArray($name, $schema, $body, $type);
172 172
             }
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
             return true;
267 267
         }
268 268
 
269
-        if(!isset($schema['$ref']) && isset($schema['content'])) {
269
+        if (!isset($schema['$ref']) && isset($schema['content'])) {
270 270
             $schema['$ref'] = $schema['content'][key($schema['content'])]['schema']['$ref'];
271 271
         }
272 272
 
Please login to merge, or discard this patch.
src/SwaggerSchema.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
271 271
      */
272 272
     public function setAllowNullValues($value)
273 273
     {
274
-        $this->allowNullValues = (bool) $value;
274
+        $this->allowNullValues = (bool)$value;
275 275
     }
276 276
 }
Please login to merge, or discard this patch.