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 ( 37c075...91da2e )
by cao
03:14
created
src/DB/impls.php 2 patches
Doc Comments   +84 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,6 +8,11 @@  discard block
 block discarded – undo
8 8
 use PhpBoot\DB\Context;
9 9
 
10 10
 class ExecResult{
11
+
12
+    /**
13
+     * @param \PDO $pdo
14
+     * @param \PDOStatement $st
15
+     */
11 16
     public function __construct($success, $pdo, $st){
12 17
         $this->pdo = $pdo;
13 18
         $this->st = $st;
@@ -41,6 +46,10 @@  discard block
 block discarded – undo
41 46
 
42 47
 class SelectImpl
43 48
 {
49
+    /**
50
+     * @param Context $context
51
+     * @param string $columns
52
+     */
44 53
     static  public function select($context, $columns){
45 54
         $context->appendSql("SELECT $columns");
46 55
     }
@@ -48,6 +57,10 @@  discard block
 block discarded – undo
48 57
 
49 58
 class FromImpl
50 59
 {
60
+    /**
61
+     * @param Context $context
62
+     * @param string $tables
63
+     */
51 64
     static public function from($context, $tables,$as=null){
52 65
         if($tables instanceof BasicRule){
53 66
             $context->appendSql("FROM (".$tables->context->sql.')');
@@ -63,6 +76,10 @@  discard block
 block discarded – undo
63 76
 
64 77
 class DeleteImpl
65 78
 {
79
+    /**
80
+     * @param Context $context
81
+     * @param string $from
82
+     */
66 83
     static public function deleteFrom($context, $from)
67 84
     {
68 85
         $context->appendSql("DELETE FROM ".DB::wrap($from));
@@ -71,6 +88,11 @@  discard block
 block discarded – undo
71 88
 
72 89
 class JoinImpl
73 90
 {
91
+    /**
92
+     * @param Context $context
93
+     * @param null|string $type
94
+     * @param string $table
95
+     */
74 96
     static public function join($context, $type, $table) {
75 97
         $table = DB::wrap($table);
76 98
         if($type){
@@ -83,6 +105,10 @@  discard block
 block discarded – undo
83 105
 
84 106
 class JoinOnImpl
85 107
 {
108
+    /**
109
+     * @param Context $context
110
+     * @param string $condition
111
+     */
86 112
     static public function on($context, $condition) {
87 113
         $context->appendSql("ON $condition");
88 114
     }
@@ -90,6 +116,9 @@  discard block
 block discarded – undo
90 116
 
91 117
 class ForUpdateImpl
92 118
 {
119
+    /**
120
+     * @param Context $context
121
+     */
93 122
     static public function forUpdate($context){
94 123
         $context->appendSql("FOR UPDATE");
95 124
     }
@@ -97,6 +126,10 @@  discard block
 block discarded – undo
97 126
 
98 127
 class ForUpdateOfImpl
99 128
 {
129
+    /**
130
+     * @param Context $context
131
+     * @param string $column
132
+     */
100 133
     static public function of($context, $column){
101 134
         $column = DB::wrap($column);
102 135
         $context->appendSql("OF $column");
@@ -105,6 +138,10 @@  discard block
 block discarded – undo
105 138
 
106 139
 class InsertImpl
107 140
 {
141
+    /**
142
+     * @param Context $context
143
+     * @param string $table
144
+     */
108 145
     static public function insertInto($context, $table) {
109 146
         $table = DB::wrap($table);
110 147
         $context->appendSql("INSERT INTO $table");
@@ -112,6 +149,10 @@  discard block
 block discarded – undo
112 149
 }
113 150
 class ReplaceImpl
114 151
 {
152
+    /**
153
+     * @param Context $context
154
+     * @param string $table
155
+     */
115 156
     static public function replaceInto($context, $table) {
116 157
         $table = DB::wrap($table);
117 158
         $context->appendSql("REPLACE INTO $table");
@@ -119,6 +160,9 @@  discard block
 block discarded – undo
119 160
 }
120 161
 class ValuesImpl
121 162
 {
163
+    /**
164
+     * @param Context $context
165
+     */
122 166
     static public function values($context, $values){
123 167
         $params = [];
124 168
         $stubs = [];
@@ -148,6 +192,10 @@  discard block
 block discarded – undo
148 192
 
149 193
 class UpdateImpl
150 194
 {
195
+    /**
196
+     * @param Context $context
197
+     * @param string $table
198
+     */
151 199
     static public function update($context, $table){
152 200
         $table = DB::wrap($table);
153 201
         $context->appendSql("UPDATE $table");
@@ -164,6 +212,9 @@  discard block
 block discarded – undo
164 212
         }
165 213
     }
166 214
 
215
+    /**
216
+     * @param string $expr
217
+     */
167 218
     public function setExpr(Context $context, $expr, $args){
168 219
         if($this->first){
169 220
             $this->first = false;
@@ -226,6 +277,11 @@  discard block
 block discarded – undo
226 277
         }
227 278
         return $this;
228 279
     }
280
+
281
+    /**
282
+     * @param string $column
283
+     * @param string $order
284
+     */
229 285
     public function orderBy(Context $context, $column, $order=null){
230 286
         if(is_string($column)){
231 287
             if($order === null){
@@ -243,12 +299,20 @@  discard block
 block discarded – undo
243 299
 
244 300
 class LimitImpl
245 301
 {
302
+    /**
303
+     * @param integer $size
304
+     */
246 305
     static public function limit(Context $context, $size){
247 306
         $intSize = intval($size);
248 307
         strval($intSize) == $size or \PhpBoot\abort(
249 308
             new \InvalidArgumentException("invalid params for limit($size)"));
250 309
         $context->appendSql("LIMIT $size");
251 310
     }
311
+
312
+    /**
313
+     * @param integer $start
314
+     * @param integer $size
315
+     */
252 316
     static public function limitWithOffset(Context $context, $start, $size){
253 317
         $intStart = intval($start);
254 318
         $intSize = intval($size);
@@ -260,6 +324,9 @@  discard block
 block discarded – undo
260 324
 
261 325
 class WhereImpl{
262 326
 
327
+    /**
328
+     * @param string $str
329
+     */
263 330
     static private function findQ($str,$offset = 0,$no=0){
264 331
         $found = strpos($str, '?', $offset);
265 332
         if($no == 0 || $found === false){
@@ -268,6 +335,9 @@  discard block
 block discarded – undo
268 335
         return self::findQ($str, $found+1, $no-1);
269 336
     }
270 337
 
338
+    /**
339
+     * @param string $prefix
340
+     */
271 341
     static public function where(Context $context, $prefix, $expr, $args){
272 342
         if(empty($expr)){
273 343
             return;
@@ -373,6 +443,10 @@  discard block
 block discarded – undo
373 443
 
374 444
         self::condition($context, $prefix, implode(' AND ', $exprs), $params);
375 445
     }
446
+
447
+    /**
448
+     * @param string $expr
449
+     */
376 450
     static public function condition(Context $context, $prefix, $expr, $args){
377 451
         if(!empty($expr)){
378 452
             $expr = "($expr)";
@@ -441,6 +515,10 @@  discard block
 block discarded – undo
441 515
 }
442 516
 
443 517
 class GroupByImpl{
518
+
519
+    /**
520
+     * @param string $column
521
+     */
444 522
     static public function groupBy(Context $context, $column){
445 523
         $column = DB::wrap($column);
446 524
         $context->appendSql("GROUP BY $column");
@@ -463,7 +541,6 @@  discard block
 block discarded – undo
463 541
     /**
464 542
      *
465 543
      * @param Context $context
466
-     * @param string|false $asDict return  as dict or array
467 544
      * @return false|array
468 545
      */
469 546
     static public function get($context, $dictAs=false){
@@ -522,6 +599,9 @@  discard block
 block discarded – undo
522 599
 }
523 600
 class OnDuplicateKeyUpdateImpl
524 601
 {
602
+    /**
603
+     * @param Context $context
604
+     */
525 605
     public function set($context, $column, $value){
526 606
         if(is_string($column)){
527 607
             $this->setExpr($context, $column, $value);
@@ -530,6 +610,9 @@  discard block
 block discarded – undo
530 610
         }
531 611
     }
532 612
 
613
+    /**
614
+     * @param string $expr
615
+     */
533 616
     public function setExpr($context, $expr, $args){
534 617
         $prefix = '';
535 618
         if($this->first){
Please login to merge, or discard this patch.
Braces   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         if($tables instanceof BasicRule){
53 53
             $context->appendSql("FROM (".$tables->context->sql.')');
54 54
             $context->params = array_merge($context->params,$tables->context->params);
55
-        }else {
55
+        } else {
56 56
             $context->appendSql("FROM ".DB::wrap($tables));
57 57
         }
58 58
         if($as){
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         $table = DB::wrap($table);
76 76
         if($type){
77 77
             $context->appendSql("$type JOIN $table");
78
-        }else{
78
+        } else{
79 79
             $context->appendSql("JOIN $table");
80 80
         }
81 81
     }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         foreach ($values as $v){
126 126
             if(is_a($v, Raw::class)){//直接拼接sql,不需要转义
127 127
                 $stubs[]=$v->get();
128
-            }else{
128
+            } else{
129 129
                 $stubs[]='?';
130 130
                 $params[] = $v;
131 131
             }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             //VALUES(val0, val1, val2)
137 137
             $context->appendSql("VALUES($stubs)");
138 138
 
139
-        }else{
139
+        } else{
140 140
             //(col0, col1, col2) VALUES(val0, val1, val2)
141 141
             $columns = implode(',', array_map(function($k){return DB::wrap($k);}, array_keys($values)));
142 142
             $context->appendSql("($columns) VALUES($stubs)",false);
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     public function set(Context $context, $expr, $args){
160 160
         if(is_string($expr)){
161 161
             return $this->setExpr($context, $expr, $args);
162
-        }else{
162
+        } else{
163 163
             return $this->setArgs($context, $expr);
164 164
         }
165 165
     }
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         if($this->first){
169 169
             $this->first = false;
170 170
             $prefix = 'SET ';
171
-        }else{
171
+        } else{
172 172
             $prefix = ',';
173 173
         }
174 174
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
             $k = DB::wrap($k);
184 184
             if(is_a($v, Raw::class)){//直接拼接sql,不需要转义
185 185
                 $set[]= "$k=".$v->get();
186
-            }else{
186
+            } else{
187 187
                 $set[]= "$k=?";
188 188
                 $params[]=$v;
189 189
             }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
             $this->first = false;
193 193
             $context->appendSql('SET '.implode(',', $set));
194 194
             $context->appendParams($params);
195
-        }else{
195
+        } else{
196 196
             $context->appendSql(','.implode(',', $set),false);
197 197
             $context->appendParams($params);
198 198
         }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
         foreach ($orders as $k=>$v){
210 210
             if(is_integer($k)){
211 211
                 $params[] = DB::wrap($v);
212
-            }else{
212
+            } else{
213 213
                 $k = DB::wrap($k);
214 214
 
215 215
                 $v = strtoupper($v);
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         if($this->first){
222 222
             $this->first = false;
223 223
             $context->appendSql('ORDER BY '.implode(',', $params));
224
-        }else{
224
+        } else{
225 225
             $context->appendSql(','.implode(',', $params),false);
226 226
         }
227 227
         return $this;
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
         if(is_string($column)){
231 231
             if($order === null){
232 232
                 $column = [$column];
233
-            }else{
233
+            } else{
234 234
                 $column = [$column=>$order];
235 235
             }
236 236
         }
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
         }
275 275
         if(is_callable($expr)){
276 276
             self::conditionClosure($context,$prefix, $expr);
277
-        }elseif (is_string($expr)){
277
+        } elseif (is_string($expr)){
278 278
             self::condition($context, $prefix, $expr, $args);
279
-        }else{
279
+        } else{
280 280
             self::conditionArgs($context, $prefix, $expr);
281 281
         }
282 282
 
@@ -330,41 +330,41 @@  discard block
 block discarded – undo
330 330
                     foreach ($var as $i){
331 331
                         if(is_a($i, Raw::class)){
332 332
                             $stubs[]=strval($i);
333
-                        }else{
333
+                        } else{
334 334
                             $stubs[]='?';
335 335
                             $params[] = $i;
336 336
                         }
337 337
                     }
338 338
                     $stubs = implode(',', $stubs);
339 339
                     $exprs[] = "$k $op ($stubs)";
340
-                }else if($op == 'BETWEEN'){
340
+                } else if($op == 'BETWEEN'){
341 341
                     $cond = "$k BETWEEN";
342 342
                     if(is_a($var[0], Raw::class)){
343 343
                         $cond = "$cond ".strval($var[0]);
344
-                    }else{
344
+                    } else{
345 345
                         $cond = "$cond ?";
346 346
                         $params[] = $var[0];
347 347
                     }
348 348
                     if(is_a($var[1], Raw::class)){
349 349
                         $cond = "$cond AND ".strval($var[1]);
350
-                    }else{
350
+                    } else{
351 351
                         $cond = "$cond AND ?";
352 352
                         $params[] = $var[1];
353 353
                     }
354 354
                     $exprs[] = $cond;
355
-                }else{
355
+                } else{
356 356
                     if(is_a($var, Raw::class)){
357 357
                         $exprs[] = "$k $op ".strval($var);
358
-                    }else{
358
+                    } else{
359 359
                         $exprs[] = "$k $op ?";
360 360
                         $params[] = $var;
361 361
                     }
362 362
                 }
363
-            }else{
363
+            } else{
364 364
                 if(is_a($v, Raw::class)){
365 365
                     $exprs[] = "$k = ".strval($v);
366 366
 
367
-                }else{
367
+                } else{
368 368
                     $exprs[] = "$k = ?";
369 369
                     $params[] = $v;
370 370
                 }
@@ -402,18 +402,18 @@  discard block
 block discarded – undo
402 402
                             foreach ($arg as $i){
403 403
                                 if(is_a($i, Raw::class)){
404 404
                                     $stubs[] = strval($i);
405
-                                }else{
405
+                                } else{
406 406
                                     $stubs[] = '?';
407 407
                                     $newArgs[] = $i;
408 408
                                 }
409 409
                             }
410 410
                             $stubs = implode(',', $stubs);
411
-                        }else{
411
+                        } else{
412 412
                             $stubs = strval($arg);
413 413
                         }
414 414
                         $toReplace[] = [$pos, $stubs];
415 415
 
416
-                    }else{
416
+                    } else{
417 417
                         $newArgs[]=$arg;
418 418
                     }
419 419
                 }
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
             }
430 430
             if($prefix){
431 431
                 $context->appendSql($prefix.' '.$expr);
432
-            }else{
432
+            } else{
433 433
                 $context->appendSql($expr);
434 434
             }
435 435
 
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
                 return $context->handleResult($dict);
480 480
             }
481 481
             return $context->handleResult($res);
482
-        }else{
482
+        } else{
483 483
             return false;
484 484
         }
485 485
     }
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
         if(!preg_match('/\bfrom\b/i', $context->sql, $found, PREG_OFFSET_CAPTURE) ||
504 504
             count($found)==0){
505 505
             $columnEnd = strlen($context->sql);
506
-        }else{
506
+        } else{
507 507
             list($chars, $columnEnd) = $found[0];
508 508
         }
509 509
         $sql = substr($context->sql, 0, $columnBegin);
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
         if($st->execute($context->params)){
515 515
             $res = $st->fetchAll(\PDO::FETCH_ASSOC);
516 516
             return $res[0]['count'];
517
-        }else{
517
+        } else{
518 518
             return false;
519 519
         }
520 520
 
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
     public function set($context, $column, $value){
526 526
         if(is_string($column)){
527 527
             $this->setExpr($context, $column, $value);
528
-        }else{
528
+        } else{
529 529
             $this->setArgs($context, $column);
530 530
         }
531 531
     }
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
         if($this->first){
536 536
             $this->first = false;
537 537
             $prefix = 'ON DUPLICATE KEY UPDATE ';
538
-        }else{
538
+        } else{
539 539
             $prefix = ',';
540 540
         }
541 541
 
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
             $k = DB::wrap($k);
551 551
             if(is_a($v, Raw::class)){//直接拼接sql,不需要转义
552 552
                 $set[]= "$k=".$v->get();
553
-            }else{
553
+            } else{
554 554
                 $set[]= "$k=?";
555 555
                 $params[]=$v;
556 556
             }
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
             $this->first = false;
560 560
             $context->appendSql('ON DUPLICATE KEY UPDATE '.implode(',', $set));
561 561
             $context->appendParams($params);
562
-        }else{
562
+        } else{
563 563
             $context->appendSql(','.implode(',', $set),false);
564 564
             $context->appendParams($params);
565 565
         }
Please login to merge, or discard this patch.
src/DB/rules/basic.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -48,6 +48,9 @@
 block discarded – undo
48 48
 
49 49
 class OrderByRule extends LimitRule
50 50
 {
51
+    /**
52
+     * @param Context $context
53
+     */
51 54
     public function __construct($context){
52 55
         parent::__construct($context);
53 56
         $this->impl = new OrderByImpl();
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         }
106 106
         if($this->isTheFirst){
107 107
             WhereImpl::where($this->context, 'WHERE' ,$conditions, array_slice(func_get_args(), 1));
108
-        }else{
108
+        } else{
109 109
             WhereImpl::where($this->context, 'AND', $conditions, array_slice(func_get_args(), 1));
110 110
         }
111 111
         return new WhereRule($this->context, false);
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         }
167 167
         if($this->isTheFirst){
168 168
             WhereImpl::where($this->context, '', $expr, array_slice(func_get_args(), 1));
169
-        }else{
169
+        } else{
170 170
             WhereImpl::where($this->context, 'AND', $expr, array_slice(func_get_args(), 1));
171 171
         }
172 172
         return new SubQuery($this->context, false);
Please login to merge, or discard this patch.
src/DB/rules/select.php 2 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,6 +113,9 @@  discard block
 block discarded – undo
113 113
 
114 114
 class OrderByRule extends LimitRule
115 115
 {
116
+    /**
117
+     * @param Context $context
118
+     */
116 119
     public function __construct($context){
117 120
         parent::__construct($context);
118 121
         $this->order = new OrderByImpl();
@@ -260,7 +263,7 @@  discard block
 block discarded – undo
260 263
      *      "WHERE a=1 AND b IN(1,2) AND c BETWEEN 1 AND 2 AND d<>1"
261 264
      *
262 265
      * @param string|array|callable $conditions
263
-     * @param mixed $_
266
+     * @param string $_
264 267
      * @return \PhpBoot\DB\rules\select\WhereRule
265 268
      */
266 269
     public function where($conditions=null, $_=null) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
         }
185 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
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
         }
274 274
         if($this->isTheFirst){
275 275
             WhereImpl::where($this->context, 'WHERE' ,$conditions, array_slice(func_get_args(), 1));
276
-        }else{
276
+        } else{
277 277
             WhereImpl::where($this->context, 'AND', $conditions, array_slice(func_get_args(), 1));
278 278
         }
279 279
         return new WhereRule($this->context, false);
Please login to merge, or discard this patch.
src/DB/rules/update.php 1 patch
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 BasicRule
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.