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
Push — master ( 9dbfb1...3deabf )
by cao
03:03
created
src/Annotation/AnnotationReader.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
         }
74 74
     }
75 75
     /**
76
-     * @param $className
76
+     * @param string $className
77 77
      * @return self
78 78
      */
79 79
     static function readWithoutCache($className)
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -62,13 +62,13 @@
 block discarded – undo
62 62
                 $meta = self::readWithoutCache($className);
63 63
                 $cache->set($key, $meta, 0, $fileName?new ClassModifiedChecker($className):null);
64 64
                 return $meta;
65
-            }catch (\Exception $e){
65
+            } catch (\Exception $e){
66 66
                 $cache->set($key, $e->getMessage(), 0, $fileName?new ClassModifiedChecker($className):null);
67 67
                 throw $e;
68 68
             }
69
-        }elseif(is_string($res)){
69
+        } elseif(is_string($res)){
70 70
             \PhpBoot\abort($res);
71
-        }else{
71
+        } else{
72 72
             return $res;
73 73
         }
74 74
     }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 }
46 46
 class AnnotationReader implements \ArrayAccess
47 47
 {
48
-    static public function createDocBlockFactory(){
48
+    static public function createDocBlockFactory() {
49 49
         $fqsenResolver = new FqsenResolver();
50
-        $tagFactory = new StandardTagFactory($fqsenResolver,[]);
50
+        $tagFactory = new StandardTagFactory($fqsenResolver, []);
51 51
         $descriptionFactory = new DescriptionFactory($tagFactory);
52 52
         $tagFactory->addService($descriptionFactory);
53 53
         $tagFactory->addService(new TypeResolver($fqsenResolver));
@@ -72,22 +72,22 @@  discard block
 block discarded – undo
72 72
         self::assertAnnotationEnabled();
73 73
         $rfl = new \ReflectionClass($className) or \PhpBoot\abort("load class $className failed");
74 74
         $fileName = $rfl->getFileName();
75
-        $key = str_replace('\\','.',self::class).md5($fileName.$className);
75
+        $key = str_replace('\\', '.', self::class).md5($fileName.$className);
76 76
         $oldData = null;
77
-        $cache = new CheckableCache($localCache?:new ApcCache());
77
+        $cache = new CheckableCache($localCache ?: new ApcCache());
78 78
         $res = $cache->get('ann:'.$key, null, $oldData, false);
79
-        if($res === null){
80
-            try{
79
+        if ($res === null) {
80
+            try {
81 81
                 $meta = self::readWithoutCache($className);
82
-                $cache->set($key, $meta, 0, $fileName?new ClassModifiedChecker($className):null);
82
+                $cache->set($key, $meta, 0, $fileName ? new ClassModifiedChecker($className) : null);
83 83
                 return $meta;
84
-            }catch (\Exception $e){
85
-                $cache->set($key, $e->getMessage(), 0, $fileName?new ClassModifiedChecker($className):null);
84
+            }catch (\Exception $e) {
85
+                $cache->set($key, $e->getMessage(), 0, $fileName ? new ClassModifiedChecker($className) : null);
86 86
                 throw $e;
87 87
             }
88
-        }elseif(is_string($res)){
88
+        }elseif (is_string($res)) {
89 89
             \PhpBoot\abort($res);
90
-        }else{
90
+        }else {
91 91
             return $res;
92 92
         }
93 93
     }
@@ -104,19 +104,19 @@  discard block
 block discarded – undo
104 104
         $reader->class->name = $className;
105 105
 
106 106
         //method annotations
107
-        foreach ($rfl->getMethods() as $i){
107
+        foreach ($rfl->getMethods() as $i) {
108 108
             $block = self::readAnnotationBlock($i->getDocComment());
109 109
             $block->name = $i->getName();
110
-            $reader->methods[$i->getName()]=$block;
110
+            $reader->methods[$i->getName()] = $block;
111 111
         }
112 112
         //property annotations
113
-        foreach ($rfl->getProperties() as $i){
113
+        foreach ($rfl->getProperties() as $i) {
114 114
             if ($i->isStatic()) {
115 115
                 continue;
116 116
             }
117 117
             $block = self::readAnnotationBlock($i->getDocComment());
118 118
             $block->name = $i->getName();
119
-            $reader->properties[$i->getName()]=$block;
119
+            $reader->properties[$i->getName()] = $block;
120 120
         }
121 121
         while ($rfl = $rfl->getParentClass()) {
122 122
             foreach ($rfl->getProperties(\ReflectionProperty::IS_PRIVATE) as $i) {
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                 }
126 126
                 $block = self::readAnnotationBlock($i->getDocComment());
127 127
                 $block->name = $i->getName();
128
-                $reader->properties[$i->getName()]=$block;
128
+                $reader->properties[$i->getName()] = $block;
129 129
             }
130 130
         }
131 131
         return $reader;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     static private function readAnnotationBlock($doc)
135 135
     {
136 136
         $annBlock = new AnnotationBlock();
137
-        if(empty($doc)){
137
+        if (empty($doc)) {
138 138
             return $annBlock;
139 139
         }
140 140
         $docFactory = AnnotationReader::createDocBlockFactory();
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
             $annTag->parent = $annBlock;
150 150
             $annTag->description = strval($desc);
151 151
             $annTag->name = $tag->getName();
152
-            $annTag->children=[];
153
-            if($desc){
152
+            $annTag->children = [];
153
+            if ($desc) {
154 154
                 $output = new AnnotationTagsOutput();
155 155
                 $desc->render($output);
156 156
                 foreach ($output->tags as $child) {
@@ -174,11 +174,11 @@  discard block
 block discarded – undo
174 174
      * @var AnnotationBlock[]
175 175
      */
176 176
 
177
-    public $methods=[];
177
+    public $methods = [];
178 178
     /**
179 179
      * @var AnnotationBlock[]
180 180
      */
181
-    public $properties=[];
181
+    public $properties = [];
182 182
 
183 183
     public function offsetExists($offset)
184 184
     {
Please login to merge, or discard this patch.
src/Annotation/AnnotationTag.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,6 @@
 block discarded – undo
8 8
     /**
9 9
      * AnnotationTag constructor.
10 10
      * @param string $name
11
-     * @param string $summary
12 11
      * @param string $description
13 12
      * @param array $children
14 13
      * @param AnnotationBlock|AnnotationTag|null $parent
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
      * @param array $children
14 14
      * @param AnnotationBlock|AnnotationTag|null $parent
15 15
      */
16
-    public function __construct($name='',
17
-                                $description='',
18
-                                $children=[],
19
-                                $parent=null)
16
+    public function __construct($name = '',
17
+                                $description = '',
18
+                                $children = [],
19
+                                $parent = null)
20 20
     {
21 21
         $this->name = $name;
22 22
         $this->description = $description;
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
     /**
32 32
      * @var string
33 33
      */
34
-    public $description='';
34
+    public $description = '';
35 35
     /**
36 36
      * @var AnnotationBlock[]
37 37
      */
38
-    public $children=[];
38
+    public $children = [];
39 39
 
40 40
     /**
41 41
      * @var AnnotationBlock|null
Please login to merge, or discard this patch.
src/Application.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -375,7 +375,7 @@
 block discarded – undo
375 375
     }
376 376
 
377 377
     /**
378
-     * @return \string[]
378
+     * @return string[]
379 379
      */
380 380
     public function getGlobalHooks()
381 381
     {
Please login to merge, or discard this patch.
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
@@ -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.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
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())
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
                     }
271 271
                     return $next($request);
272 272
 
273
-                }elseif ($res[0] == Dispatcher::NOT_FOUND) {
273
+                } elseif ($res[0] == Dispatcher::NOT_FOUND) {
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]);
@@ -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/Cache/ClassModifiedChecker.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -4,6 +4,9 @@
 block discarded – undo
4 4
 
5 5
 class ClassModifiedChecker extends FileModifiedChecker
6 6
 {
7
+    /**
8
+     * @param string $className
9
+     */
7 10
     function __construct($className){
8 11
         $class = new \ReflectionClass($className);
9 12
         $files = [];
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,11 +4,11 @@  discard block
 block discarded – undo
4 4
 
5 5
 class ClassModifiedChecker extends FileModifiedChecker
6 6
 {
7
-    function __construct($className){
7
+    function __construct($className) {
8 8
         $class = new \ReflectionClass($className);
9 9
         $files = [];
10 10
 
11
-        if($class->getFileName()){
11
+        if ($class->getFileName()) {
12 12
             $files[] = $class->getFileName();
13 13
             self::getParentFileName($class, $files);
14 14
         }
@@ -18,15 +18,15 @@  discard block
 block discarded – undo
18 18
     static public function getParentFileName(\ReflectionClass $class, array &$files)
19 19
     {
20 20
         $parent = $class->getParentClass();
21
-        if(!$parent){
21
+        if (!$parent) {
22 22
             return;
23 23
         }
24
-        if($parent->getFileName()){
24
+        if ($parent->getFileName()) {
25 25
             $files[] = $parent->getParentClass();
26 26
             self::getParentFileName($parent, $files);
27 27
         }
28
-        foreach ($class->getInterfaces() as $interface){
29
-            if($interface->getFileName()){
28
+        foreach ($class->getInterfaces() as $interface) {
29
+            if ($interface->getFileName()) {
30 30
                 $files[] = $interface->getFileName();
31 31
                 self::getParentFileName($interface, $files);
32 32
             }
Please login to merge, or discard this patch.
src/Controller/ControllerContainerBuilder.php 3 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.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
     {
46 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/Controller/RequestHandler.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@
 block discarded – undo
91 91
 
92 92
     /**
93 93
      * 获取指定参数信息
94
-     * @param $name
94
+     * @param string|null $name
95 95
      * @return ParamMeta|null
96 96
      */
97 97
     public function getParamMeta($name){
Please login to merge, or discard this 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("param $source is required"));
56 56
                 $inputs[$meta->name] = $meta->default;
57 57
             }
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
         );
67 67
 
68 68
         $pos = 0;
69
-        foreach ($this->paramMetas as $meta){
70
-            if($meta->isPassedByReference){
69
+        foreach ($this->paramMetas as $meta) {
70
+            if ($meta->isPassedByReference) {
71 71
                 $params[$pos] = &$reference[$meta->name];
72
-            }else{
72
+            }else {
73 73
                 $params[$pos] = $inputs[$meta->name];
74 74
             }
75 75
             $pos++;
@@ -77,15 +77,15 @@  discard block
 block discarded – undo
77 77
         }
78 78
     }
79 79
 
80
-    public function getParamNames(){
81
-        return array_map(function($meta){return $meta->name;}, $this->paramMetas);
80
+    public function getParamNames() {
81
+        return array_map(function($meta) {return $meta->name; }, $this->paramMetas);
82 82
     }
83 83
 
84 84
     /**
85 85
      * 获取参数列表
86 86
      * @return ParamMeta[]
87 87
      */
88
-    public function getParamMetas(){
88
+    public function getParamMetas() {
89 89
         return $this->paramMetas;
90 90
     }
91 91
 
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
      * @param $name
95 95
      * @return ParamMeta|null
96 96
      */
97
-    public function getParamMeta($name){
98
-        foreach ($this->paramMetas as $meta){
99
-            if($meta->name == $name){
97
+    public function getParamMeta($name) {
98
+        foreach ($this->paramMetas as $meta) {
99
+            if ($meta->name == $name) {
100 100
                 return $meta;
101 101
             }
102 102
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
                 }
46 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 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("param $source is required"));
56 56
                 $inputs[$meta->name] = $meta->default;
57 57
             }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         foreach ($this->paramMetas as $meta){
70 70
             if($meta->isPassedByReference){
71 71
                 $params[$pos] = &$reference[$meta->name];
72
-            }else{
72
+            } else{
73 73
                 $params[$pos] = $inputs[$meta->name];
74 74
             }
75 75
             $pos++;
Please login to merge, or discard this patch.
src/DB/DB.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -82,6 +82,9 @@
 block discarded – undo
82 82
         return new DB($app, $connection);
83 83
     }
84 84
 
85
+    /**
86
+     * @param \PDO $connection
87
+     */
85 88
     public function __construct(Application $app, $connection)
86 89
     {
87 90
         $this->app = $app;
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
      */
68 68
 
69 69
     static public function connect(Application $app,
70
-                                   $dsn,
71
-                                  $username,
72
-                                  $password,
73
-                                  $options = [])
70
+                                    $dsn,
71
+                                    $username,
72
+                                    $password,
73
+                                    $options = [])
74 74
     {
75 75
         $options += [
76 76
             \PDO::ATTR_ERRMODE =>\PDO::ERRMODE_EXCEPTION,
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
         return $this->connection;
166 166
     }
167 167
     /**
168
-	 * Splice sql use raw string(without escaping)
168
+     * Splice sql use raw string(without escaping)
169 169
      * for example:
170 170
      * where('time>?', 'now()') => " WHERE time > 'now()' "
171 171
      * where('time>?', Sql::raw('now()')) => " WHERE time > now() "
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
  *      
57 57
  * @author caoym <[email protected]>
58 58
  */
59
-class DB{
59
+class DB {
60 60
 
61 61
     /**
62 62
      * DB constructor.
@@ -97,18 +97,18 @@  discard block
 block discarded – undo
97 97
      * @param string $column0
98 98
      * @return \PhpBoot\DB\rules\select\FromRule
99 99
      */
100
-    function select($column0=null, $_=null){
100
+    function select($column0 = null, $_ = null) {
101 101
         $obj = new SelectRule(new Context($this->connection));
102
-        if($column0 == null){
102
+        if ($column0 == null) {
103 103
             $args = ['*'];
104
-        }elseif(is_array($column0)){
104
+        }elseif (is_array($column0)) {
105 105
             $args = $column0;
106
-        }else{
106
+        }else {
107 107
             $args = func_get_args();
108 108
         }
109
-        foreach ($args as &$arg){
109
+        foreach ($args as &$arg) {
110 110
             $arg = DB::wrap($arg);
111
-            if($arg == '*'){
111
+            if ($arg == '*') {
112 112
                 continue;
113 113
             }
114 114
 
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
      * @param string $table
141 141
      * @return \PhpBoot\DB\rules\basic\WhereRule
142 142
      */
143
-    public function deleteFrom($table){
144
-        $obj  =  new DeleteRule(new Context($this->connection));
143
+    public function deleteFrom($table) {
144
+        $obj = new DeleteRule(new Context($this->connection));
145 145
         return $obj->deleteFrom($table);
146 146
     }
147 147
     /**
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
      * @param string $table
150 150
      * @return \PhpBoot\DB\rules\replace\ValuesRule
151 151
      */
152
-    public function replaceInto($table){
153
-        $obj  =  new ReplaceIntoRule(new Context($this->connection));
152
+    public function replaceInto($table) {
153
+        $obj = new ReplaceIntoRule(new Context($this->connection));
154 154
         return $obj->replaceInto($table);
155 155
     }
156 156
 
@@ -161,16 +161,16 @@  discard block
 block discarded – undo
161 161
      */
162 162
     public function transaction(callable $callback)
163 163
     {
164
-        if($this->inTransaction){
164
+        if ($this->inTransaction) {
165 165
             return $callback($this);
166 166
         }
167 167
         $this->getConnection()->beginTransaction() or \PhpBoot\abort('beginTransaction failed');
168 168
         $this->inTransaction = true;
169
-        try{
169
+        try {
170 170
             $res = $callback($this);
171 171
             $this->getConnection()->commit() or \PhpBoot\abort('commit failed');
172 172
             return $res;
173
-        }catch (\Exception $e){
173
+        }catch (\Exception $e) {
174 174
             $this->getConnection()->rollBack();
175 175
             Logger::warning('commit failed with '.get_class($e).' '.$e->getMessage());
176 176
             throw $e;
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      * @param string $str
192 192
      * @return Raw
193 193
      */
194
-    static public function raw($str){
194
+    static public function raw($str) {
195 195
         return new Raw($str);
196 196
     }
197 197
     static public function wrap($value)
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         if ($value === '*') {
200 200
             return $value;
201 201
         }
202
-        if($value instanceof Raw){
202
+        if ($value instanceof Raw) {
203 203
             return $value->get();
204 204
         }
205 205
         return '`'.str_replace('`', '``', $value).'`';
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
     {
213 213
         return $this->app;
214 214
     }
215
-    const ORDER_BY_ASC ='ASC';
216
-    const ORDER_BY_DESC ='DESC';
215
+    const ORDER_BY_ASC = 'ASC';
216
+    const ORDER_BY_DESC = 'DESC';
217 217
 
218 218
     /**
219 219
      * @var \PDO
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
         $obj = new SelectRule(new Context($this->connection));
102 102
         if($column0 == null){
103 103
             $args = ['*'];
104
-        }elseif(is_array($column0)){
104
+        } elseif(is_array($column0)){
105 105
             $args = $column0;
106
-        }else{
106
+        } else{
107 107
             $args = func_get_args();
108 108
         }
109 109
         foreach ($args as &$arg){
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
             $res = $callback($this);
171 171
             $this->getConnection()->commit() or \PhpBoot\abort('commit failed');
172 172
             return $res;
173
-        }catch (\Exception $e){
173
+        } catch (\Exception $e){
174 174
             $this->getConnection()->rollBack();
175 175
             Logger::warning('commit failed with '.get_class($e).' '.$e->getMessage());
176 176
             throw $e;
Please login to merge, or discard this patch.
src/DB/rules/update.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -24,6 +24,9 @@
 block discarded – undo
24 24
 
25 25
 class UpdateSetRule extends WhereRule
26 26
 {
27
+    /**
28
+     * @param \PhpBoot\DB\Context $context
29
+     */
27 30
     public function __construct($context){
28 31
         parent::__construct($context);
29 32
         $this->impl = new UpdateSetImpl();
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 class UpdateSetRule extends WhereRule
26 26
 {
27
-    public function __construct($context){
27
+    public function __construct($context) {
28 28
         parent::__construct($context);
29 29
         $this->impl = new UpdateSetImpl();
30 30
     }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      * @param mixed $_
38 38
      * @return \PhpBoot\DB\rules\update\UpdateSetRule
39 39
      */
40
-    public function set($expr, $_=null) {
40
+    public function set($expr, $_ = null) {
41 41
         $this->impl->set($this->context, $expr, array_slice(func_get_args(), 1));
42 42
         return $this;
43 43
     }
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.