Conditions | 4 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
15 | 12 | public function getConfiguration() : Configuration |
|
16 | { |
||
17 | 12 | if (! file_exists($this->file)) { |
|
18 | 1 | throw FileNotFound::new($this->file); |
|
19 | } |
||
20 | |||
21 | 11 | $config = require $this->file; |
|
22 | 11 | if ($config instanceof Configuration) { |
|
23 | 1 | return $config; |
|
24 | } |
||
25 | |||
26 | 10 | assert(is_array($config)); |
|
27 | 10 | if (isset($config['migrations_paths'])) { |
|
28 | 5 | $config['migrations_paths'] = $this->getDirectoriesRelativeToFile( |
|
29 | 5 | $config['migrations_paths'], |
|
30 | 5 | $this->file |
|
31 | ); |
||
32 | } |
||
33 | |||
34 | 10 | return (new ConfigurationArray($config))->getConfiguration(); |
|
35 | } |
||
37 |