ConfigLoader   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 1
b 0
f 0
dl 0
loc 10
ccs 0
cts 5
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 8 3
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
}