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.
Test Failed
Push — master ( 004efd...1e9f36 )
by cao
15:19
created
src/Docgen/Swagger/Swagger.php 3 patches
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,6 @@  discard block
 block discarded – undo
8 8
 use PhpBoot\Docgen\Swagger\Schemas\ArraySchemaObject;
9 9
 use PhpBoot\Docgen\Swagger\Schemas\BodyParameterObject;
10 10
 use PhpBoot\Docgen\Swagger\Schemas\OperationObject;
11
-use PhpBoot\Docgen\Swagger\Schemas\OtherParameterObject;
12 11
 use PhpBoot\Docgen\Swagger\Schemas\PrimitiveSchemaObject;
13 12
 use PhpBoot\Docgen\Swagger\Schemas\RefSchemaObject;
14 13
 use PhpBoot\Docgen\Swagger\Schemas\ResponseObject;
@@ -22,8 +21,6 @@  discard block
 block discarded – undo
22 21
 use PhpBoot\Metas\ParamMeta;
23 22
 use PhpBoot\Metas\ReturnMeta;
24 23
 use PhpBoot\Utils\ArrayHelper;
25
-use PhpBoot\Validator\Validator;
26
-use Symfony\Component\HttpKernel\Exception\HttpException;
27 24
 
28 25
 class Swagger extends SwaggerObject
29 26
 {
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 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
         }
@@ -136,30 +136,30 @@  discard block
 block discarded – undo
136 136
             list($name, $desc) = $exception;
137 137
 
138 138
             $ins = null;
139
-            try{
139
+            try {
140 140
                 $ins = $app->make($name);
141
-            }catch (\Exception $e){
141
+            }catch (\Exception $e) {
142 142
 
143 143
             }
144 144
 
145 145
             //TODO status 重复怎么办
146 146
             if ($ins instanceof HttpExceptio) {
147 147
                 $status = $ins->getStatusCode();
148
-            } else {
148
+            }else {
149 149
                 $status = 500;
150 150
             }
151 151
             if (isset($schemas[$status])) {
152 152
                 //$this->warnings[] = "status response $status has been used for $name, $desc";
153 153
                 $res = $schemas[$status];
154
-            } else {
154
+            }else {
155 155
                 $res = new ResponseObject();
156 156
             }
157 157
             $shortName = self::getShortClassName($name);
158 158
             $desc = "$shortName: $desc";
159 159
             $res->description = self::implode("\n", [$res->description, $desc]);
160
-            if($ins){
160
+            if ($ins) {
161 161
                 $error = $app->get(ExceptionRenderer::class)->render($ins)->getContent();
162
-                if($error){
162
+                if ($error) {
163 163
                     $res->examples = [$shortName => $error];
164 164
                 }
165 165
             }
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
     {
220 220
         if ($content instanceof ReturnMeta || $content instanceof ParamMeta) {
221 221
             return $this->makeExample($content->container);
222
-        }elseif ($content instanceof TypeContainerInterface){
222
+        }elseif ($content instanceof TypeContainerInterface) {
223 223
             return $content->makeExample();
224
-        }elseif(is_array($content)) {
224
+        }elseif (is_array($content)) {
225 225
             $res = [];
226 226
             foreach ($content as $k => $v) {
227 227
                 $res[$k] = $this->makeExample($v);
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
                                    array $arr, $suffix)
247 247
     {
248 248
         $className = self::getShortClassName($controller->getClassName());
249
-        $name = $className . ucfirst($action) . $suffix;
249
+        $name = $className.ucfirst($action).$suffix;
250 250
 
251 251
         $schema = new SimpleModelSchemaObject();
252 252
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
                 } elseif ($v->container instanceof EntityContainer) {
265 265
                     $sub = $this->getRefSchema($app, $controller, $action, $route, $v->container);
266 266
                     //TODO array for validation
267
-                } else {
267
+                }else {
268 268
                     $sub = new PrimitiveSchemaObject();
269 269
                     $sub->type = self::mapType($v->type);
270 270
                     self::mapValidation($v->validation, $sub);
@@ -276,14 +276,14 @@  discard block
 block discarded – undo
276 276
                     $schema->required[] = $k;
277 277
                 }
278 278
                 $schema->properties[$k] = $sub;
279
-            } else {
279
+            }else {
280 280
                 //TODO how to do?
281 281
             }
282 282
         }
283 283
         $unused = $name;
284 284
         $tempId = 0;
285 285
         while (isset($this->definitions[$unused])) {
286
-            $unused = $name . $tempId;
286
+            $unused = $name.$tempId;
287 287
             $tempId++;
288 288
         }
289 289
         $this->definitions[$unused] = $schema;
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
         $in = 'query';
323 323
 
324 324
         $bodyType = 'body'; // 当有文件上传时, 必须是formData方式
325
-        if($this->hasFileParam($route)){
325
+        if ($this->hasFileParam($route)) {
326 326
             $bodyType = 'formData';
327 327
         }
328 328
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
                     || $route->getMethod() == 'PATCH'
362 362
                 ) {
363 363
                     $in = $bodyType;
364
-                } else {
364
+                }else {
365 365
                     $in = 'query';
366 366
                 }
367 367
             }
@@ -372,11 +372,11 @@  discard block
 block discarded – undo
372 372
                 } elseif ($param->container instanceof EntityContainer) {
373 373
                     $paramSchema = $this->getRefSchema($app, $controller, $action, $route, $param->container);
374 374
                     //TODO array for validation
375
-                } else {
375
+                }else {
376 376
                     $paramSchema = new PrimitiveSchemaObject();
377
-                    if($isFile){
377
+                    if ($isFile) {
378 378
                         $paramSchema->type = 'file';
379
-                    }else{
379
+                    }else {
380 380
                         $paramSchema->type = self::mapType($param->type);
381 381
                         self::mapValidation($param->validation, $paramSchema);
382 382
                     }
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
                 $paramSchema->default = $param->default;
389 389
                 $paramSchema->required = !$param->isOptional;
390 390
                 $parameters[] = $paramSchema;
391
-            } else {
391
+            }else {
392 392
                 if (!$name) {
393 393
                     $body = $param;
394
-                } else {
394
+                }else {
395 395
                     ArrayHelper::set($body, $name, $param);
396 396
                 }
397 397
 
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
             $paramSchema->in = 'body';
405 405
             if (is_array($body)) {
406 406
                 $paramSchema->schema = $this->makeTempSchema($app, $controller, $action, $route, $body, 'Req');
407
-            } else {
407
+            }else {
408 408
                 $paramSchema->schema = $this->getAnySchema($app, $controller, $action, $route, $body->container);
409 409
             }
410 410
 
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
         } elseif ($container instanceof ScalarTypeContainer) {
432 432
             $schema = new PrimitiveSchemaObject();
433 433
             $schema->type = self::mapType($container->getType());
434
-        } elseif($container == null){
435
-            $schema = null ;//new PrimitiveSchemaObject();
434
+        } elseif ($container == null) {
435
+            $schema = null; //new PrimitiveSchemaObject();
436 436
             //$schema->type = null;
437 437
         }else {
438 438
             $schema = new PrimitiveSchemaObject();
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
         } elseif ($itemContainer instanceof ScalarTypeContainer) {
465 465
             $itemSchema = new PrimitiveSchemaObject();
466 466
             $itemSchema->type = self::mapType($itemContainer->getType());
467
-        } else {
467
+        }else {
468 468
             $itemSchema = new PrimitiveSchemaObject();
469 469
             //$itemSchema->type = 'mixed';
470 470
         }
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
                 $propertySchema = $this->getRefSchema($app, $controller, $action, $route, $property->container);
491 491
             } elseif ($property->container instanceof ArrayContainer) {
492 492
                 $propertySchema = $this->getArraySchema($app, $controller, $action, $route, $property->container);
493
-            } else {
493
+            }else {
494 494
                 $propertySchema = new PrimitiveSchemaObject();
495 495
                 $propertySchema->type = self::mapType($property->type);
496 496
                 $propertySchema->description = self::implode("\n", [$property->summary, $property->description]);
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
     {
508 508
         $params = $route->getRequestHandler()->getParamMetas();
509 509
         foreach ($params as $name => $param) {
510
-            if(strpos($param->source, 'request.files.')===0){
510
+            if (strpos($param->source, 'request.files.') === 0) {
511 511
                 return true;
512 512
             }
513 513
         }
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
      */
521 521
     static public function mapValidation($v, PrimitiveSchemaObject $schemaObject)
522 522
     {
523
-        if(!$v){
523
+        if (!$v) {
524 524
             return $schemaObject;
525 525
         }
526 526
         $rules = explode('|', $v);
@@ -536,15 +536,15 @@  discard block
 block discarded – undo
536 536
             } elseif ($rule == 'lengthBetween' && isset($params[0]) && isset($params[1])) {
537 537
                 $schemaObject->minLength = intval($params[0]);
538 538
                 $schemaObject->maxLength = intval($params[1]);
539
-            } elseif ($rule == 'lengthMin'&& isset($params[0])) {
539
+            } elseif ($rule == 'lengthMin' && isset($params[0])) {
540 540
                 $schemaObject->minLength = intval($params[0]);
541
-            } elseif ($rule == 'lengthMax'&& isset($params[0])) {
541
+            } elseif ($rule == 'lengthMax' && isset($params[0])) {
542 542
                 $schemaObject->maxLength = intval($params[0]);
543
-            } elseif ($rule == 'min'&& isset($params[0])) {
543
+            } elseif ($rule == 'min' && isset($params[0])) {
544 544
                 $schemaObject->minimum = floatval($params[0]);
545
-            } elseif ($rule == 'max'&& isset($params[0])) {
545
+            } elseif ($rule == 'max' && isset($params[0])) {
546 546
                 $schemaObject->maximum = floatval($params[0]);
547
-            } elseif ($rule == 'regex'&& isset($params[0])) {
547
+            } elseif ($rule == 'regex' && isset($params[0])) {
548 548
                 $schemaObject->pattern = $params[0];
549 549
             } elseif ($rule == 'optional') {
550 550
                 $schemaObject->required = false;
@@ -583,9 +583,9 @@  discard block
 block discarded – undo
583 583
         return $className;
584 584
     }
585 585
 
586
-    static public function implode($glue , array $pieces )
586
+    static public function implode($glue, array $pieces)
587 587
     {
588
-        $pieces = array_filter($pieces, function($i){return trim($i) !== '';});
588
+        $pieces = array_filter($pieces, function($i) {return trim($i) !== ''; });
589 589
         return implode($glue, $pieces);
590 590
     }
591 591
 }
592 592
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
             $ins = null;
139 139
             try{
140 140
                 $ins = $app->make($name);
141
-            }catch (\Exception $e){
141
+            } catch (\Exception $e){
142 142
 
143 143
             }
144 144
 
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
     {
220 220
         if ($content instanceof ReturnMeta || $content instanceof ParamMeta) {
221 221
             return $this->makeExample($content->container);
222
-        }elseif ($content instanceof TypeContainerInterface){
222
+        } elseif ($content instanceof TypeContainerInterface){
223 223
             return $content->makeExample();
224
-        }elseif(is_array($content)) {
224
+        } elseif(is_array($content)) {
225 225
             $res = [];
226 226
             foreach ($content as $k => $v) {
227 227
                 $res[$k] = $this->makeExample($v);
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                     $paramSchema = new PrimitiveSchemaObject();
377 377
                     if($isFile){
378 378
                         $paramSchema->type = 'file';
379
-                    }else{
379
+                    } else{
380 380
                         $paramSchema->type = self::mapType($param->type);
381 381
                         self::mapValidation($param->validation, $paramSchema);
382 382
                     }
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
         } elseif($container == null){
435 435
             $schema = null ;//new PrimitiveSchemaObject();
436 436
             //$schema->type = null;
437
-        }else {
437
+        } else {
438 438
             $schema = new PrimitiveSchemaObject();
439 439
             //$schema->type = 'mixed';
440 440
         }
Please login to merge, or discard this patch.