Total Complexity | 4 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
1 | <?php namespace Way\Generators\Syntax; |
||
7 | abstract class Table |
||
8 | { |
||
9 | /** |
||
10 | * @var TemplateCompiler |
||
11 | */ |
||
12 | protected $compiler; |
||
13 | |||
14 | protected $decorator; |
||
15 | |||
16 | public function __construct(TemplateCompiler $compiler, Decorator $decorator) |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * Fetch the template of the schema |
||
24 | * |
||
25 | * @param string $method |
||
26 | * @return string |
||
27 | */ |
||
28 | protected function getTemplate(string $method): string |
||
29 | { |
||
30 | if ($method === 'drop') { |
||
31 | return File::get(__DIR__.'/../templates/drop.txt'); |
||
32 | } else { |
||
33 | return File::get(__DIR__.'/../templates/schema.txt'); |
||
34 | } |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * Replace $FIELDS$ in the given template |
||
39 | * with the provided schema |
||
40 | * |
||
41 | * @param array $schema |
||
42 | * @param string $template |
||
43 | * @return string |
||
44 | */ |
||
45 | protected function replaceFieldsWith(array $schema, string $template): string |
||
48 | } |
||
49 | } |
||
50 |