Conditions | 4 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | 10 | public function load($file) : Configuration |
|
30 | { |
||
31 | 10 | if (! file_exists($file)) { |
|
32 | 1 | throw FileNotFound::new(); |
|
33 | } |
||
34 | 9 | $config = require $file; |
|
35 | 9 | if ($config instanceof Configuration) { |
|
36 | 1 | return $config; |
|
37 | } |
||
38 | |||
39 | 8 | assert(is_array($config)); |
|
40 | 8 | if (isset($config['migrations_paths'])) { |
|
41 | 3 | $config['migrations_paths'] = $this->getDirectoryRelativeToFile( |
|
42 | 3 | $file, |
|
43 | 3 | $config['migrations_paths'] |
|
44 | ); |
||
45 | } |
||
46 | |||
47 | 8 | return $this->arrayLoader->load($config); |
|
48 | } |
||
50 |