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

Configuration::getOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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