Conditions | 8 |
Paths | 65 |
Total Lines | 26 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
28 | public function sql():string{ |
||
29 | |||
30 | if(empty($this->from)){ |
||
31 | throw new QueryException('no FROM expression specified'); |
||
32 | } |
||
33 | |||
34 | # print_r([$this->cols, $this->from, $this->orderby, $this->groupby, $this->where]); |
||
|
|||
35 | |||
36 | $glue = ','.PHP_EOL."\t"; |
||
37 | # var_dump($this->bindValues()); |
||
38 | |||
39 | if(is_null($this->offset)){ |
||
40 | $this->offset = 0; |
||
41 | } |
||
42 | |||
43 | $sql = 'SELECT '; |
||
44 | $sql .= $this->limit ? 'FIRST ? SKIP ? ' : ''; |
||
45 | $sql .= $this->distinct ? 'DISTINCT ' : ''; |
||
46 | $sql .= !empty($this->cols) ? implode($glue , $this->cols).PHP_EOL : '* '; |
||
47 | $sql .= 'FROM '.implode($glue , $this->from); |
||
48 | $sql .= $this->_getWhere(); |
||
49 | $sql .= !empty($this->groupby) ? PHP_EOL.'GROUP BY '.implode($glue, $this->groupby) : ''; |
||
50 | $sql .= !empty($this->orderby) ? PHP_EOL.'ORDER BY '.implode($glue, $this->orderby) : ''; |
||
51 | |||
52 | return $sql; |
||
53 | } |
||
54 | |||
57 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.