Conditions | 4 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4.0961 |
Changes | 0 |
1 | <?php |
||
18 | 29 | protected function doLoad(string $file) : void |
|
19 | { |
||
20 | 29 | if (! class_exists(Yaml::class)) { |
|
21 | throw MigrationException::yamlConfigurationNotAvailable(); |
||
22 | } |
||
23 | |||
24 | 29 | $config = Yaml::parse(file_get_contents($file)); |
|
25 | |||
26 | 29 | if (! is_array($config)) { |
|
27 | throw MigrationException::configurationNotValid('Configuration is not valid YAML.'); |
||
28 | } |
||
29 | |||
30 | 29 | if (isset($config['migrations_directory'])) { |
|
31 | 19 | $config['migrations_directory'] = $this->getDirectoryRelativeToFile( |
|
32 | 19 | $file, |
|
33 | 19 | $config['migrations_directory'] |
|
34 | ); |
||
35 | } |
||
36 | |||
37 | 29 | $this->setConfiguration($config); |
|
38 | 26 | } |
|
40 |