Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4.128 |
Changes | 0 |
1 | <?php |
||
22 | 29 | protected function doLoad($file) |
|
23 | { |
||
24 | 29 | if ( ! class_exists(Yaml::class)) { |
|
25 | throw MigrationException::yamlConfigurationNotAvailable(); |
||
26 | } |
||
27 | |||
28 | 29 | $config = Yaml::parse(file_get_contents($file)); |
|
29 | |||
30 | 29 | if ( ! is_array($config)) { |
|
31 | throw new \InvalidArgumentException('Not valid configuration.'); |
||
32 | } |
||
33 | |||
34 | 29 | if (isset($config['migrations_directory'])) { |
|
35 | 19 | $config['migrations_directory'] = $this->getDirectoryRelativeToFile($file, $config['migrations_directory']); |
|
36 | } |
||
37 | |||
38 | 29 | $this->setConfiguration($config); |
|
39 | 26 | } |
|
40 | } |
||
41 |