Total Complexity | 8 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class CreateCompiler |
||
12 | { |
||
13 | /** |
||
14 | * @codeCoverageIgnore |
||
15 | */ |
||
16 | public static function compile(Grammar $grammar, Blueprint $blueprint, array $columns, array $commands = []): string |
||
17 | { |
||
18 | $compiledCommand = sprintf( |
||
19 | '%s table %s %s (%s)', |
||
20 | $blueprint->temporary ? 'create temporary' : 'create', |
||
21 | self::beforeTable($commands['ifNotExists']), |
||
22 | $grammar->wrapTable($blueprint), |
||
23 | $commands['like'] |
||
24 | ? self::compileLike($grammar, $commands['like']) |
||
25 | : self::compileColumns($columns) |
||
26 | ); |
||
27 | |||
28 | return str_replace(' ', ' ', trim($compiledCommand)); |
||
29 | } |
||
30 | |||
31 | 27 | private static function beforeTable(?Fluent $command = null): string |
|
34 | } |
||
35 | |||
36 | /** |
||
37 | * @codeCoverageIgnore |
||
38 | */ |
||
39 | private static function compileLike(Grammar $grammar, Fluent $command): string |
||
44 | } |
||
45 | |||
46 | 27 | private static function compileColumns(array $columns): string |
|
49 | } |
||
50 | } |
||
51 |