Completed
Push — master ( 882947...a4a53d )
by Mike
13:52 queued 13:46
created

YamlConfiguration::doLoad()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 14
Code Lines 7

Duplication

Lines 14
Ratio 100 %

Code Coverage

Tests 7
CRAP Score 3.0175

Importance

Changes 0
Metric Value
dl 14
loc 14
ccs 7
cts 8
cp 0.875
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 7
nc 3
nop 1
crap 3.0175
1
<?php
2
3
namespace Doctrine\DBAL\Migrations\Configuration;
4
5
use Symfony\Component\Yaml\Yaml;
6
7
/**
8
 * Load migration configuration information from a YAML configuration file.
9
 *
10
 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
11
 * @link        www.doctrine-project.org
12
 * @since       2.0
13
 * @author      Jonathan H. Wage <[email protected]>
14
 */
15
class YamlConfiguration extends AbstractFileConfiguration
16
{
17
    /**
18
     * @inheritdoc
19
     */
20 29 View Code Duplication
    protected function doLoad($file)
21
    {
22 29
        $config = Yaml::parse(file_get_contents($file));
23
24 29
        if ( ! is_array($config)) {
25
            throw new \InvalidArgumentException('Not valid configuration.');
26
        }
27
28 29
        if (isset($config['migrations_directory'])) {
29 19
            $config['migrations_directory'] = $this->getDirectoryRelativeToFile($file, $config['migrations_directory']);
30
        }
31
32 29
        $this->setConfiguration($config);
33 26
    }
34
}
35