Passed
Pull Request — master (#6)
by Dmitriy
10:40
created

System::setValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Yiisoft\Composer\Config\Configs;
4
5
/**
6
 * System class represents system configuration files:
7
 * __files, aliases, packages.
8
 */
9
class System extends Config
10
{
11
    public function setValue(string $name, $value): Config
12
    {
13
        $this->values[$name] = $value;
14
15
        return $this;
16
    }
17
18
    public function setValues(array $values): Config
19
    {
20
        $this->values = $values;
21
22
        return $this;
23
    }
24
25
    public function mergeValues(array $values): Config
26
    {
27
        $this->values = array_merge($this->values, $values);
28
29
        return $this;
30
    }
31
32
    public function load(array $paths = []): Config
33
    {
34
        $path = $this->getOutputPath();
35
        if (!file_exists($path)) {
36
            return $this;
37
        }
38
39
        $this->values = array_merge($this->loadFile($path), $this->values);
40
41
        return $this;
42
    }
43
44
    public function build(): Config
45
    {
46
        $this->values = $this->substituteOutputDirs($this->values);
47
48
        return $this;
49
    }
50
51
    public function hasEnv(): bool
52
    {
53
        return true;
54
    }
55
56
    public function hasConstants(): bool
57
    {
58
        return true;
59
    }
60
61
    public function hasParams(): bool
62
    {
63
        return true;
64
    }
65
}
66