ConfigLoader::load()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 8
ccs 0
cts 5
cp 0
rs 10
cc 3
nc 2
nop 1
crap 12
1
<?php
2
3
4
namespace Deployee\Components\Config;
5
6
7
use Symfony\Component\Yaml\Yaml;
8
9
class ConfigLoader
10
{
11
    public function load(string $filepath)
12
    {
13
        if(!is_file($filepath) || !($fileContents = file_get_contents($filepath))){
14
            throw new \RuntimeException(sprintf('Could not open %s', $filepath));
15
        }
16
17
        $contents = Yaml::parse($fileContents);
18
        return new Config($contents);
19
    }
20
}