Completed
Pull Request — master (#56)
by Michal
12:52
created
src/Params/JsonInputParam.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 
10 10
 class JsonInputParam extends InputParam
11 11
 {
12
-    const TYPE_POST_JSON  = 'POST_JSON';
12
+    const TYPE_POST_JSON = 'POST_JSON';
13 13
 
14 14
     private $schemaValidator;
15 15
 
Please login to merge, or discard this patch.
src/Handlers/OpenApiHandler.php 3 patches
Doc Comments   +10 added lines patch added patch discarded remove patch
@@ -223,6 +223,7 @@  discard block
 block discarded – undo
223 223
      *
224 224
      * @param array $versionHandlers
225 225
      * @param string $basePath
226
+     * @param string $baseUrl
226 227
      *
227 228
      * @return array
228 229
      */
@@ -308,6 +309,9 @@  discard block
 block discarded – undo
308 309
         return $list;
309 310
     }
310 311
 
312
+    /**
313
+     * @param string $baseUrl
314
+     */
311 315
     private function getBasePath($handlers, $baseUrl)
312 316
     {
313 317
         $basePath = null;
@@ -317,6 +321,9 @@  discard block
 block discarded – undo
317 321
         return rtrim(str_replace($baseUrl, '', $basePath), '/');
318 322
     }
319 323
 
324
+    /**
325
+     * @param string $path2
326
+     */
320 327
     private function getLongestCommonSubstring($path1, $path2)
321 328
     {
322 329
         if ($path1 === null) {
@@ -382,6 +389,9 @@  discard block
 block discarded – undo
382 389
         return null;
383 390
     }
384 391
 
392
+    /**
393
+     * @param string $type
394
+     */
385 395
     private function createIn($type)
386 396
     {
387 397
         if ($type == InputParam::TYPE_GET) {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,6 @@
 block discarded – undo
14 14
 use Tomaj\NetteApi\Params\JsonInputParam;
15 15
 use Tomaj\NetteApi\Response\JsonApiResponse;
16 16
 use Tomaj\NetteApi\Response\TextApiResponse;
17
-use Tracy\Debugger;
18 17
 
19 18
 class OpenApiHandler extends BaseHandler
20 19
 {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $handlers = $this->getHandlers($version);
87 87
         $scheme = $this->request->getUrl()->getScheme();
88 88
         $host = $this->request->getUrl()->getHost();
89
-        $baseUrl = $scheme . '://' . $host;
89
+        $baseUrl = $scheme.'://'.$host;
90 90
         $basePath = $this->getBasePath($handlers, $baseUrl);
91 91
 
92 92
         $responses = [
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             ],
136 136
             'servers' => [
137 137
                 [
138
-                    'url' => $scheme . '://' . $host . $basePath,
138
+                    'url' => $scheme.'://'.$host.$basePath,
139 139
                 ],
140 140
             ],
141 141
             'components' => [
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      */
213 213
     private function getHandlers($version)
214 214
     {
215
-        $versionHandlers = array_filter($this->apiDecider->getHandlers(), function ($handler) use ($version) {
215
+        $versionHandlers = array_filter($this->apiDecider->getHandlers(), function($handler) use ($version) {
216 216
             return $version == $handler['endpoint']->getVersion();
217 217
         });
218 218
         return $versionHandlers;
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
     private function addDefinition($name, $definition)
430 430
     {
431 431
         if (isset($this->definitions[$name])) {
432
-            throw new InvalidArgumentException('Definition with name ' . $name . ' already exists. Rename it or use existing one.');
432
+            throw new InvalidArgumentException('Definition with name '.$name.' already exists. Rename it or use existing one.');
433 433
         }
434 434
         $this->definitions[$name] = $definition;
435 435
     }
Please login to merge, or discard this patch.
src/Handlers/SwaggerHandler.php 2 patches
Doc Comments   +10 added lines patch added patch discarded remove patch
@@ -159,6 +159,7 @@  discard block
 block discarded – undo
159 159
      *
160 160
      * @param array $versionHandlers
161 161
      * @param string $basePath
162
+     * @param string $baseUrl
162 163
      *
163 164
      * @return array
164 165
      */
@@ -251,6 +252,9 @@  discard block
 block discarded – undo
251 252
         return $list;
252 253
     }
253 254
 
255
+    /**
256
+     * @param string $baseUrl
257
+     */
254 258
     private function getBasePath($handlers, $baseUrl)
255 259
     {
256 260
         $basePath = null;
@@ -260,6 +264,9 @@  discard block
 block discarded – undo
260 264
         return rtrim(str_replace($baseUrl, '', $basePath), '/');
261 265
     }
262 266
 
267
+    /**
268
+     * @param string $path2
269
+     */
263 270
     private function getLongestCommonSubstring($path1, $path2)
264 271
     {
265 272
         if ($path1 === null) {
@@ -306,6 +313,9 @@  discard block
 block discarded – undo
306 313
         }, $handler->params());
307 314
     }
308 315
 
316
+    /**
317
+     * @param string $type
318
+     */
309 319
     private function createIn($type)
310 320
     {
311 321
         if ($type == InputParam::TYPE_GET) {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         $handlers = $this->getHandlers($version);
71 71
         $scheme = $this->request->getUrl()->getScheme();
72 72
         $host = $this->request->getUrl()->getHost();
73
-        $baseUrl = $scheme . '://' . $host;
73
+        $baseUrl = $scheme.'://'.$host;
74 74
         $basePath = $this->getBasePath($handlers, $baseUrl);
75 75
 
76 76
         $responses = [
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     private function getHandlers($version)
150 150
     {
151
-        $versionHandlers = array_filter($this->apiDecider->getHandlers(), function ($handler) use ($version) {
151
+        $versionHandlers = array_filter($this->apiDecider->getHandlers(), function($handler) use ($version) {
152 152
             return $version == $handler['endpoint']->getVersion();
153 153
         });
154 154
         return $versionHandlers;
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      */
286 286
     private function createParamsList(ApiHandlerInterface $handler)
287 287
     {
288
-        return array_map(function (InputParam $param) {
288
+        return array_map(function(InputParam $param) {
289 289
             $parameter = [
290 290
                 'name' => $param->getKey(),
291 291
                 'in' => $this->createIn($param->getType()),
Please login to merge, or discard this patch.