Total Complexity | 8 |
Total Lines | 61 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
12 | trait HasConfigTrait |
||
13 | { |
||
14 | /** |
||
15 | * @var null|Config |
||
16 | */ |
||
17 | protected $config = null; |
||
18 | |||
19 | /** |
||
20 | * @return Config |
||
21 | */ |
||
22 | 2 | public function getConfig() |
|
28 | } |
||
29 | |||
30 | /** |
||
31 | * @param null $config |
||
|
|||
32 | */ |
||
33 | 2 | public function setConfig($config) |
|
36 | 2 | } |
|
37 | |||
38 | /** |
||
39 | * @return string |
||
40 | */ |
||
41 | 1 | public function getCachedConfigPath() |
|
42 | { |
||
43 | 1 | $path = Helper::normalizePath(Helper::getBasePath(), 'bootstrap', 'cache', 'migrations.php'); |
|
44 | 1 | if (!file_exists($path)) { |
|
45 | 1 | $this->generateCachedConfig($path); |
|
46 | } |
||
47 | 1 | return $path; |
|
48 | } |
||
49 | |||
50 | /** |
||
51 | * @param $path |
||
52 | */ |
||
53 | 1 | protected function generateCachedConfig($path) |
|
54 | { |
||
55 | 1 | $this->getConfig()->savePhp($path); |
|
56 | 1 | } |
|
57 | |||
58 | 2 | protected function initConfig() |
|
64 | 2 | } |
|
65 | |||
66 | /** |
||
67 | * @return Config |
||
68 | */ |
||
69 | 2 | protected function generateConfig() |
|
73 | } |
||
74 | } |
||
75 |