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 ( 1e9f36...59f2d0 )
by cao
10:57 queued 06:00
created
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.
src/Validator/Validator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,12 +55,12 @@
 block discarded – undo
55 55
      */
56 56
     public function rule($rule, $fields)
57 57
     {
58
-        if(is_string($rule)){
58
+        if (is_string($rule)) {
59 59
             $rules = explode('|', $rule);
60
-            foreach ($rules as $r){
60
+            foreach ($rules as $r) {
61 61
                 $params = explode(':', trim($r));
62 62
                 $rule = $params[0];
63
-                $params = isset($params[1])?explode(',', $params[1]):[];
63
+                $params = isset($params[1]) ?explode(',', $params[1]) : [];
64 64
 
65 65
                 call_user_func_array([$this, 'parent::rule'], array_merge([$rule, $fields], $params));
66 66
 
Please login to merge, or discard this patch.
src/ORM/ModelWithClass.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
             ->from($this->entity->getTable())
30 30
             ->where("`{$this->entity->getPK()}` = ?", $id)
31 31
             ->getFirst();
32
-        if($row){
32
+        if ($row) {
33 33
             return $this->entity->make($row, false);
34
-        }else{
34
+        }else {
35 35
             return null;
36 36
         }
37 37
     }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @param mixed|null $_
54 54
      * @return \PhpBoot\DB\rules\basic\WhereRule
55 55
      */
56
-    public function deleteWhere($conditions, $_=null)
56
+    public function deleteWhere($conditions, $_ = null)
57 57
     {
58 58
         $query = $this->db->deleteFrom($this->entity->getTable());
59 59
         return call_user_func_array([$query, 'where'], func_get_args());
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
      * @param string $_
76 76
      * @return \PhpBoot\DB\rules\select\WhereRule
77 77
      */
78
-    public function findWhere($conditions=null, $_=null)
78
+    public function findWhere($conditions = null, $_ = null)
79 79
     {
80
-        $query =  $this->db->select($this->getColumns())
80
+        $query = $this->db->select($this->getColumns())
81 81
             ->from($this->entity->getTable());
82
-        $query->context->resultHandler = function ($result){
83
-            foreach ($result as &$i){
82
+        $query->context->resultHandler = function($result) {
83
+            foreach ($result as &$i) {
84 84
                 $i = $this->entity->make($i, false);
85 85
             }
86 86
             return $result;
@@ -107,16 +107,16 @@  discard block
 block discarded – undo
107 107
      * @param string $_
108 108
      * @return \PhpBoot\DB\rules\basic\WhereRule
109 109
      */
110
-    public function updateWhere($values, $conditions, $_=null)
110
+    public function updateWhere($values, $conditions, $_ = null)
111 111
     {
112
-        $query =  $this->db->update($this->entity->getTable())->set($values);
113
-        return call_user_func_array([$query, 'where'], array_slice(func_get_args(),1));
112
+        $query = $this->db->update($this->entity->getTable())->set($values);
113
+        return call_user_func_array([$query, 'where'], array_slice(func_get_args(), 1));
114 114
     }
115 115
 
116 116
     protected function getColumns()
117 117
     {
118 118
         $columns = [];
119
-        foreach ($this->entity->getProperties() as $p){
119
+        foreach ($this->entity->getProperties() as $p) {
120 120
             $columns[] = $p->name;
121 121
         }
122 122
         return $columns;
Please login to merge, or discard this patch.
src/DB/DB.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
  *      
51 51
  * @author caoym <[email protected]>
52 52
  */
53
-class DB{
53
+class DB {
54 54
 
55 55
     /**
56 56
      * DB constructor.
@@ -90,18 +90,18 @@  discard block
 block discarded – undo
90 90
      * @param string $column0
91 91
      * @return \PhpBoot\DB\rules\select\FromRule
92 92
      */
93
-    function select($column0=null, $_=null){
93
+    function select($column0 = null, $_ = null) {
94 94
         $obj = new SelectRule(new Context($this->connection));
95
-        if($column0 == null){
95
+        if ($column0 == null) {
96 96
             $args = ['*'];
97
-        }elseif(is_array($column0)){
97
+        }elseif (is_array($column0)) {
98 98
             $args = $column0;
99
-        }else{
99
+        }else {
100 100
             $args = func_get_args();
101 101
         }
102
-        foreach ($args as &$arg){
102
+        foreach ($args as &$arg) {
103 103
             $arg = DB::wrap($arg);
104
-            if($arg == '*'){
104
+            if ($arg == '*') {
105 105
                 continue;
106 106
             }
107 107
         }
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
      * @param string $table
133 133
      * @return \PhpBoot\DB\rules\basic\WhereRule
134 134
      */
135
-    public function deleteFrom($table){
136
-        $obj  =  new DeleteRule(new Context($this->connection));
135
+    public function deleteFrom($table) {
136
+        $obj = new DeleteRule(new Context($this->connection));
137 137
         return $obj->deleteFrom($table);
138 138
     }
139 139
     /**
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
      * @param string $table
142 142
      * @return \PhpBoot\DB\rules\replace\ValuesRule
143 143
      */
144
-    public function replaceInto($table){
145
-        $obj  =  new ReplaceIntoRule(new Context($this->connection));
144
+    public function replaceInto($table) {
145
+        $obj = new ReplaceIntoRule(new Context($this->connection));
146 146
         return $obj->replaceInto($table);
147 147
     }
148 148
 
@@ -153,16 +153,16 @@  discard block
 block discarded – undo
153 153
      */
154 154
     public function transaction(callable $callback)
155 155
     {
156
-        if($this->inTransaction){
156
+        if ($this->inTransaction) {
157 157
             return $callback($this);
158 158
         }
159 159
         $this->getConnection()->beginTransaction() or \PhpBoot\abort('beginTransaction failed');
160 160
         $this->inTransaction = true;
161
-        try{
161
+        try {
162 162
             $res = $callback($this);
163 163
             $this->getConnection()->commit() or \PhpBoot\abort('commit failed');
164 164
             return $res;
165
-        }catch (\Exception $e){
165
+        }catch (\Exception $e) {
166 166
             $this->getConnection()->rollBack();
167 167
             Logger::warning('commit failed with '.get_class($e).' '.$e->getMessage());
168 168
             throw $e;
@@ -183,12 +183,12 @@  discard block
 block discarded – undo
183 183
      * @param string $str
184 184
      * @return Raw
185 185
      */
186
-    static public function raw($str){
186
+    static public function raw($str) {
187 187
         return new Raw($str);
188 188
     }
189 189
     static public function wrap($value)
190 190
     {
191
-        if($value instanceof Raw){
191
+        if ($value instanceof Raw) {
192 192
             return $value->get();
193 193
         }
194 194
         $value = trim($value);
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             return $value;
197 197
         }
198 198
 
199
-        if(strpos($value, '.') !== false && !preg_match('/\\s+/', $value)){
199
+        if (strpos($value, '.') !== false && !preg_match('/\\s+/', $value)) {
200 200
             return $value;
201 201
         }
202 202
         return '`'.str_replace('`', '``', $value).'`';
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
     {
210 210
         return $this->app;
211 211
     }
212
-    const ORDER_BY_ASC ='ASC';
213
-    const ORDER_BY_DESC ='DESC';
212
+    const ORDER_BY_ASC = 'ASC';
213
+    const ORDER_BY_DESC = 'DESC';
214 214
 
215 215
     /**
216 216
      * @var \PDO
Please login to merge, or discard this patch.
src/DB/rules/select.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      * @param string|false $asDict
40 40
      * @return array
41 41
      */
42
-    public function get($asDict=false) {
42
+    public function get($asDict = false) {
43 43
         return ExecImpl::get($this->context, $asDict);
44 44
     }
45 45
 
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
      * Execute sql and get one response
54 54
      * @return null
55 55
      */
56
-    public function getFirst(){
56
+    public function getFirst() {
57 57
         $res = ExecImpl::get($this->context);
58
-        if(count($res)){
58
+        if (count($res)) {
59 59
             return $res[0];
60 60
         }
61 61
         return null;
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
      * @param string $table
69 69
      * @return \PhpBoot\DB\rules\select\JoinRule
70 70
      */
71
-    public function from($table, $as=null){
72
-        FromImpl::from($this->context, $table,$as);
71
+    public function from($table, $as = null) {
72
+        FromImpl::from($this->context, $table, $as);
73 73
         return new JoinRule($this->context);
74 74
     }
75 75
 }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      * @param string $column
81 81
      * @return \PhpBoot\DB\rules\select\GetRule
82 82
      */
83
-    public function of($column){
83
+    public function of($column) {
84 84
         ForUpdateOfImpl::of($this->context, $column);
85 85
         return new GetRule($this->context);
86 86
     }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      * forUpdate() => 'FOR UPDATE'
92 92
      * @return \PhpBoot\DB\rules\select\ForUpdateOfRule
93 93
      */
94
-    public function forUpdate(){
94
+    public function forUpdate() {
95 95
         ForUpdateImpl::forUpdate($this->context);
96 96
         return new ForUpdateOfRule($this->context);
97 97
     }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
 class OrderByRule extends LimitRule
115 115
 {
116
-    public function __construct($context){
116
+    public function __construct($context) {
117 117
         parent::__construct($context);
118 118
         $this->order = new OrderByImpl();
119 119
     }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      * @param string $order Sql::ORDER_BY_ASC or Sql::ORDER_BY_DESC
129 129
      * @return \PhpBoot\DB\rules\select\OrderByRule
130 130
      */
131
-    public function orderBy($column, $order=null) {
131
+    public function orderBy($column, $order = null) {
132 132
         $this->order->orderBy($this->context, $column, $order);
133 133
         return $this;
134 134
     }
@@ -174,17 +174,17 @@  discard block
 block discarded – undo
174 174
      * @param string $_
175 175
      * @return \PhpBoot\DB\rules\select\HavingRule
176 176
      */
177
-    public function having($expr, $_=null) {
178
-        if(is_callable($expr)){
179
-            $callback = function ($context)use($expr){
177
+    public function having($expr, $_ = null) {
178
+        if (is_callable($expr)) {
179
+            $callback = function($context)use($expr){
180 180
                 $rule = new ScopedQuery($context);
181 181
                 $expr($rule);
182 182
             };
183 183
             $expr = $callback;
184 184
         }
185
-        if($this->isTheFirst){
185
+        if ($this->isTheFirst) {
186 186
             WhereImpl::where($this->context, 'HAVING', $expr, array_slice(func_get_args(), 1));
187
-        }else{
187
+        }else {
188 188
             WhereImpl::where($this->context, 'AND', $expr, array_slice(func_get_args(), 1));
189 189
         }
190 190
 
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
      * @param string $_
212 212
      * @return \PhpBoot\DB\rules\select\HavingRule
213 213
      */
214
-    public function orHaving($expr, $_=null) {
215
-        if(is_callable($expr)){
216
-            $callback = function ($context)use($expr){
214
+    public function orHaving($expr, $_ = null) {
215
+        if (is_callable($expr)) {
216
+            $callback = function($context)use($expr){
217 217
                 $rule = new ScopedQuery($context);
218 218
                 $expr($rule);
219 219
             };
@@ -263,17 +263,17 @@  discard block
 block discarded – undo
263 263
      * @param mixed $_
264 264
      * @return \PhpBoot\DB\rules\select\NextWhereRule
265 265
      */
266
-    public function where($conditions=null, $_=null) {
267
-        if(is_callable($conditions)){
268
-            $callback = function ($context)use($conditions){
266
+    public function where($conditions = null, $_ = null) {
267
+        if (is_callable($conditions)) {
268
+            $callback = function($context)use($conditions){
269 269
                 $rule = new ScopedQuery($context);
270 270
                 $conditions($rule);
271 271
             };
272 272
             $conditions = $callback;
273 273
         }
274
-        if($this->isTheFirst){
275
-            WhereImpl::where($this->context, 'WHERE' ,$conditions, array_slice(func_get_args(), 1));
276
-        }else{
274
+        if ($this->isTheFirst) {
275
+            WhereImpl::where($this->context, 'WHERE', $conditions, array_slice(func_get_args(), 1));
276
+        }else {
277 277
             WhereImpl::where($this->context, 'AND', $conditions, array_slice(func_get_args(), 1));
278 278
         }
279 279
         return new NextWhereRule($this->context, false);
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
      *
305 305
      * @TODO orWhere 只能跟在 Where 后
306 306
      */
307
-    public function orWhere($conditions=null, $_=null) {
308
-        if(is_callable($conditions)){
309
-            $callback = function ($context)use($conditions){
307
+    public function orWhere($conditions = null, $_ = null) {
308
+        if (is_callable($conditions)) {
309
+            $callback = function($context)use($conditions){
310 310
                 $rule = new ScopedQuery($context);
311 311
                 $conditions($rule);
312 312
             };
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
      * @param string $table
326 326
      * @return \PhpBoot\DB\rules\select\JoinOnRule
327 327
      */
328
-    public function join($table){
329
-        JoinImpl::join($this->context,null, $table);
328
+    public function join($table) {
329
+        JoinImpl::join($this->context, null, $table);
330 330
         return new JoinOnRule($this->context);
331 331
     }
332 332
     /**
@@ -334,8 +334,8 @@  discard block
 block discarded – undo
334 334
      * @param string $table
335 335
      * @return \PhpBoot\DB\rules\select\JoinOnRule
336 336
      */
337
-    public function leftJoin($table){
338
-        JoinImpl::join($this->context,'LEFT', $table);
337
+    public function leftJoin($table) {
338
+        JoinImpl::join($this->context, 'LEFT', $table);
339 339
         return new JoinOnRule($this->context);
340 340
     }
341 341
     /**
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
      * @return \PhpBoot\DB\rules\select\JoinOnRule
345 345
      */
346 346
     public function rightJoin($table) {
347
-        JoinImpl::join($this->context,'RIGHT', $table);
347
+        JoinImpl::join($this->context, 'RIGHT', $table);
348 348
         return new JoinOnRule($this->context);
349 349
     }
350 350
     /**
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
      * @return \PhpBoot\DB\rules\select\JoinOnRule
354 354
      */
355 355
     public function innerJoin($table) {
356
-        JoinImpl::join($this->context,'INNER', $table);
356
+        JoinImpl::join($this->context, 'INNER', $table);
357 357
         return new JoinOnRule($this->context);
358 358
     }
359 359
 }
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
      * @param string $condition
366 366
      * @return \PhpBoot\DB\rules\select\JoinRule
367 367
      */
368
-    public function on($condition){
368
+    public function on($condition) {
369 369
         JoinOnImpl::on($this->context, $condition);
370 370
         return new JoinRule($this->context);
371 371
     }
Please login to merge, or discard this patch.
src/DB/rules/basic.php 1 patch
Spacing   +20 added lines, -20 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
     }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      * 
64 64
      * @return \PhpBoot\DB\rules\basic\LimitRule
65 65
      */
66
-    public function orderBy($column, $order=null) {
66
+    public function orderBy($column, $order = null) {
67 67
         $this->impl->orderBy($this->context, $column, $order);
68 68
         return new LimitRule($this->context);
69 69
     }
@@ -95,17 +95,17 @@  discard block
 block discarded – undo
95 95
      * @param mixed $_
96 96
      * @return NextWhereRule
97 97
      */
98
-    public function where($conditions=null, $_=null) {
99
-        if(is_callable($conditions)){
100
-            $callback = function ($context)use($conditions){
98
+    public function where($conditions = null, $_ = null) {
99
+        if (is_callable($conditions)) {
100
+            $callback = function($context)use($conditions){
101 101
                 $rule = new ScopedQuery($context);
102 102
                 $conditions($rule);
103 103
             };
104 104
             $conditions = $callback;
105 105
         }
106
-        if($this->isTheFirst){
107
-            WhereImpl::where($this->context, 'WHERE' ,$conditions, array_slice(func_get_args(), 1));
108
-        }else{
106
+        if ($this->isTheFirst) {
107
+            WhereImpl::where($this->context, 'WHERE', $conditions, array_slice(func_get_args(), 1));
108
+        }else {
109 109
             WhereImpl::where($this->context, 'AND', $conditions, array_slice(func_get_args(), 1));
110 110
         }
111 111
         return new NextWhereRule($this->context, false);
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
      * @param mixed $_
134 134
      * @return WhereRule
135 135
      */
136
-    public function orWhere($conditions=null, $_=null) {
137
-        if(is_callable($conditions)){
138
-            $callback = function ($context)use($conditions){
136
+    public function orWhere($conditions = null, $_ = null) {
137
+        if (is_callable($conditions)) {
138
+            $callback = function($context)use($conditions){
139 139
                 $rule = new ScopedQuery($context);
140 140
                 $conditions($rule);
141 141
             };
@@ -160,17 +160,17 @@  discard block
 block discarded – undo
160 160
      * @param null $_
161 161
      * @return NextScopedQuery
162 162
      */
163
-    public function where($expr, $_= null){
164
-        if(is_callable($expr)){
165
-            $callback = function ($context)use($expr){
163
+    public function where($expr, $_ = null) {
164
+        if (is_callable($expr)) {
165
+            $callback = function($context)use($expr){
166 166
                 $rule = new ScopedQuery($context, true);
167 167
                 $expr($rule);
168 168
             };
169 169
             $expr = $callback;
170 170
         }
171
-        if($this->isTheFirst){
171
+        if ($this->isTheFirst) {
172 172
             WhereImpl::where($this->context, '', $expr, array_slice(func_get_args(), 1));
173
-        }else{
173
+        }else {
174 174
             WhereImpl::where($this->context, 'AND', $expr, array_slice(func_get_args(), 1));
175 175
         }
176 176
         return new NextScopedQuery($this->context, false);
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
      * @param null $_
187 187
      * @return ScopedQuery
188 188
      */
189
-    public function orWhere($expr, $_= null){
190
-        if(is_callable($expr)){
191
-            $callback = function ($context)use($expr){
189
+    public function orWhere($expr, $_ = null) {
190
+        if (is_callable($expr)) {
191
+            $callback = function($context)use($expr){
192 192
                 $rule = new ScopedQuery($context, true);
193 193
                 $expr($rule);
194 194
             };
Please login to merge, or discard this patch.