Completed
Push — master ( 3c7654...19b80b )
by Andrii
13:55
created

System::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * Composer plugin for config assembling
4
 *
5
 * @link      https://github.com/hiqdev/composer-config-plugin
6
 * @package   composer-config-plugin
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2016-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\composer\config\configs;
12
13
/**
14
 * System class represents system configuration files:
15
 * __files, aliases, extensions.
16
 *
17
 * @author Andrii Vasyliev <[email protected]>
18
 */
19
class System extends Config
20
{
21
    public function setValue(string $name, $value)
22
    {
23
        $this->values[$name] = $value;
24
    }
25
26
    public function setValues(array $values)
27
    {
28
        $this->values = $values;
29
30
        return $this;
31
    }
32
33
    public function mergeValues(array $values)
34
    {
35
        $this->values = array_merge($this->values, $values);
36
    }
37
38
    protected function writeFile(string $path, array $data)
39
    {
40
        $this->writePhpFile($path, $data, false);
41
    }
42
43
    public function load(array $paths = [])
44
    {
45
        return $this->setValues($this->loadFile($this->getOutputPath()));
46
    }
47
48
    public function build()
49
    {
50
        $this->values = $this->substituteOutputDirs($this->values);
51
52
        return $this;
53
    }
54
}
55