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

Configuration::loadOptionsFromFiles()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 2
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