| 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 |
||
| 51 | 12 | public static function build($component): string |
|
| 52 | { |
||
| 53 | 12 | if (! isset($component->statement)) { |
|
| 54 | 2 | throw new RuntimeException('No statement inside WITH'); |
|
| 55 | } |
||
| 56 | |||
| 57 | 10 | $str = $component->name; |
|
| 58 | |||
| 59 | 10 | if ($component->columns) { |
|
|
|
|||
| 60 | 6 | $str .= ArrayObj::buildAll($component->columns); |
|
| 61 | } |
||
| 62 | |||
| 63 | 10 | $str .= ' AS ('; |
|
| 64 | |||
| 65 | 10 | foreach ($component->statement->statements as $statement) { |
|
| 66 | 10 | $str .= $statement->build(); |
|
| 67 | } |
||
| 68 | |||
| 69 | 10 | $str .= ')'; |
|
| 70 | |||
| 71 | 10 | return $str; |
|
| 72 | } |
||
| 79 |
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.