Completed
Push — master ( 9b25f2...d42705 )
by Tomáš
09:42 queued 07:08
created

Configuration   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 32
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A loadOptionsFromFiles() 0 7 2
A addOption() 0 4 1
A getOptions() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Symplify
7
 * Copyright (c) 2016 Tomas Votruba (http://tomasvotruba.cz).
8
 */
9
10
namespace Symplify\PHP7_Sculpin\Configuration;
11
12
use Nette\Neon\Neon;
13
use SplFileInfo;
14
15
final class Configuration
16
{
17
    /**
18
     * @var array
19
     */
20
    private $options = [];
21
22
    /**
23
     * @param SplFileInfo[] $files
24
     */
25 1
    public function loadOptionsFromFiles(array $files)
26
    {
27 1
        foreach ($files as $file) {
28 1
            $fileContent = file_get_contents($file->getRealPath());
29 1
            $this->options += Neon::decode($fileContent);
30
        }
31 1
    }
32
33
    /**
34
     * @param string       $name
35
     * @param string|array $value
36
     */
37 1
    public function addOption(string $name, $value)
38
    {
39 1
        $this->options[$name] = $value;
40 1
    }
41
42 4
    public function getOptions() : array
43
    {
44 4
        return $this->options;
45
    }
46
}
47