GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( f2f29b...9dbfb1 )
by cao
03:07
created
src/Docgen/Swagger/Swagger.php 2 patches
Doc Comments   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     }
94 94
 
95 95
     /**
96
-     * @param $object
96
+     * @param Swagger $object
97 97
      * @return array
98 98
      */
99 99
     static public function objectToArray($object)
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     /**
119 119
      * @param Application $app
120 120
      * @param ControllerContainer $controller
121
-     * @param $action
121
+     * @param integer $action
122 122
      * @param Route $route
123 123
      * @return array
124 124
      */
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
     /**
168 168
      * @param Application $app
169 169
      * @param ControllerContainer $controller
170
-     * @param $action
170
+     * @param integer $action
171 171
      * @param Route $route
172 172
      * @return null|ResponseObject
173 173
      */
@@ -305,6 +305,9 @@  discard block
 block discarded – undo
305 305
         return new RefSchemaObject("#/definitions/$name");
306 306
     }
307 307
 
308
+    /**
309
+     * @param integer $action
310
+     */
308 311
     public function getParamsSchema(Application $app,
309 312
                                     ControllerContainer $controller,
310 313
                                     $action,
@@ -577,6 +580,9 @@  discard block
 block discarded – undo
577 580
         return $className;
578 581
     }
579 582
 
583
+    /**
584
+     * @param string $glue
585
+     */
580 586
     static public function implode($glue , array $pieces )
581 587
     {
582 588
         $pieces = array_filter($pieces, function($i){return trim($i) !== '';});
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
             $op->description = $route->getDescription();
59 59
 
60 60
             $op->parameters = $this->getParamsSchema($app, $controller, $action, $route);
61
-            if($this->hasFileParam($route)){
61
+            if ($this->hasFileParam($route)) {
62 62
                 $op->consumes = ['multipart/form-data'];
63 63
             }
64 64
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             }
109 109
             if (is_array($v) || is_object($v)) {
110 110
                 $res[$k] = self::objectToArray($v);
111
-            } else {
111
+            }else {
112 112
                 $res[$k] = $v;
113 113
             }
114 114
         }
@@ -140,21 +140,21 @@  discard block
 block discarded – undo
140 140
             //TODO status 重复怎么办
141 141
             if ($ins instanceof HttpException) {
142 142
                 $status = $ins->getStatusCode();
143
-            } else {
143
+            }else {
144 144
 
145 145
                 $status = 500;
146 146
             }
147 147
             if (isset($schemas[$status])) {
148 148
                 //$this->warnings[] = "status response $status has been used for $name, $desc";
149 149
                 $res = $schemas[$status];
150
-            } else {
150
+            }else {
151 151
                 $res = new ResponseObject();
152 152
             }
153 153
             $shortName = self::getShortClassName($name);
154 154
             $desc = "$shortName: $desc";
155 155
             $res->description = self::implode("\n", [$res->description, $desc]);
156 156
             $error = $app->get(ExceptionRenderer::class)->render($ins)->getContent();
157
-            if($error){
157
+            if ($error) {
158 158
                 $res->examples = [$shortName => $error];
159 159
             }
160 160
             //$res->schema = new RefSchemaObject("#/definitions/$name");
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
     {
214 214
         if ($content instanceof ReturnMeta || $content instanceof ParamMeta) {
215 215
             return $this->makeExample($content->container);
216
-        }elseif ($content instanceof TypeContainerInterface){
216
+        }elseif ($content instanceof TypeContainerInterface) {
217 217
             return $content->makeExample();
218
-        }elseif(is_array($content)) {
218
+        }elseif (is_array($content)) {
219 219
             $res = [];
220 220
             foreach ($content as $k => $v) {
221 221
                 $res[$k] = $this->makeExample($v);
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
                                    array $arr, $suffix)
241 241
     {
242 242
         $className = self::getShortClassName($controller->getClassName());
243
-        $name = $className . ucfirst($action) . $suffix;
243
+        $name = $className.ucfirst($action).$suffix;
244 244
 
245 245
         $schema = new SimpleModelSchemaObject();
246 246
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
                 } elseif ($v->container instanceof EntityContainer) {
259 259
                     $sub = $this->getRefSchema($app, $controller, $action, $route, $v->container);
260 260
                     //TODO array for validation
261
-                } else {
261
+                }else {
262 262
                     $sub = new PrimitiveSchemaObject();
263 263
                     $sub->type = self::mapType($v->type);
264 264
                     self::mapValidation($v->validation, $sub);
@@ -270,14 +270,14 @@  discard block
 block discarded – undo
270 270
                     $schema->required[] = $k;
271 271
                 }
272 272
                 $schema->properties[$k] = $sub;
273
-            } else {
273
+            }else {
274 274
                 //TODO how to do?
275 275
             }
276 276
         }
277 277
         $unused = $name;
278 278
         $tempId = 0;
279 279
         while (isset($this->definitions[$unused])) {
280
-            $unused = $name . $tempId;
280
+            $unused = $name.$tempId;
281 281
             $tempId++;
282 282
         }
283 283
         $this->definitions[$unused] = $schema;
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
         $in = 'query';
317 317
 
318 318
         $bodyType = 'body'; // 当有文件上传时, 必须是formData方式
319
-        if($this->hasFileParam($route)){
319
+        if ($this->hasFileParam($route)) {
320 320
             $bodyType = 'formData';
321 321
         }
322 322
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
                     || $route->getMethod() == 'PATCH'
356 356
                 ) {
357 357
                     $in = $bodyType;
358
-                } else {
358
+                }else {
359 359
                     $in = 'query';
360 360
                 }
361 361
             }
@@ -366,11 +366,11 @@  discard block
 block discarded – undo
366 366
                 } elseif ($param->container instanceof EntityContainer) {
367 367
                     $paramSchema = $this->getRefSchema($app, $controller, $action, $route, $param->container);
368 368
                     //TODO array for validation
369
-                } else {
369
+                }else {
370 370
                     $paramSchema = new PrimitiveSchemaObject();
371
-                    if($isFile){
371
+                    if ($isFile) {
372 372
                         $paramSchema->type = 'file';
373
-                    }else{
373
+                    }else {
374 374
                         $paramSchema->type = self::mapType($param->type);
375 375
                         self::mapValidation($param->validation, $paramSchema);
376 376
                     }
@@ -382,10 +382,10 @@  discard block
 block discarded – undo
382 382
                 $paramSchema->default = $param->default;
383 383
                 $paramSchema->required = !$param->isOptional;
384 384
                 $parameters[] = $paramSchema;
385
-            } else {
385
+            }else {
386 386
                 if (!$name) {
387 387
                     $body = $param;
388
-                } else {
388
+                }else {
389 389
                     ArrayHelper::set($body, $name, $param);
390 390
                 }
391 391
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
             $paramSchema->in = 'body';
399 399
             if (is_array($body)) {
400 400
                 $paramSchema->schema = $this->makeTempSchema($app, $controller, $action, $route, $body, 'Req');
401
-            } else {
401
+            }else {
402 402
                 $paramSchema->schema = $this->getAnySchema($app, $controller, $action, $route, $body->container);
403 403
             }
404 404
 
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
         } elseif ($container instanceof ScalarTypeContainer) {
426 426
             $schema = new PrimitiveSchemaObject();
427 427
             $schema->type = self::mapType($container->getType());
428
-        } elseif($container == null){
429
-            $schema = null ;//new PrimitiveSchemaObject();
428
+        } elseif ($container == null) {
429
+            $schema = null; //new PrimitiveSchemaObject();
430 430
             //$schema->type = null;
431 431
         }else {
432 432
             $schema = new PrimitiveSchemaObject();
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
         } elseif ($itemContainer instanceof ScalarTypeContainer) {
459 459
             $itemSchema = new PrimitiveSchemaObject();
460 460
             $itemSchema->type = self::mapType($itemContainer->getType());
461
-        } else {
461
+        }else {
462 462
             $itemSchema = new PrimitiveSchemaObject();
463 463
             //$itemSchema->type = 'mixed';
464 464
         }
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
                 $propertySchema = $this->getRefSchema($app, $controller, $action, $route, $property->container);
485 485
             } elseif ($property->container instanceof ArrayContainer) {
486 486
                 $propertySchema = $this->getArraySchema($app, $controller, $action, $route, $property->container);
487
-            } else {
487
+            }else {
488 488
                 $propertySchema = new PrimitiveSchemaObject();
489 489
                 $propertySchema->type = self::mapType($property->type);
490 490
                 $propertySchema->description = self::implode("\n", [$property->summary, $property->description]);
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
     {
502 502
         $params = $route->getRequestHandler()->getParamMetas();
503 503
         foreach ($params as $name => $param) {
504
-            if(strpos($param->source, 'request.files.')===0){
504
+            if (strpos($param->source, 'request.files.') === 0) {
505 505
                 return true;
506 506
             }
507 507
         }
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
      */
515 515
     static public function mapValidation($v, PrimitiveSchemaObject $schemaObject)
516 516
     {
517
-        if(!$v){
517
+        if (!$v) {
518 518
             return $schemaObject;
519 519
         }
520 520
         $rules = explode('|', $v);
@@ -530,15 +530,15 @@  discard block
 block discarded – undo
530 530
             } elseif ($rule == 'lengthBetween' && isset($params[0]) && isset($params[1])) {
531 531
                 $schemaObject->minLength = intval($params[0]);
532 532
                 $schemaObject->maxLength = intval($params[1]);
533
-            } elseif ($rule == 'lengthMin'&& isset($params[0])) {
533
+            } elseif ($rule == 'lengthMin' && isset($params[0])) {
534 534
                 $schemaObject->minLength = intval($params[0]);
535
-            } elseif ($rule == 'lengthMax'&& isset($params[0])) {
535
+            } elseif ($rule == 'lengthMax' && isset($params[0])) {
536 536
                 $schemaObject->maxLength = intval($params[0]);
537
-            } elseif ($rule == 'min'&& isset($params[0])) {
537
+            } elseif ($rule == 'min' && isset($params[0])) {
538 538
                 $schemaObject->minimum = floatval($params[0]);
539
-            } elseif ($rule == 'max'&& isset($params[0])) {
539
+            } elseif ($rule == 'max' && isset($params[0])) {
540 540
                 $schemaObject->maximum = floatval($params[0]);
541
-            } elseif ($rule == 'regex'&& isset($params[0])) {
541
+            } elseif ($rule == 'regex' && isset($params[0])) {
542 542
                 $schemaObject->pattern = $params[0];
543 543
             } elseif ($rule == 'optional') {
544 544
                 $schemaObject->required = false;
@@ -577,9 +577,9 @@  discard block
 block discarded – undo
577 577
         return $className;
578 578
     }
579 579
 
580
-    static public function implode($glue , array $pieces )
580
+    static public function implode($glue, array $pieces)
581 581
     {
582
-        $pieces = array_filter($pieces, function($i){return trim($i) !== '';});
582
+        $pieces = array_filter($pieces, function($i) {return trim($i) !== ''; });
583 583
         return implode($glue, $pieces);
584 584
     }
585 585
 }
586 586
\ No newline at end of file
Please login to merge, or discard this patch.