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
Branch master (eecfea)
by cao
03:46
created
src/Controller/ResponseHandler.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function eraseMapping($target)
29 29
     {
30
-        if(!isset($this->mappings[$target])){
30
+        if (!isset($this->mappings[$target])) {
31 31
             return null;
32 32
         }
33 33
         $ori = $this->mappings[$target];
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function getMapping($target)
43 43
     {
44
-        if(!array_key_exists($target, $this->mappings)){
44
+        if (!array_key_exists($target, $this->mappings)) {
45 45
             return null;
46 46
         }
47 47
         return $this->mappings[$target];
@@ -60,15 +60,15 @@  discard block
 block discarded – undo
60 60
             'params'=>$params
61 61
         ];
62 62
 
63
-        if($return instanceof Response){ //直接返回Response时, 对return不再做映射
63
+        if ($return instanceof Response) { //直接返回Response时, 对return不再做映射
64 64
             return $return;
65 65
         }
66 66
         $mappings = $this->getMappings();
67 67
 
68 68
         $output = [];
69
-        foreach($mappings as $key=>$map){
69
+        foreach ($mappings as $key=>$map) {
70 70
             $val = \JmesPath\search($map->source, $input);
71
-            if(substr($key, 0, strlen('response.')) == 'response.'){
71
+            if (substr($key, 0, strlen('response.')) == 'response.') {
72 72
                 $key = substr($key, strlen('response.'));
73 73
             }
74 74
             ArrayHelper::set($output, $key, $val);
Please login to merge, or discard this patch.
src/Controller/ResponseRenderer.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,19 +15,19 @@
 block discarded – undo
15 15
     {
16 16
         $response = new Response();
17 17
         $response->headers->set('Content-Type', 'application/json');
18
-        foreach ($output as $key=>$value){
18
+        foreach ($output as $key=>$value) {
19 19
             //TODO 支持自定义格式输出
20 20
             //TODO 支持更多的输出目标
21
-            if($key == 'content'){
22
-                if(is_array($value) || is_object($value)){
21
+            if ($key == 'content') {
22
+                if (is_array($value) || is_object($value)) {
23 23
                     $value = json_encode($value, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
24 24
                 }
25 25
                 $response->setContent($value);
26
-            }elseif($key == 'headers'){
27
-                foreach ($value as $k=>$v){
26
+            }elseif ($key == 'headers') {
27
+                foreach ($value as $k=>$v) {
28 28
                     $response->headers->set($k, $v);
29 29
                 }
30
-            }else{
30
+            }else {
31 31
                 \PhpBoot\abort(new \UnexpectedValueException("Unexpected output target $key"));
32 32
             }
33 33
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@
 block discarded – undo
23 23
                     $value = json_encode($value, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
24 24
                 }
25 25
                 $response->setContent($value);
26
-            }elseif($key == 'headers'){
26
+            } elseif($key == 'headers'){
27 27
                 foreach ($value as $k=>$v){
28 28
                     $response->headers->set($k, $v);
29 29
                 }
30
-            }else{
30
+            } else{
31 31
                 \PhpBoot\abort(new \UnexpectedValueException("Unexpected output target $key"));
32 32
             }
33 33
 
Please login to merge, or discard this patch.
src/Controller/ExceptionRenderer.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@
 block discarded – undo
14 14
      */
15 15
     public function render(\Exception $e)
16 16
     {
17
-        if($e instanceof HttpException){
17
+        if ($e instanceof HttpException) {
18 18
             return new Response($e->getMessage(), $e->getStatusCode());
19
-        } if($e instanceof \InvalidArgumentException){
19
+        } if ($e instanceof \InvalidArgumentException) {
20 20
             return new Response($e->getMessage(), Response::HTTP_BAD_REQUEST);
21
-        }else{
21
+        }else {
22 22
             return new Response($e->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR);
23 23
         }
24 24
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
             return new Response($e->getMessage(), $e->getStatusCode());
19 19
         } if($e instanceof \InvalidArgumentException){
20 20
             return new Response($e->getMessage(), Response::HTTP_BAD_REQUEST);
21
-        }else{
21
+        } else{
22 22
             return new Response($e->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR);
23 23
         }
24 24
     }
Please login to merge, or discard this patch.
src/Controller/ExceptionHandler.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,10 +50,10 @@
 block discarded – undo
50 50
      * @param callable $call
51 51
      * @return \Symfony\Component\HttpFoundation\Response
52 52
      */
53
-    public function handler(Application $app, callable $call){
54
-        try{
53
+    public function handler(Application $app, callable $call) {
54
+        try {
55 55
             return $call();
56
-        }catch (\Exception $e){
56
+        }catch (\Exception $e) {
57 57
             $renderer = $app->get(ExceptionRenderer::class); //TODO 放在这里是否合适
58 58
             return $renderer->render($e);
59 59
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
     public function handler(Application $app, callable $call){
54 54
         try{
55 55
             return $call();
56
-        }catch (\Exception $e){
56
+        } catch (\Exception $e){
57 57
             $renderer = $app->get(ExceptionRenderer::class); //TODO 放在这里是否合适
58 58
             return $renderer->render($e);
59 59
         }
Please login to merge, or discard this patch.
src/Controller/Annotations/ParamAnnotationHandler.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -21,17 +21,17 @@  discard block
 block discarded – undo
21 21
         $paramType = null;
22 22
         $paramName = null;
23 23
         $paramDoc = '';
24
-        if(substr($text, 0, 1) == '$'){ //带$前缀的是变量
24
+        if (substr($text, 0, 1) == '$') { //带$前缀的是变量
25 25
             $params = new AnnotationParams($text, 2);
26 26
             $paramName = substr($params->getParam(0), 1);
27 27
             $paramDoc = $params->getRawParam(1, '');
28
-        }else{
28
+        }else {
29 29
             $params = new AnnotationParams($text, 3);
30
-            if ($params->count() >=2 && substr($params->getParam(1), 0, 1) == '$'){
30
+            if ($params->count()>=2 && substr($params->getParam(1), 0, 1) == '$') {
31 31
                 $paramType = $params->getParam(0); //TODO 检测类型是否合法
32 32
                 $paramName = substr($params->getParam(1), 1);
33 33
                 $paramDoc = $params->getRawParam(2, '');
34
-            }else{
34
+            }else {
35 35
                 \PhpBoot\abort(new AnnotationSyntaxException("@param $text syntax error"));
36 36
             }
37 37
         }
@@ -44,15 +44,15 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public function __invoke(ControllerContainer $container, $ann, EntityContainerBuilder $entityBuilder)
46 46
     {
47
-        if(!$ann->parent){
47
+        if (!$ann->parent) {
48 48
             //Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()} should be used with parent route");
49 49
             return;
50 50
         }
51 51
         $target = $ann->parent->name;
52 52
         $route = $container->getRoute($target);
53
-        if(!$route){
53
+        if (!$route) {
54 54
             //Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()}::$target should be used with parent route");
55
-            return ;
55
+            return;
56 56
         }
57 57
         $className = $container->getClassName();
58 58
 
@@ -61,18 +61,18 @@  discard block
 block discarded – undo
61 61
         $paramMeta = $route->getRequestHandler()->getParamMeta($paramName);
62 62
         $paramMeta or \PhpBoot\abort(new AnnotationSyntaxException("$className::$target param $paramName not exist "));
63 63
         //TODO 检测声明的类型和注释的类型是否匹配
64
-        if($paramType){
65
-            $paramMeta->type = TypeHint::normalize($paramType, $className);//or \PhpBoot\abort(new AnnotationSyntaxException("{$container->getClassName()}::{$ann->parent->name} @{$ann->name} syntax error, param $paramName unknown type:$paramType "));
64
+        if ($paramType) {
65
+            $paramMeta->type = TypeHint::normalize($paramType, $className); //or \PhpBoot\abort(new AnnotationSyntaxException("{$container->getClassName()}::{$ann->parent->name} @{$ann->name} syntax error, param $paramName unknown type:$paramType "));
66 66
             $container = ContainerFactory::create($entityBuilder, $paramMeta->type);
67 67
             $paramMeta->container = $container;
68 68
         }
69 69
         $paramMeta->description = $paramDoc;
70 70
 
71 71
         $responseHandler = $route->getResponseHandler();
72
-        if($paramMeta->isPassedByReference && $responseHandler){
72
+        if ($paramMeta->isPassedByReference && $responseHandler) {
73 73
             $mappings = $responseHandler->getMappings();
74
-            foreach ($mappings as $k => $v){
75
-                if($v->source == 'params.'.$paramMeta->name){
74
+            foreach ($mappings as $k => $v) {
75
+                if ($v->source == 'params.'.$paramMeta->name) {
76 76
                     $v->description = $paramMeta->description;
77 77
                     $v->type = $paramMeta->type;
78 78
                     $v->container = $paramMeta->container;
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@
 block discarded – undo
25 25
             $params = new AnnotationParams($text, 2);
26 26
             $paramName = substr($params->getParam(0), 1);
27 27
             $paramDoc = $params->getRawParam(1, '');
28
-        }else{
28
+        } else{
29 29
             $params = new AnnotationParams($text, 3);
30 30
             if ($params->count() >=2 && substr($params->getParam(1), 0, 1) == '$'){
31 31
                 $paramType = $params->getParam(0); //TODO 检测类型是否合法
32 32
                 $paramName = substr($params->getParam(1), 1);
33 33
                 $paramDoc = $params->getRawParam(2, '');
34
-            }else{
34
+            } else{
35 35
                 \PhpBoot\abort(new AnnotationSyntaxException("@param $text syntax error"));
36 36
             }
37 37
         }
Please login to merge, or discard this patch.
src/Controller/Annotations/ReturnAnnotationHandler.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,20 +21,20 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public function __invoke(ControllerContainer $container, $ann, EntityContainerBuilder $entityBuilder)
23 23
     {
24
-        if(!$ann->parent){
24
+        if (!$ann->parent) {
25 25
             //Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()} should be used with parent route");
26 26
             return;
27 27
         }
28 28
         $target = $ann->parent->name;
29 29
         $route = $container->getRoute($target);
30
-        if(!$route){
30
+        if (!$route) {
31 31
             //Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()}::$target should be used with parent route");
32
-            return ;
32
+            return;
33 33
         }
34 34
 
35 35
         $params = new AnnotationParams($ann->description, 2);
36 36
         $type = $doc = null;
37
-        if(count($params)>0){
37
+        if (count($params)>0) {
38 38
             $type = TypeHint::normalize($params[0], $container->getClassName());
39 39
         }
40 40
         $doc = $params->getRawParam(1, '');
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
         $meta = $route
44 44
             ->getResponseHandler()
45 45
             ->getMapping('response.content');
46
-        if($meta){
46
+        if ($meta) {
47 47
             $meta->description = $doc;
48 48
             $meta->type = $type;
49
-            $meta->container = $type == 'void'?null:ContainerFactory::create($entityBuilder, $type);
49
+            $meta->container = $type == 'void' ? null : ContainerFactory::create($entityBuilder, $type);
50 50
         }
51 51
     }
52 52
 }
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
src/Controller/Annotations/RouteAnnotationHandler.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
             'DELETE'
44 44
         ]) or \PhpBoot\abort(new AnnotationSyntaxException("unknown method http $httpMethod in {$container->getClassName()}::$target"));
45 45
         //获取方法参数信息
46
-        $rfl =  new \ReflectionClass($container->getClassName());
46
+        $rfl = new \ReflectionClass($container->getClassName());
47 47
         $method = $rfl->getMethod($target);
48 48
         $methodParams = $method->getParameters();
49 49
 
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
         $routeParser = new Std();
69 69
         $uri = $params->getParam(1);
70 70
         $info = $routeParser->parse($uri); //0.4和1.0返回值不同, 不兼容
71
-        if(isset($info[0])){
72
-            foreach ($info[0] as $i){
73
-                if(is_array($i)) {
71
+        if (isset($info[0])) {
72
+            foreach ($info[0] as $i) {
73
+                if (is_array($i)) {
74 74
                     $route->addPathParam($i[0]);
75 75
                 }
76 76
             }
@@ -79,31 +79,31 @@  discard block
 block discarded – undo
79 79
 
80 80
         //设置参数列表
81 81
         $paramsMeta = [];
82
-        foreach ($methodParams as $param){
82
+        foreach ($methodParams as $param) {
83 83
             $paramName = $param->getName();
84 84
             $source = "request.$paramName";
85
-            if($route->hasPathParam($paramName)){ //参数来自路由
85
+            if ($route->hasPathParam($paramName)) { //参数来自路由
86 86
                 $source = "request.$paramName";
87
-            }elseif($httpMethod == 'GET'){
87
+            }elseif ($httpMethod == 'GET') {
88 88
                 $source = "request.$paramName"; //GET请求显示指定来自query string
89 89
             }
90 90
             $paramClass = $param->getClass();
91
-            if($paramClass){
91
+            if ($paramClass) {
92 92
                 $paramClass = $paramClass->getName();
93 93
             }
94 94
             $entityContainer = ContainerFactory::create($entityBuilder, $paramClass);
95 95
             $meta = new ParamMeta($paramName,
96 96
                 $source,
97
-                $paramClass?:'mixed',
97
+                $paramClass ?: 'mixed',
98 98
                 $param->isOptional(),
99
-                $param->isOptional()?$param->getDefaultValue():null,
99
+                $param->isOptional() ? $param->getDefaultValue() : null,
100 100
                 $param->isPassedByReference(),
101 101
                 null,
102 102
                 '',
103 103
                 $entityContainer
104 104
             );
105 105
             $paramsMeta[] = $meta;
106
-            if($meta->isPassedByReference){
106
+            if ($meta->isPassedByReference) {
107 107
                 $responseHandler->setMapping('response.content.'.$meta->name, new ReturnMeta(
108 108
                     'params.'.$meta->name,
109 109
                     $meta->type, $meta->description,
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         }
114 114
 
115 115
         $requestHandler->setParamMetas($paramsMeta);
116
-        $responseHandler->setMapping('response.content', new ReturnMeta('return','mixed','', new MixedTypeContainer()));
116
+        $responseHandler->setMapping('response.content', new ReturnMeta('return', 'mixed', '', new MixedTypeContainer()));
117 117
 
118 118
         $container->addRoute($target, $route);
119 119
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
             $source = "request.$paramName";
85 85
             if($route->hasPathParam($paramName)){ //参数来自路由
86 86
                 $source = "request.$paramName";
87
-            }elseif($httpMethod == 'GET'){
87
+            } elseif($httpMethod == 'GET'){
88 88
                 $source = "request.$paramName"; //GET请求显示指定来自query string
89 89
             }
90 90
             $paramClass = $param->getClass();
Please login to merge, or discard this patch.
src/Controller/Annotations/BindAnnotationHandler.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,15 +21,15 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public function __invoke(ControllerContainer $container, $ann, EntityContainerBuilder $entityBuilder)
23 23
     {
24
-        if(!$ann->parent || !$ann->parent->parent){
24
+        if (!$ann->parent || !$ann->parent->parent) {
25 25
             Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()} should be used with parent param/return");
26 26
             return;
27 27
         }
28 28
         $target = $ann->parent->parent->name;
29 29
         $route = $container->getRoute($target);
30
-        if(!$route){
30
+        if (!$route) {
31 31
             Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()}::$target should be used with parent param/return");
32
-            return ;
32
+            return;
33 33
         }
34 34
 
35 35
         $params = new AnnotationParams($ann->description, 2);
@@ -38,17 +38,17 @@  discard block
 block discarded – undo
38 38
 
39 39
         $handler = $route->getResponseHandler();
40 40
 
41
-        if ($ann->parent->name == 'return'){
41
+        if ($ann->parent->name == 'return') {
42 42
             $return = $handler->eraseMapping('response.content');
43
-            if($return){
43
+            if ($return) {
44 44
                 $handler->setMapping($params[0], $return);
45 45
             }
46 46
 
47
-        }elseif($ann->parent->name == 'param'){
47
+        }elseif ($ann->parent->name == 'param') {
48 48
             list($paramType, $paramName, $paramDoc) = ParamAnnotationHandler::getParamInfo($ann->parent->description);
49 49
 
50 50
             $paramMeta = $route->getRequestHandler()->getParamMeta($paramName);
51
-            if($paramMeta->isPassedByReference){
51
+            if ($paramMeta->isPassedByReference) {
52 52
                 $handler->eraseMapping('response.content.'.$paramName);
53 53
                 //输出绑定
54 54
                 $handler->setMapping(
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                         ContainerFactory::create($entityBuilder, $paramMeta->type)
60 60
                     )
61 61
                 );
62
-            }else{
62
+            }else {
63 63
                 $paramMeta->source = $params[0];
64 64
             }
65 65
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
                 $handler->setMapping($params[0], $return);
45 45
             }
46 46
 
47
-        }elseif($ann->parent->name == 'param'){
47
+        } elseif($ann->parent->name == 'param'){
48 48
             list($paramType, $paramName, $paramDoc) = ParamAnnotationHandler::getParamInfo($ann->parent->description);
49 49
 
50 50
             $paramMeta = $route->getRequestHandler()->getParamMeta($paramName);
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                         ContainerFactory::create($entityBuilder, $paramMeta->type)
60 60
                     )
61 61
                 );
62
-            }else{
62
+            } else{
63 63
                 $paramMeta->source = $params[0];
64 64
             }
65 65
         }
Please login to merge, or discard this patch.
src/Controller/Annotations/ThrowsAnnotationHandler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,15 +19,15 @@
 block discarded – undo
19 19
      */
20 20
     public function __invoke(ControllerContainer $container, $ann)
21 21
     {
22
-        if(!$ann->parent){
22
+        if (!$ann->parent) {
23 23
             //Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()} should be used with parent route");
24 24
             return;
25 25
         }
26 26
         $target = $ann->parent->name;
27 27
         $route = $container->getRoute($target);
28
-        if(!$route){
28
+        if (!$route) {
29 29
             //Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()}::$target should be used with parent route");
30
-            return ;
30
+            return;
31 31
         }
32 32
         $params = new AnnotationParams($ann->description, 2);
33 33
         count($params)>0 or \PhpBoot\abort(new AnnotationSyntaxException("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()}::$target require at least one param, {$params->count()} given"));
Please login to merge, or discard this patch.