| Conditions | 7 |
| Paths | 64 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 7 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 54 | 78 | public function __toString(): string |
|
| 55 | { |
||
| 56 | 78 | $expression = ($this->calcFoundRows ? 'SQL_CALC_FOUND_ROWS ' : '') . $this->expression; |
|
| 57 | |||
| 58 | 78 | if (isset($this->tableAlias)) { |
|
| 59 | 17 | $from = sprintf('`%s` AS `%s`', $this->table, $this->tableAlias); |
|
| 60 | } else { |
||
| 61 | 71 | $from = sprintf('`%s`', $this->table); |
|
| 62 | } |
||
| 63 | |||
| 64 | 78 | $limit = isset($this->limit) ? ' LIMIT '.$this->limit : ''; |
|
| 65 | 78 | $where = isset($this->where) ? ' WHERE ('.$this->where.')' : ''; |
|
| 66 | 78 | $having = isset($this->having) ? ' HAVING ('.$this->having.')' : ''; |
|
| 67 | 78 | $order = isset($this->order) ? ' ORDER BY '.$this->order : ''; |
|
| 68 | |||
| 69 | 78 | return sprintf('SELECT %s FROM %s %s %s %s %s', $expression, $from, $where, $having, $order, $limit); |
|
| 70 | } |
||
| 72 |