Conditions | 4 |
Paths | 5 |
Total Lines | 21 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
33 | public static function build($component, array $options = []) |
||
34 | { |
||
35 | if (! $component instanceof WithKeyword) { |
||
|
|||
36 | throw new RuntimeException('Can not build a component that is not a WithKeyword'); |
||
37 | } |
||
38 | |||
39 | $str = $component->name; |
||
40 | |||
41 | if ($component->columns) { |
||
42 | $str .= ArrayObj::build($component->columns); |
||
43 | } |
||
44 | |||
45 | $str .= ' AS ('; |
||
46 | |||
47 | foreach ($component->statement->statements as $statement) { |
||
48 | $str .= $statement->build(); |
||
49 | } |
||
50 | |||
51 | $str .= ')'; |
||
52 | |||
53 | return $str; |
||
54 | } |
||
56 |