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.
Completed
Push — master ( 725689...432516 )
by cao
03:37
created
src/Application.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
 
84 84
             Request::class => \DI\factory([Application::class, 'createRequestFromGlobals']),
85 85
         ];
86
-        if(function_exists('apc_fetch')){
86
+        if (function_exists('apc_fetch')) {
87 87
             $default += [
88 88
                 Cache::class => \DI\object(ApcCache::class)
89 89
             ];
90
-        }else{
90
+        }else {
91 91
             $default += [
92 92
                 Cache::class => \DI\object(FilesystemCache::class)
93 93
                     ->constructorParameter('directory', sys_get_temp_dir())
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
      * @param string[] $hooks hook class names
130 130
      * @return void
131 131
      */
132
-    public function loadRoutesFromClass($className, $hooks=[])
132
+    public function loadRoutesFromClass($className, $hooks = [])
133 133
     {
134 134
         $cache = new CheckableCache($this->cache);
135 135
 
136
-        $key = 'loadRoutesFromClass:' . md5(__CLASS__ . ':' . $className);
136
+        $key = 'loadRoutesFromClass:'.md5(__CLASS__.':'.$className);
137 137
         $routes = $cache->get($key, $this);
138 138
 
139 139
         $controller = null;
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
             $this->routes[] = [
151 151
                 $method,
152 152
                 $uri,
153
-                function (Application $app, Request $request) use ($cache, $className, $actionName, $controller) {
153
+                function(Application $app, Request $request) use ($cache, $className, $actionName, $controller) {
154 154
 
155
-                    $key = 'loadRoutesFromClass:route:' . md5(__CLASS__ . ':' . $className . ':' . $actionName);
155
+                    $key = 'loadRoutesFromClass:route:'.md5(__CLASS__.':'.$className.':'.$actionName);
156 156
 
157 157
                     $routeInstance = $cache->get($key, $this);
158 158
                     if ($routeInstance == $this) {
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
      * @param string[] $hooks
181 181
      * @return void
182 182
      */
183
-    public function loadRoutesFromPath($fromPath, $namespace = '', $hooks=[])
183
+    public function loadRoutesFromPath($fromPath, $namespace = '', $hooks = [])
184 184
     {
185 185
         $dir = @dir($fromPath);
186 186
 
187
-        $getEach = function () use ($dir) {
187
+        $getEach = function() use ($dir) {
188 188
             $name = $dir->read();
189 189
             if (!$name) {
190 190
                 return $name;
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
             if ($entry == '.' || $entry == '..') {
197 197
                 continue;
198 198
             }
199
-            $path = $fromPath . '/' . str_replace('\\', '/', $entry);
199
+            $path = $fromPath.'/'.str_replace('\\', '/', $entry);
200 200
             if (is_file($path) && substr_compare($entry, '.php', strlen($entry) - 4, 4, true) == 0) {
201
-                $class_name = $namespace . '\\' . substr($entry, 0, strlen($entry) - 4);
201
+                $class_name = $namespace.'\\'.substr($entry, 0, strlen($entry) - 4);
202 202
                 $this->loadRoutesFromClass($class_name, $hooks);
203
-            } else {
203
+            }else {
204 204
                 //\Log::debug($path.' ignored');
205 205
             }
206 206
         }
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
      * @param callable $handler function(Application $app, Request $request):Response
214 214
      * @param string[] $hooks
215 215
      */
216
-    public function addRoute($method, $uri, callable $handler, $hooks=[])
216
+    public function addRoute($method, $uri, callable $handler, $hooks = [])
217 217
     {
218 218
         $this->routes[] = [$method, $uri, $handler, $hooks];
219 219
     }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
     {
240 240
         //  TODO 把 Route里的异常处理 ExceptionRenderer 移到这里更妥?
241 241
         $renderer = $this->get(ExceptionRenderer::class);
242
-        try{
242
+        try {
243 243
             if ($request == null) {
244 244
                 $request = $this->make(Request::class);
245 245
             }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
             }
250 250
             $uri = rawurldecode($uri);
251 251
 
252
-            $next = function (Request $request)use($uri){
252
+            $next = function(Request $request)use($uri){
253 253
                 $dispatcher = $this->getDispatcher();
254 254
                 $res = $dispatcher->dispatch($request->getMethod(), $uri);
255 255
                 if ($res[0] == Dispatcher::FOUND) {
@@ -258,10 +258,10 @@  discard block
 block discarded – undo
258 258
                         $request->attributes->add($res[2]);
259 259
                     }
260 260
                     list($handler, $hooks) = $res[1];
261
-                    $next = function (Request $request)use($handler){
261
+                    $next = function(Request $request)use($handler){
262 262
                         return $handler($this, $request);
263 263
                     };
264
-                    foreach (array_reverse($hooks) as $hookName){
264
+                    foreach (array_reverse($hooks) as $hookName) {
265 265
                         $next = function($request)use($hookName, $next){
266 266
                             $hook = $this->get($hookName);
267 267
                             /**@var $hook HookInterface*/
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
                     \PhpBoot\abort(new NotFoundHttpException(), [$request->getMethod(), $uri]);
275 275
                 } elseif ($res[0] == Dispatcher::METHOD_NOT_ALLOWED) {
276 276
                     \PhpBoot\abort(new MethodNotAllowedHttpException($res[1]), [$request->getMethod(), $uri]);
277
-                } else {
277
+                }else {
278 278
                     \PhpBoot\abort("unknown dispatch return {$res[0]}");
279 279
                 }
280 280
             };
281 281
 
282
-            foreach (array_reverse($this->getGlobalHooks()) as $hookName){
282
+            foreach (array_reverse($this->getGlobalHooks()) as $hookName) {
283 283
                 $next = function($request)use($hookName, $next){
284 284
                     $hook = $this->get($hookName);
285 285
                     /**@var $hook HookInterface*/
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
             }
295 295
             return $response;
296 296
 
297
-        }catch (\Exception $e){
297
+        }catch (\Exception $e) {
298 298
             $renderer->render($e);
299 299
         }
300 300
 
Please login to merge, or discard this patch.
src/DB/Context.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 /**
4 4
  * @author caoym
5 5
  */
6
-class Context{
6
+class Context {
7 7
 
8 8
     public function __construct($connection)
9 9
     {
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
      * 拼接sql语句,并自动插入空格
15 15
      * @param string $sql 表达式
16 16
      */
17
-    public function appendSql($sql, $addSpace=true){
18
-        if($this->sql == ''){
17
+    public function appendSql($sql, $addSpace = true) {
18
+        if ($this->sql == '') {
19 19
             $this->sql = $sql;
20
-        }else{
21
-            if($addSpace){
20
+        }else {
21
+            if ($addSpace) {
22 22
                 $this->sql = $this->sql.' '.$sql;
23
-            }else{
23
+            }else {
24 24
                 $this->sql = $this->sql.$sql;
25 25
             }
26 26
         }
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
      * 增加绑定变量值
30 30
      * @param array $params 变量
31 31
      */
32
-    public function appendParams($params){
32
+    public function appendParams($params) {
33 33
         $this->params = array_merge($this->params, $params);
34 34
     }
35 35
 
36 36
     public function handleResult($result)
37 37
     {
38
-        if($resultHandler = $this->resultHandler){
38
+        if ($resultHandler = $this->resultHandler) {
39 39
             return $resultHandler($result);
40
-        }else{
40
+        }else {
41 41
             return $result;
42 42
         }
43 43
     }
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
      * @var callable
46 46
      */
47 47
     public $resultHandler;
48
-    public $sql='';
49
-    public $params=[];
48
+    public $sql = '';
49
+    public $params = [];
50 50
     /**
51 51
      * @var \PDO
52 52
      */
Please login to merge, or discard this patch.
src/DB/NestedStringCut.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -7,26 +7,26 @@  discard block
 block discarded – undo
7 7
  * 既从aaa"bb\"b"ccc中, 取出"bb\"b"
8 8
  * @author caoym
9 9
  */
10
-class NestedStringCut{
10
+class NestedStringCut {
11 11
     
12
-    public function __construct($str){
12
+    public function __construct($str) {
13 13
         
14 14
         $pos = 0;
15 15
         $state = 'stateNormal';
16
-        while (true){
16
+        while (true) {
17 17
             $pos = $this->$state($str, $pos, $state);
18
-            if($pos === false){
18
+            if ($pos === false) {
19 19
                 break;
20 20
             }
21 21
         };
22 22
         return false;
23 23
     }
24 24
     
25
-    public function  getSnippets(){
25
+    public function  getSnippets() {
26 26
         return $this->snippets;
27 27
     }
28 28
     
29
-    public function  getText(){
29
+    public function  getText() {
30 30
         return  implode('', $this->snippets);
31 31
     }
32 32
     /**
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
      * @param int $pos 
35 35
      * @param int
36 36
      */
37
-    public function mapPos($pos){
37
+    public function mapPos($pos) {
38 38
        
39
-        foreach ($this->snippets as $k => $v){
39
+        foreach ($this->snippets as $k => $v) {
40 40
             $pos += $k;
41
-            if($pos < $k + strlen($v)){
41
+            if ($pos<$k + strlen($v)) {
42 42
                 break;
43 43
             }
44 44
             $pos -= ($k + strlen($v));
@@ -49,21 +49,21 @@  discard block
 block discarded – undo
49 49
     /**
50 50
      * 普通状态
51 51
      */
52
-    private function stateNormal($str, $pos, &$next){
52
+    private function stateNormal($str, $pos, &$next) {
53 53
         $ori = $pos;
54 54
         $posSQ = strpos($str, '\'', $pos);
55 55
         $posDQ = strpos($str, '"', $pos);
56 56
         $pos = $posSQ;
57 57
         $this->subStateQ = '\'';
58 58
         $next = 'stateQ';
59
-        if($posDQ !== false && (($posDQ < $pos) || ($pos === false)) ){
59
+        if ($posDQ !== false && (($posDQ<$pos) || ($pos === false))) {
60 60
             $pos = $posDQ;
61 61
             $this->subStateQ = '"';
62 62
         }
63
-        if($pos !== false){
64
-            $this->snippets[$ori] = substr($str, $ori, $pos-$ori);
65
-            $pos ++;
66
-        }else{
63
+        if ($pos !== false) {
64
+            $this->snippets[$ori] = substr($str, $ori, $pos - $ori);
65
+            $pos++;
66
+        }else {
67 67
             $this->snippets[$ori] = substr($str, $ori);
68 68
         }
69 69
         return $pos;
@@ -72,27 +72,27 @@  discard block
 block discarded – undo
72 72
     /**
73 73
      * 进入引号状态
74 74
      */
75
-    private function stateQ($str, $pos, &$next){
75
+    private function stateQ($str, $pos, &$next) {
76 76
         $posESC = strpos($str, '\\', $pos);
77 77
         $posQ = strpos($str, $this->subStateQ, $pos);
78 78
         $pos = $posESC;
79 79
         $next = 'stateESC';
80 80
         
81
-        if($posQ !== false && (($posQ<$posESC) || ($posESC === false))){
81
+        if ($posQ !== false && (($posQ<$posESC) || ($posESC === false))) {
82 82
             $pos = $posQ;
83 83
             $next = 'stateNormal';
84 84
         }
85
-        if($pos !== false){
86
-            $pos ++;
85
+        if ($pos !== false) {
86
+            $pos++;
87 87
         }
88 88
         return $pos;
89 89
     }
90 90
     /**
91 91
      * 进入转义状态
92 92
      */
93
-    private function stateESC($str, $pos, &$next){
93
+    private function stateESC($str, $pos, &$next) {
94 94
         $pos++;
95
-        if($pos >= strlen($str)){
95
+        if ($pos>=strlen($str)) {
96 96
             return false;
97 97
         }
98 98
         $next = 'stateQ';
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      * 去掉嵌套字符串后的内容
103 103
      * @var array
104 104
      */
105
-    private $snippets=array();
105
+    private $snippets = array();
106 106
     
107 107
     private $subStateQ;
108 108
 }
Please login to merge, or discard this patch.
src/DB/Rows.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,30 +2,30 @@
 block discarded – undo
2 2
 
3 3
 namespace PhpBoot\DB;
4 4
 
5
-if(!function_exists("array_column"))
5
+if (!function_exists("array_column"))
6 6
 {
7 7
 
8 8
     function array_column($array, $column_name)
9 9
     {
10 10
 
11
-        return array_map(function($element) use($column_name){return $element[$column_name];}, $array);
11
+        return array_map(function($element) use($column_name){return $element[$column_name]; }, $array);
12 12
 
13 13
     }
14 14
 
15 15
 }
16 16
 class Rows
17 17
 {
18
-    static function column($array,$column_name)
18
+    static function column($array, $column_name)
19 19
     {
20 20
 
21
-        return array_map(function($element) use($column_name){return $element[$column_name];}, $array);
21
+        return array_map(function($element) use($column_name){return $element[$column_name]; }, $array);
22 22
 
23 23
     }
24
-    static public function leftJoin(&$lh, $rh, $lKey, $rkey, $destKey){
25
-        $map = array_combine(self::column($rh,$rkey),$rh);
24
+    static public function leftJoin(&$lh, $rh, $lKey, $rkey, $destKey) {
25
+        $map = array_combine(self::column($rh, $rkey), $rh);
26 26
 
27
-        foreach ($lh as &$v){
28
-            $v[$destKey]=$map[$v[$lKey]];
27
+        foreach ($lh as &$v) {
28
+            $v[$destKey] = $map[$v[$lKey]];
29 29
         }
30 30
     }
31 31
 }
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
src/DB/Raw.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@
 block discarded – undo
13 13
     function __construct($str) {
14 14
         $this->str = $str;
15 15
     }
16
-    public function __toString(){
16
+    public function __toString() {
17 17
         return $this->str;
18 18
     }
19
-    public function get(){
19
+    public function get() {
20 20
         return $this->str;
21 21
     }
22 22
     private $str;
Please login to merge, or discard this patch.
src/DB/rules/basic.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 class BasicRule
13 13
 {
14
-    public function __construct(Context $context){
14
+    public function __construct(Context $context) {
15 15
         $this->context = $context;
16 16
     }
17 17
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 class OrderByRule extends LimitRule
50 50
 {
51
-    public function __construct($context){
51
+    public function __construct($context) {
52 52
         parent::__construct($context);
53 53
         $this->impl = new OrderByImpl();
54 54
     }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      * 
73 73
      * @return \PhpBoot\DB\rules\basic\LimitRule
74 74
      */
75
-    public function orderBy($column, $order=null) {
75
+    public function orderBy($column, $order = null) {
76 76
         $this->impl->orderBy($this->context, $column, $order);
77 77
         return new LimitRule($this->context);
78 78
     }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      * @param mixed $_
92 92
      * @return \PhpBoot\DB\rules\basic\OrderByRule
93 93
      */
94
-    public function where($expr, $_= null) {
94
+    public function where($expr, $_ = null) {
95 95
         WhereImpl::where($this->context, $expr, array_slice(func_get_args(), 1));
96 96
         return new OrderByRule($this->context);
97 97
     }
Please login to merge, or discard this patch.
src/RPC/MultiRequestCore.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
13 13
      */
14 14
     public function __construct(array $threads, callable $waitAll)
15 15
     {
16
-        foreach ($threads as $thread){
16
+        foreach ($threads as $thread) {
17 17
             $pos = count($this->threadResults);
18
-            $this->threadResults[] = [null,null];
19
-            $this->threads[] = function ()use($thread, $pos){
20
-                try{
18
+            $this->threadResults[] = [null, null];
19
+            $this->threads[] = function()use($thread, $pos){
20
+                try {
21 21
                     $this->threadResults[$pos][0] = $thread();
22
-                }catch (\Exception $e){
22
+                }catch (\Exception $e) {
23 23
                     $this->threadResults[$pos][1] = $e;
24 24
                 }
25 25
             };
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
     public function run()
31 31
     {
32
-        while ($thread = array_pop($this->threads)){
32
+        while ($thread = array_pop($this->threads)) {
33 33
             $thread();
34 34
         };
35 35
     }
@@ -42,20 +42,20 @@  discard block
 block discarded – undo
42 42
         return $this->threadResults;
43 43
     }
44 44
 
45
-    public function wait($waitAble){
45
+    public function wait($waitAble) {
46 46
         array_push($this->waits, $waitAble);
47 47
         $this->run();
48 48
 
49
-        if(count($this->waits)){
49
+        if (count($this->waits)) {
50 50
             $waitAll = $this->waitAll;
51 51
             $this->waitResults = $waitAll($this->waits);
52 52
             $this->waits = [];
53 53
         }
54 54
 
55
-        $res =  array_pop($this->waitResults);
56
-        if(isset($res[1])){
55
+        $res = array_pop($this->waitResults);
56
+        if (isset($res[1])) {
57 57
              \PhpBoot\abort(new RpcException($res['reason']));
58
-        }else{
58
+        }else {
59 59
             return $res[0];
60 60
         }
61 61
     }
Please login to merge, or discard this patch.
src/RPC/MultiRequest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
         return $request->getResults();
21 21
     }
22 22
 
23
-    public static function isRunning(){
23
+    public static function isRunning() {
24 24
         return !!self::$currentContext;
25 25
     }
26 26
 
Please login to merge, or discard this patch.
src/RPC/RpcProxy.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
                                 ControllerContainerBuilder $builder,
34 34
                                 Client $http,
35 35
                                 $interface,
36
-                                $prefix='/')
36
+                                $prefix = '/')
37 37
     {
38 38
         $this->container = $builder->build($interface);
39 39
         $this->http = $http;
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 
49 49
         $request = $this->createRequest($method, $route, $args);
50 50
 
51
-        if(MultiRpc::isRunning()){
51
+        if (MultiRpc::isRunning()) {
52 52
             $op = $this->http->sendAsync($request);
53 53
             $res = MultiRpc::wait($op);
54 54
             return $this->mapResponse($method, $route, $res, $args);
55
-        }else{
55
+        }else {
56 56
             $res = $this->http->send($request);
57 57
             return $this->mapResponse($method, $route, $res, $args);
58 58
         }
@@ -69,25 +69,25 @@  discard block
 block discarded – undo
69 69
         $params = $route->getRequestHandler()->getParamMetas();
70 70
         //TODO 支持 query、content、path以外的其他参数, 如cookie,path等
71 71
         $request = [];
72
-        foreach ($params as $pos=>$param){
73
-            if(!array_key_exists($pos, $args) && $param->isOptional){
72
+        foreach ($params as $pos=>$param) {
73
+            if (!array_key_exists($pos, $args) && $param->isOptional) {
74 74
                 $args[$pos] = $param->default;
75 75
             }
76 76
             array_key_exists($pos, $args) or \PhpBoot\abort(
77 77
                 $this->container->getClassName()." $actionName missing param {$param->name}");
78 78
 
79
-            if(!$param->isPassedByReference){
79
+            if (!$param->isPassedByReference) {
80 80
                 ArrayHelper::set($request, $param->source, $args[$pos]);
81 81
             }
82 82
         }
83 83
 
84
-        if(isset($request['request'])){
84
+        if (isset($request['request'])) {
85 85
             $request = $request['request'];
86 86
         }
87 87
         $uri = $route->getUri();
88
-        foreach($route->getPathParams() as $path){
89
-            if(isset($request[$path])){
90
-                $uri = str_replace('{'.$path.'}', urlencode($request[$path]) , $uri);
88
+        foreach ($route->getPathParams() as $path) {
89
+            if (isset($request[$path])) {
90
+                $uri = str_replace('{'.$path.'}', urlencode($request[$path]), $uri);
91 91
                 unset($request[$path]);
92 92
             }
93 93
         }
@@ -97,53 +97,53 @@  discard block
 block discarded – undo
97 97
         $body = null;
98 98
         $headers = [];
99 99
 
100
-        if(isset($request['query'])){
100
+        if (isset($request['query'])) {
101 101
             $query += $request['query'];
102 102
         }
103 103
         unset($request['query']);
104 104
 
105
-        if(isset($request['headers'])){
105
+        if (isset($request['headers'])) {
106 106
             $headers += $request['headers'];
107 107
         }
108 108
         unset($request['headers']);
109 109
 
110
-        if(isset($request['cookies'])){
110
+        if (isset($request['cookies'])) {
111 111
             $cookies = [];
112
-            foreach ($request['cookies'] as $k=>$v){
112
+            foreach ($request['cookies'] as $k=>$v) {
113 113
                 $cookies[] = "$k=$v";
114 114
             }
115 115
             $headers['Cookie'] = implode('; ', $cookies);
116 116
         }
117 117
         unset($request['cookies']);
118 118
 
119
-        if(isset($request['request'])){
120
-            if($body === null){
119
+        if (isset($request['request'])) {
120
+            if ($body === null) {
121 121
                 $body = [];
122 122
             }
123 123
             $body += $request['request'];
124 124
         }
125 125
         unset($request['request']);
126 126
 
127
-        if(isset($request['files'])){
127
+        if (isset($request['files'])) {
128 128
             \PhpBoot\abort(new \UnexpectedValueException("sending request with files is not support"));
129 129
         }
130
-        if(in_array($httpMethod, ['GET', 'OPTION'])){
131
-            foreach ($request as $k => $v){
132
-                if(!in_array($k, ['query', 'request', 'files', 'cookies', 'headers'])){
130
+        if (in_array($httpMethod, ['GET', 'OPTION'])) {
131
+            foreach ($request as $k => $v) {
132
+                if (!in_array($k, ['query', 'request', 'files', 'cookies', 'headers'])) {
133 133
                     $query[$k] = $v;
134 134
                 }
135 135
             }
136
-        }else{
137
-            foreach ($request as $k => $v){
138
-                if(!in_array($k, ['query', 'request', 'files', 'cookies', 'headers'])){
139
-                    if($body === null){
136
+        }else {
137
+            foreach ($request as $k => $v) {
138
+                if (!in_array($k, ['query', 'request', 'files', 'cookies', 'headers'])) {
139
+                    if ($body === null) {
140 140
                         $body = [];
141 141
                     }
142 142
                     $body[$k] = $v;
143 143
                 }
144 144
             }
145 145
         }
146
-        if($body !== null){
146
+        if ($body !== null) {
147 147
             $body = json_encode($body, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
148 148
         }
149 149
         $uri = $this->uriPrefix.ltrim($uri, '/').'?'.http_build_query($query);
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     }
157 157
 
158 158
 
159
-    public function mapResponse($actionName, Route $route, ResponseInterface $response, $requestArg=[])
159
+    public function mapResponse($actionName, Route $route, ResponseInterface $response, $requestArg = [])
160 160
     {
161 161
         $response = \Symfony\Component\HttpFoundation\Response::create(
162 162
             (string)$response->getBody(),
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
             );
166 166
         $namedArgs = [];
167 167
 
168
-        foreach ($route->getRequestHandler()->getParamMetas() as $pos=>$param){
168
+        foreach ($route->getRequestHandler()->getParamMetas() as $pos=>$param) {
169 169
 
170
-            if($param->isPassedByReference){
170
+            if ($param->isPassedByReference) {
171 171
                 $namedArgs[$param->name] = &$requestArg[$pos];
172 172
             }
173 173
         }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         //TODO 远端接口没有抛出异常,但设置了 status( status 不是200)时如何处理
179 179
         $handler = $route->getResponseHandler();
180 180
 
181
-        if($response->getStatusCode() >= 200 && $response->getStatusCode() <300){
181
+        if ($response->getStatusCode()>=200 && $response->getStatusCode()<300) {
182 182
 
183 183
 
184 184
             $returns = $handler->getMappings();
@@ -195,30 +195,30 @@  discard block
 block discarded – undo
195 195
                 'params'=>$namedArgs
196 196
             ];
197 197
 
198
-            foreach ($returns as $map=>$return){
198
+            foreach ($returns as $map=>$return) {
199 199
 
200 200
                 $data = \JmesPath\search($map, $buffer);
201
-                if(!$return->container){
201
+                if (!$return->container) {
202 202
                     continue;
203 203
                 }
204 204
                 $data = $return->container->make($data, false);
205 205
                 ArrayHelper::set($mapping, $return->source, $data);
206 206
             }
207 207
 
208
-        }else{
208
+        }else {
209 209
 
210 210
             //TODO 如果多个 异常对应同一个 statusCode 怎么处理
211 211
             $exceptions = $route->getExceptionHandler()->getExceptions();
212 212
 
213 213
             $errName = null;
214
-            foreach ($exceptions as $err){
214
+            foreach ($exceptions as $err) {
215 215
 
216 216
                 $renderer = $this->app->get(ExceptionRenderer::class);
217 217
                 $exec = $renderer->render(
218 218
                     $this->app->make($err, ['message'=>(string)$response->getContent()])
219 219
                 );
220 220
 
221
-                if( $exec->getStatusCode() == $response->getStatusCode()){
221
+                if ($exec->getStatusCode() == $response->getStatusCode()) {
222 222
                     throw $exec;
223 223
                 }
224 224
             }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 
227 227
         };
228 228
 
229
-        if(isset($mapping['return'])){
229
+        if (isset($mapping['return'])) {
230 230
             return $mapping['return'];
231 231
         };
232 232
     }
Please login to merge, or discard this patch.