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 ( e28ef8...589b37 )
by cao
03:51
created
src/functions.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 use PhpBoot\ORM\ModelWithObject;
6 6
 use PhpBoot\Utils\Logger;
7 7
 
8
-if (! function_exists('PhpBoot\abort')) {
8
+if (!function_exists('PhpBoot\abort')) {
9 9
     /**
10 10
      * 抛出异常, 并记录日志
11 11
      * @param string|\Exception $error
@@ -13,29 +13,29 @@  discard block
 block discarded – undo
13 13
      * @param string $level "error"|"warning"|"info"|"debug"|null
14 14
      * @throws \Exception
15 15
      */
16
-    function abort($error = '', $context=[], $level='warning')
16
+    function abort($error = '', $context = [], $level = 'warning')
17 17
     {
18
-        if(is_object($context)){
18
+        if (is_object($context)) {
19 19
             $context = get_object_vars($context);
20 20
         }
21
-        if($error instanceof \Exception){
21
+        if ($error instanceof \Exception) {
22 22
             $e = $error;
23 23
             $message = "exception '".get_class($error)."' with message {$error->getMessage()}";
24
-        }else{
24
+        }else {
25 25
             $e = new \RuntimeException($error);
26 26
             $message = $error;
27 27
         }
28 28
         $trace = $e->getTrace();
29 29
 
30
-        if($e->getFile() == __FILE__){
30
+        if ($e->getFile() == __FILE__) {
31 31
             $file = $trace[0]['file'];
32 32
             $line = $trace[0]['line'];
33
-        }else{
33
+        }else {
34 34
             $file = $e->getFile();
35 35
             $line = $e->getLine();
36 36
         }
37
-        if($level){
38
-           Logger::$level($message, $context +['@file'=>$file, '@line'=>$line]);
37
+        if ($level) {
38
+           Logger::$level($message, $context + ['@file'=>$file, '@line'=>$line]);
39 39
         }
40 40
         throw $e;
41 41
     }
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
      */
62 62
     function models(DB $db, $entity)
63 63
     {
64
-        if(is_object($entity)){
64
+        if (is_object($entity)) {
65 65
             return $db->getApp()->make(ModelWithObject::class, ['db'=>$db, 'entity'=>$entity]);
66
-        }else{
66
+        }else {
67 67
             return $db->getApp()->make(ModelWithClass::class, ['db'=>$db, 'entityName'=>$entity]);
68 68
         }
69 69
     }
Please login to merge, or discard this patch.
src/ORM/ModelWithObject.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
     public function create()
29 29
     {
30 30
         $data = [];
31
-        foreach ($this->getColumns() as $column){
32
-            if(isset($this->object->$column)){
33
-                if(is_array($this->object->$column) || is_object($this->object->$column)){
31
+        foreach ($this->getColumns() as $column) {
32
+            if (isset($this->object->$column)) {
33
+                if (is_array($this->object->$column) || is_object($this->object->$column)) {
34 34
                     $data[$column] = json_encode($this->object->$column);
35
-                }else{
35
+                }else {
36 36
                     $data[$column] = $this->object->$column;
37 37
                 }
38 38
 
@@ -48,18 +48,18 @@  discard block
 block discarded – undo
48 48
      * @param array $columns columns to update. if columns is empty array, update all of the columns
49 49
      * @return int rows updated
50 50
      */
51
-    public function update(array $columns=[])
51
+    public function update(array $columns = [])
52 52
     {
53 53
         $data = [];
54 54
         $pk = $this->entity->getPK();
55
-        foreach ($this->getColumns() as $column){
56
-            if(count($columns) && !in_array($column, $columns)){
55
+        foreach ($this->getColumns() as $column) {
56
+            if (count($columns) && !in_array($column, $columns)) {
57 57
                 continue;
58 58
             }
59
-            if($pk != $column && isset($this->object->$column)){
60
-                if(is_array($this->object->$column) || is_object($this->object->$column)){
59
+            if ($pk != $column && isset($this->object->$column)) {
60
+                if (is_array($this->object->$column) || is_object($this->object->$column)) {
61 61
                     $data[$column] = json_encode($this->object->$column);
62
-                }else{
62
+                }else {
63 63
                     $data[$column] = $this->object->$column;
64 64
                 }
65 65
             }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     protected function getColumns()
86 86
     {
87 87
         $columns = [];
88
-        foreach ($this->entity->getProperties() as $p){
88
+        foreach ($this->entity->getProperties() as $p) {
89 89
             $columns[] = $p->name;
90 90
         }
91 91
         return $columns;
Please login to merge, or discard this patch.
src/Controller/ResponseHandler.php 1 patch
Spacing   +8 added lines, -8 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];
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function getMappingBySource($source)
55 55
     {
56
-        foreach ($this->mappings as $k=>$v){
57
-            if($v->source == $source){
56
+        foreach ($this->mappings as $k=>$v) {
57
+            if ($v->source == $source) {
58 58
                 return [$k, $v];
59 59
             }
60 60
         }
61
-        return [null,null];
61
+        return [null, null];
62 62
     }
63 63
 
64 64
 
@@ -75,15 +75,15 @@  discard block
 block discarded – undo
75 75
             'params'=>$params
76 76
         ];
77 77
 
78
-        if($return instanceof Response){ //直接返回Response时, 对return不再做映射
78
+        if ($return instanceof Response) { //直接返回Response时, 对return不再做映射
79 79
             return $return;
80 80
         }
81 81
         $mappings = $this->getMappings();
82 82
 
83 83
         $output = [];
84
-        foreach($mappings as $key=>$map){
84
+        foreach ($mappings as $key=>$map) {
85 85
             $val = \JmesPath\search($map->source, $input);
86
-            if(substr($key, 0, strlen('response.')) == 'response.'){
86
+            if (substr($key, 0, strlen('response.')) == 'response.') {
87 87
                 $key = substr($key, strlen('response.'));
88 88
             }
89 89
             ArrayHelper::set($output, $key, $val);
Please login to merge, or discard this patch.
src/Controller/Annotations/BindAnnotationHandler.php 1 patch
Spacing   +9 added lines, -9 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,20 +38,20 @@  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
             list($target, $return) = $handler->getMappingBySource('return');
43
-            if($return){
43
+            if ($return) {
44 44
                 $handler->eraseMapping($target);
45 45
                 $handler->setMapping($params[0], $return);
46 46
             }
47 47
 
48
-        }elseif($ann->parent->name == 'param'){
48
+        }elseif ($ann->parent->name == 'param') {
49 49
             list($paramType, $paramName, $paramDoc) = ParamAnnotationHandler::getParamInfo($ann->parent->description);
50 50
 
51 51
             $paramMeta = $route->getRequestHandler()->getParamMeta($paramName);
52
-            if($paramMeta->isPassedByReference){
52
+            if ($paramMeta->isPassedByReference) {
53 53
                 list($target, $ori) = $handler->getMappingBySource('params.'.$paramName);
54
-                if($ori){
54
+                if ($ori) {
55 55
                     $handler->eraseMapping($target);
56 56
                 }
57 57
                 //输出绑定
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
                         ContainerFactory::create($entityBuilder, $paramMeta->type)
64 64
                     )
65 65
                 );
66
-            }else{
66
+            }else {
67 67
                 $paramMeta->source = $params[0];
68 68
             }
69 69
         }
Please login to merge, or discard this patch.
src/Controller/Annotations/RouteAnnotationHandler.php 1 patch
Spacing   +16 added lines, -16 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
         $hasRefParam = false;
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
                 $hasRefParam = true;
108 108
                 $responseHandler->setMapping('response.content.'.$meta->name, new ReturnMeta(
109 109
                     'params.'.$meta->name,
@@ -114,16 +114,16 @@  discard block
 block discarded – undo
114 114
         }
115 115
 
116 116
         $requestHandler->setParamMetas($paramsMeta);
117
-        if(!$hasRefParam){
118
-            $responseHandler->setMapping('response.content', new ReturnMeta('return','mixed','', new MixedTypeContainer()));
119
-        }else{
117
+        if (!$hasRefParam) {
118
+            $responseHandler->setMapping('response.content', new ReturnMeta('return', 'mixed', '', new MixedTypeContainer()));
119
+        }else {
120 120
             //当存在引用参数作为输出时, 默认将 return 数据绑定的到 data 下, 以防止和引用参数作为输出重叠
121
-            $responseHandler->setMapping($this->returnTarget, new ReturnMeta('return','mixed','', new MixedTypeContainer()));
121
+            $responseHandler->setMapping($this->returnTarget, new ReturnMeta('return', 'mixed', '', new MixedTypeContainer()));
122 122
         }
123 123
 
124 124
 
125 125
         $container->addRoute($target, $route);
126 126
     }
127 127
 
128
-    public $returnTarget='response.content.data';
128
+    public $returnTarget = 'response.content.data';
129 129
 }
130 130
\ No newline at end of file
Please login to merge, or discard this patch.
src/Controller/RequestHandler.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     /**
16 16
      * @param ParamMeta[] $paramMates
17 17
      */
18
-    public function __construct(array $paramMates=[]){
18
+    public function __construct(array $paramMates = []) {
19 19
         $this->paramMetas = $paramMates;
20 20
     }
21 21
 
@@ -26,32 +26,32 @@  discard block
 block discarded – undo
26 26
      * @param array $reference
27 27
      * @return void
28 28
      */
29
-    public function handle(Application $app, Request $request, array &$params, array &$reference){
29
+    public function handle(Application $app, Request $request, array &$params, array &$reference) {
30 30
 
31 31
         $vld = new Validator();
32 32
         $req = ['request'=>$request];
33 33
         $requestArray = new ArrayAdaptor($req);
34 34
         $inputs = [];
35
-        foreach ($this->paramMetas as $k=>$meta){
36
-            if($meta->isPassedByReference){
35
+        foreach ($this->paramMetas as $k=>$meta) {
36
+            if ($meta->isPassedByReference) {
37 37
                 // param PassedByReference is used to output
38 38
                 continue;
39 39
             }
40 40
             $source = \JmesPath\search($meta->source, $requestArray);
41
-            if ($source !== null){
41
+            if ($source !== null) {
42 42
                 $source = ArrayAdaptor::strip($source);
43
-                if($source instanceof ParameterBag){
43
+                if ($source instanceof ParameterBag) {
44 44
                     $source = $source->all();
45 45
                 }
46
-                if($meta->container){
46
+                if ($meta->container) {
47 47
                     $inputs[$meta->name] = $meta->container->make($source);
48
-                }else{
48
+                }else {
49 49
                     $inputs[$meta->name] = $source;
50 50
                 }
51
-                if($meta->validation){
51
+                if ($meta->validation) {
52 52
                     $vld->rule($meta->validation, $meta->name);
53 53
                 }
54
-            }else{
54
+            }else {
55 55
                 $meta->isOptional or \PhpBoot\abort(new BadRequestHttpException("the parameter \"{$meta->source}\" is missing"));
56 56
                 $inputs[$meta->name] = $meta->default;
57 57
             }
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
         );
68 68
 
69 69
         $pos = 0;
70
-        foreach ($this->paramMetas as $meta){
71
-            if($meta->isPassedByReference){
70
+        foreach ($this->paramMetas as $meta) {
71
+            if ($meta->isPassedByReference) {
72 72
                 $params[$pos] = &$reference[$meta->name];
73
-            }else{
73
+            }else {
74 74
                 $params[$pos] = $inputs[$meta->name];
75 75
             }
76 76
             $pos++;
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
         }
79 79
     }
80 80
 
81
-    public function getParamNames(){
82
-        return array_map(function($meta){return $meta->name;}, $this->paramMetas);
81
+    public function getParamNames() {
82
+        return array_map(function($meta) {return $meta->name; }, $this->paramMetas);
83 83
     }
84 84
 
85 85
     /**
86 86
      * 获取参数列表
87 87
      * @return ParamMeta[]
88 88
      */
89
-    public function getParamMetas(){
89
+    public function getParamMetas() {
90 90
         return $this->paramMetas;
91 91
     }
92 92
 
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
      * @param $name
96 96
      * @return ParamMeta|null
97 97
      */
98
-    public function getParamMeta($name){
99
-        foreach ($this->paramMetas as $meta){
100
-            if($meta->name == $name){
98
+    public function getParamMeta($name) {
99
+        foreach ($this->paramMetas as $meta) {
100
+            if ($meta->name == $name) {
101 101
                 return $meta;
102 102
             }
103 103
         }
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,25 +29,25 @@  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
     }
36 36
 
37
-    public function wait($waitAble){
37
+    public function wait($waitAble) {
38 38
         array_push($this->waits, $waitAble);
39 39
         $this->run();
40 40
 
41
-        if(count($this->waits)){
41
+        if (count($this->waits)) {
42 42
             $waitAll = $this->waitAll;
43 43
             $this->waitResults = $waitAll($this->waits);
44 44
             $this->waits = [];
45 45
         }
46 46
 
47
-        $res =  array_pop($this->waitResults);
48
-        if(isset($res[1])){
47
+        $res = array_pop($this->waitResults);
48
+        if (isset($res[1])) {
49 49
              \PhpBoot\abort(new RpcException($res['reason']));
50
-        }else{
50
+        }else {
51 51
             return $res[0];
52 52
         }
53 53
     }
Please login to merge, or discard this patch.
src/Application.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
 
94 94
             Request::class => \DI\factory([Application::class, 'createRequestFromGlobals']),
95 95
         ];
96
-        if(function_exists('apc_fetch')){
96
+        if (function_exists('apc_fetch')) {
97 97
             $default += [
98 98
                 Cache::class => \DI\object(ApcCache::class)
99 99
             ];
100
-        }else{
100
+        }else {
101 101
             $default += [
102 102
                 Cache::class => \DI\object(FilesystemCache::class)
103 103
                     ->constructorParameter('directory', sys_get_temp_dir())
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
      * @param string[] $hooks hook class names
140 140
      * @return void
141 141
      */
142
-    public function loadRoutesFromClass($className, $hooks=[])
142
+    public function loadRoutesFromClass($className, $hooks = [])
143 143
     {
144 144
         $cache = new CheckableCache($this->cache);
145 145
 
146
-        $key = 'loadRoutesFromClass:' . md5(__CLASS__ . ':' . $className);
146
+        $key = 'loadRoutesFromClass:'.md5(__CLASS__.':'.$className);
147 147
         $routes = $cache->get($key, $this);
148 148
 
149 149
         $controller = null;
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
             $this->routes[] = [
161 161
                 $method,
162 162
                 $uri,
163
-                function (Application $app, Request $request) use ($cache, $className, $actionName, $controller) {
163
+                function(Application $app, Request $request) use ($cache, $className, $actionName, $controller) {
164 164
 
165
-                    $key = 'loadRoutesFromClass:route:' . md5(__CLASS__ . ':' . $className . ':' . $actionName);
165
+                    $key = 'loadRoutesFromClass:route:'.md5(__CLASS__.':'.$className.':'.$actionName);
166 166
 
167 167
                     $routeInstance = $cache->get($key, $this);
168 168
                     if ($routeInstance == $this) {
@@ -190,11 +190,11 @@  discard block
 block discarded – undo
190 190
      * @param string[] $hooks
191 191
      * @return void
192 192
      */
193
-    public function loadRoutesFromPath($fromPath, $namespace = '', $hooks=[])
193
+    public function loadRoutesFromPath($fromPath, $namespace = '', $hooks = [])
194 194
     {
195 195
         $dir = @dir($fromPath) or abort("dir $fromPath not exist");
196 196
 
197
-        $getEach = function () use ($dir) {
197
+        $getEach = function() use ($dir) {
198 198
             $name = $dir->read();
199 199
             if (!$name) {
200 200
                 return $name;
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
             if ($entry == '.' || $entry == '..') {
207 207
                 continue;
208 208
             }
209
-            $path = $fromPath . '/' . str_replace('\\', '/', $entry);
209
+            $path = $fromPath.'/'.str_replace('\\', '/', $entry);
210 210
             if (is_file($path) && substr_compare($entry, '.php', strlen($entry) - 4, 4, true) == 0) {
211
-                $class_name = $namespace . '\\' . substr($entry, 0, strlen($entry) - 4);
211
+                $class_name = $namespace.'\\'.substr($entry, 0, strlen($entry) - 4);
212 212
                 $this->loadRoutesFromClass($class_name, $hooks);
213
-            } else {
213
+            }else {
214 214
                 //\Log::debug($path.' ignored');
215 215
             }
216 216
         }
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      * @param callable $handler function(Application $app, Request $request):Response
224 224
      * @param string[] $hooks
225 225
      */
226
-    public function addRoute($method, $uri, callable $handler, $hooks=[])
226
+    public function addRoute($method, $uri, callable $handler, $hooks = [])
227 227
     {
228 228
         $this->routes[] = [$method, $uri, $handler, $hooks];
229 229
     }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
     {
250 250
         //  TODO 把 Route里的异常处理 ExceptionRenderer 移到这里更妥?
251 251
         $renderer = $this->get(ExceptionRenderer::class);
252
-        try{
252
+        try {
253 253
             if ($request == null) {
254 254
                 $request = $this->make(Request::class);
255 255
             }
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
             }
260 260
             $uri = rawurldecode($uri);
261 261
 
262
-            $next = function (Request $request)use($uri){
262
+            $next = function(Request $request)use($uri){
263 263
                 $dispatcher = $this->getDispatcher();
264 264
                 $res = $dispatcher->dispatch($request->getMethod(), $uri);
265 265
                 if ($res[0] == Dispatcher::FOUND) {
@@ -268,10 +268,10 @@  discard block
 block discarded – undo
268 268
                         $request->attributes->add($res[2]);
269 269
                     }
270 270
                     list($handler, $hooks) = $res[1];
271
-                    $next = function (Request $request)use($handler){
271
+                    $next = function(Request $request)use($handler){
272 272
                         return $handler($this, $request);
273 273
                     };
274
-                    foreach (array_reverse($hooks) as $hookName){
274
+                    foreach (array_reverse($hooks) as $hookName) {
275 275
                         $next = function($request)use($hookName, $next){
276 276
                             $hook = $this->get($hookName);
277 277
                             /**@var $hook HookInterface*/
@@ -284,12 +284,12 @@  discard block
 block discarded – undo
284 284
                     \PhpBoot\abort(new NotFoundHttpException(), [$request->getMethod(), $uri]);
285 285
                 } elseif ($res[0] == Dispatcher::METHOD_NOT_ALLOWED) {
286 286
                     \PhpBoot\abort(new MethodNotAllowedHttpException($res[1]), [$request->getMethod(), $uri]);
287
-                } else {
287
+                }else {
288 288
                     \PhpBoot\abort("unknown dispatch return {$res[0]}");
289 289
                 }
290 290
             };
291 291
 
292
-            foreach (array_reverse($this->getGlobalHooks()) as $hookName){
292
+            foreach (array_reverse($this->getGlobalHooks()) as $hookName) {
293 293
                 $next = function($request)use($hookName, $next){
294 294
                     $hook = $this->get($hookName);
295 295
                     /**@var $hook HookInterface*/
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
             }
305 305
             return $response;
306 306
 
307
-        }catch (\Exception $e){
307
+        }catch (\Exception $e) {
308 308
             $renderer->render($e);
309 309
         }
310 310
 
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, '');
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
         list($_, $meta) = $route
43 43
             ->getResponseHandler()
44 44
             ->getMappingBySource('return');
45
-        if($meta){
45
+        if ($meta) {
46 46
             $meta->description = $doc;
47 47
             $meta->type = $type;
48
-            $meta->container = $type == 'void'?null:ContainerFactory::create($entityBuilder, $type);
48
+            $meta->container = $type == 'void' ?null:ContainerFactory::create($entityBuilder, $type);
49 49
         }
50 50
     }
51 51
 }
52 52
\ No newline at end of file
Please login to merge, or discard this patch.