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

System   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
eloc 9
dl 0
loc 34
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setValue() 0 3 1
A build() 0 5 1
A load() 0 3 1
A writeFile() 0 3 1
A setValues() 0 5 1
A mergeValues() 0 3 1
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