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 ( c752e6...86709a )
by cao
17:38
created
src/Application.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,6 @@
 block discarded – undo
24 24
 use PhpBoot\DB\DB;
25 25
 use PhpBoot\DI\DIContainerBuilder;
26 26
 use PhpBoot\DI\Traits\EnableDIAnnotations;
27
-use PhpBoot\Lock\LocalAutoLock;
28 27
 use PhpBoot\Utils\Logger;
29 28
 use Psr\Container\ContainerExceptionInterface;
30 29
 use Psr\Container\ContainerInterface;
Please login to merge, or discard this 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/ControllerContainerBuilder.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,6 @@
 block discarded – undo
5 5
 use DI\FactoryInterface;
6 6
 use \DI\InvokerInterface as DIInvokerInterface;
7 7
 use Doctrine\Common\Cache\Cache;
8
-use PhpBoot\Cache\LocalCacheInterface;
9 8
 use PhpBoot\Controller\Annotations\BindAnnotationHandler;
10 9
 use PhpBoot\Controller\Annotations\ClassAnnotationHandler;
11 10
 use PhpBoot\Controller\Annotations\HookAnnotationHandler;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 class ControllerContainerBuilder extends ContainerBuilder
21 21
 {
22
-    static $DEFAULT_ANNOTATIONS=[
22
+    static $DEFAULT_ANNOTATIONS = [
23 23
         [ClassAnnotationHandler::class, 'class'],
24 24
         [PathAnnotationHandler::class, "class.children[?name=='path']"],
25 25
         [RouteAnnotationHandler::class, "methods.*.children[?name=='route'][]"],
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
                                 Cache $cache,
44 44
                                 array $annotations = null)
45 45
     {
46
-        if($annotations){
46
+        if ($annotations) {
47 47
             parent::__construct($annotations, $cache);
48
-        }else{
48
+        }else {
49 49
             parent::__construct(self::$DEFAULT_ANNOTATIONS, $cache);
50 50
         }
51 51
 
Please login to merge, or discard this patch.
src/ORM/ModelContainerBuilder.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace PhpBoot\ORM;
4 4
 
5
-use DI\Container;
6 5
 use DI\FactoryInterface;
7 6
 use Doctrine\Common\Cache\Cache;
8 7
 use PhpBoot\DI\DIContainerBuilder;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 
17 17
 class ModelContainerBuilder extends EntityContainerBuilder
18 18
 {
19
-    static $DEFAULT_ANNOTATIONS=[
19
+    static $DEFAULT_ANNOTATIONS = [
20 20
         [ClassAnnotationHandler::class, 'class'],
21 21
         [PKAnnotationHandler::class, "class.children[?name=='pk']"],
22 22
         [TableAnnotationHandler::class, "class.children[?name=='table']"],
Please login to merge, or discard this patch.
src/Lock/ApcLock.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@  discard block
 block discarded – undo
6 6
 
7 7
     public function lock($key, $ttl)
8 8
     {
9
-        if(apc_add($key, 1, $ttl)){
9
+        if (apc_add($key, 1, $ttl)) {
10 10
             $this->locked = true;
11 11
             return true;
12
-        }else{
12
+        }else {
13 13
             return false;
14 14
         }
15 15
     }
@@ -21,5 +21,5 @@  discard block
 block discarded – undo
21 21
         $this->locked = false;
22 22
         return $res;
23 23
     }
24
-    private $locked=false;
24
+    private $locked = false;
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
src/Entity/EntityContainer.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@  discard block
 block discarded – undo
14 14
 
15 15
     public function make($data, $validate = true)
16 16
     {
17
-        if($data === null){
17
+        if ($data === null) {
18 18
             return null;
19 19
         }
20 20
         $data instanceof \ArrayAccess || is_array($data) or \PhpBoot\abort(new \InvalidArgumentException("array is required by make {$this->className}, $data given"));
21 21
         $className = $this->getClassName();
22 22
         $obj = new $className();
23 23
         $vld = new Validator();
24
-        foreach ($this->properties as $p){
25
-            if($p->container && isset($data[$p->name])){
24
+        foreach ($this->properties as $p) {
25
+            if ($p->container && isset($data[$p->name])) {
26 26
                 $var = $data[$p->name];
27
-                if($p->container instanceof EntityContainer
28
-                    || $p->container instanceof ArrayContainer){
29
-                    if(!$var){
27
+                if ($p->container instanceof EntityContainer
28
+                    || $p->container instanceof ArrayContainer) {
29
+                    if (!$var) {
30 30
                         $var = [];
31
-                    }elseif(is_string($var)){
31
+                    }elseif (is_string($var)) {
32 32
                         $var = json_decode($var, true);
33 33
                         !json_last_error() or \PhpBoot\abort(new \InvalidArgumentException(__METHOD__.' failed while json_decode with '.json_last_error_msg()));
34 34
                     }
@@ -36,18 +36,18 @@  discard block
 block discarded – undo
36 36
                 $data[$p->name] = $p->container->make($var, $validate);
37 37
             }
38 38
 
39
-            if($p->validation){
40
-                if(is_array($p->validation)){
39
+            if ($p->validation) {
40
+                if (is_array($p->validation)) {
41 41
                     $vld->rule($p->validation[0], $p->name.'.'.$p->validation[1]);
42
-                }else{
42
+                }else {
43 43
                     $vld->rule($p->validation, $p->name);
44 44
                 }
45 45
             }
46
-            if(!$p->isOptional && !$vld->hasRule('optional', $p->name)){
46
+            if (!$p->isOptional && !$vld->hasRule('optional', $p->name)) {
47 47
                 $vld->rule('required', $p->name);
48 48
             }
49 49
         }
50
-        if($validate){
50
+        if ($validate) {
51 51
             $vld = $vld->withData($data);
52 52
             $vld->validate() or \PhpBoot\abort(
53 53
                 new \InvalidArgumentException(
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
             );
60 60
         }
61 61
 
62
-        foreach ($this->properties as $p){
63
-            if(isset($data[$p->name])){
62
+        foreach ($this->properties as $p) {
63
+            if (isset($data[$p->name])) {
64 64
                 $obj->{$p->name} = $data[$p->name];
65 65
             }
66 66
         }
@@ -72,32 +72,32 @@  discard block
 block discarded – undo
72 72
     {
73 73
         $className = $this->getClassName();
74 74
         $obj = new $className();
75
-        foreach ($this->properties as $p){
76
-            if($p->isOptional){
75
+        foreach ($this->properties as $p) {
76
+            if ($p->isOptional) {
77 77
                 $obj->{$p->name} = $p->default;
78
-            }elseif($p->container){
78
+            }elseif ($p->container) {
79 79
                 $var = $p->container->makeExample();
80 80
                 $obj->{$p->name} = $var;
81
-            }else{
81
+            }else {
82 82
                 $obj->{$p->name} = null;
83 83
             }
84 84
 
85 85
         }
86 86
         return $obj;
87 87
     }
88
-    public function getProperty($target){
89
-        if(array_key_exists($target, $this->properties)){
88
+    public function getProperty($target) {
89
+        if (array_key_exists($target, $this->properties)) {
90 90
             return $this->properties[$target];
91 91
         }
92 92
         return null;
93 93
     }
94
-    public function setProperty($target, PropertyMeta $meta){
94
+    public function setProperty($target, PropertyMeta $meta) {
95 95
         $this->properties[$target] = $meta;
96 96
     }
97 97
     /**
98 98
      * @return PropertyMeta[]
99 99
      */
100
-    public function getProperties(){
100
+    public function getProperties() {
101 101
         return $this->properties;
102 102
     }
103 103
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     /**
158 158
      * @var PropertyMeta[]
159 159
      */
160
-    private $properties=[];
160
+    private $properties = [];
161 161
 
162 162
     /**
163 163
      * @var string
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
     /**
168 168
      * @var string
169 169
      */
170
-    private $description='';
170
+    private $description = '';
171 171
     /**
172 172
      * @var string
173 173
      */
174
-    private $summary='';
174
+    private $summary = '';
175 175
 
176 176
     /**
177 177
      * @var string
Please login to merge, or discard this patch.
src/Entity/EntityContainerBuilder.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 class EntityContainerBuilder extends ContainerBuilder
15 15
 {
16
-    static $DEFAULT_ANNOTATIONS=[
16
+    static $DEFAULT_ANNOTATIONS = [
17 17
         [ClassAnnotationHandler::class, 'class'],
18 18
         [PropertyAnnotationHandler::class, 'properties'],
19 19
         [VarAnnotationHandler::class, "properties.*.children[?name=='var'][]"],
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
                                 array $annotations = null
35 35
                                 )
36 36
     {
37
-        if($annotations){
37
+        if ($annotations) {
38 38
             parent::__construct($annotations, $cache);
39
-        }else{
39
+        }else {
40 40
             parent::__construct(self::$DEFAULT_ANNOTATIONS, $cache);
41 41
         }
42 42
         $this->factory = $factory;
Please login to merge, or discard this patch.
src/Entity/ScalarTypeContainer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@
 block discarded – undo
10 10
     public function __construct($type)
11 11
     {
12 12
         $this->type = $type;
13
-        !$type || TypeHint::isScalarType($type)  or \PhpBoot\abort(new \InvalidArgumentException("$type is not scalar type"));
13
+        !$type || TypeHint::isScalarType($type) or \PhpBoot\abort(new \InvalidArgumentException("$type is not scalar type"));
14 14
     }
15 15
 
16
-    public function make($data, $validate = true){
16
+    public function make($data, $validate = true) {
17 17
         return TypeCast::cast($data, $this->type, $validate);
18 18
     }
19 19
 
Please login to merge, or discard this patch.
src/Entity/ContainerFactory.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,17 +11,17 @@
 block discarded – undo
11 11
         //TODO 支持|分隔的多类型
12 12
 
13 13
         $getter = function($type)use($builder){
14
-            if(!$type || $type == 'mixed'){
14
+            if (!$type || $type == 'mixed') {
15 15
                 return new MixedTypeContainer();
16
-            }elseif (TypeHint::isScalarType($type)){
16
+            }elseif (TypeHint::isScalarType($type)) {
17 17
                 return new ScalarTypeContainer($type);
18
-            }else{
18
+            }else {
19 19
                 return $builder->build($type);
20 20
             }
21 21
         };
22
-        if(TypeHint::isArray($type)){
22
+        if (TypeHint::isArray($type)) {
23 23
             $container = ArrayContainer::create($type, $getter);
24
-        }else{
24
+        }else {
25 25
             $container = $getter($type);
26 26
         }
27 27
         return $container;
Please login to merge, or discard this patch.
src/Entity/Annotations/ClassAnnotationHandler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@
 block discarded – undo
25 25
         $container->setDescription($ann->description);
26 26
         $container->setSummary($ann->summary);
27 27
 
28
-        foreach ($properties as $i){
29
-            $isOption = array_key_exists($i->getName(), $default) && $default[$i->getName()] !==null;
28
+        foreach ($properties as $i) {
29
+            $isOption = array_key_exists($i->getName(), $default) && $default[$i->getName()] !== null;
30 30
             $container->setProperty($i->getName(), new PropertyMeta(
31 31
                 $i->getName(),
32 32
                 null,
33 33
                 $isOption,
34
-                $isOption?$default[$i->getName()]:null
34
+                $isOption ? $default[$i->getName()] : null
35 35
                 ));
36 36
         }
37 37
     }
Please login to merge, or discard this patch.