| Conditions | 4 |
| Paths | 5 |
| Total Lines | 21 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | 12 | public function build(): string |
|
| 27 | { |
||
| 28 | 12 | if (! isset($this->statement)) { |
|
| 29 | 2 | throw new RuntimeException('No statement inside WITH'); |
|
| 30 | } |
||
| 31 | |||
| 32 | 10 | $str = $this->name; |
|
| 33 | |||
| 34 | 10 | if ($this->columns) { |
|
|
|
|||
| 35 | 6 | $str .= ArrayObjs::buildAll($this->columns); |
|
| 36 | } |
||
| 37 | |||
| 38 | 10 | $str .= ' AS ('; |
|
| 39 | |||
| 40 | 10 | foreach ($this->statement->statements as $statement) { |
|
| 41 | 10 | $str .= $statement->build(); |
|
| 42 | } |
||
| 43 | |||
| 44 | 10 | $str .= ')'; |
|
| 45 | |||
| 46 | 10 | return $str; |
|
| 47 | } |
||
| 54 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.