Passed
Pull Request — master (#6)
by Dmitriy
17:30 queued 02:25
created

System   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 55
rs 10
c 0
b 0
f 0
wmc 9

8 Methods

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