System   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 33.33%

Importance

Changes 0
Metric Value
wmc 6
eloc 14
c 0
b 0
f 0
dl 0
loc 40
ccs 6
cts 18
cp 0.3333
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setValues() 0 5 1
A load() 0 10 2
A mergeValues() 0 5 1
A setValue() 0 5 1
A build() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Composer\Config\Config;
6
7
/**
8
 * System class represents system configuration files:
9
 * __files, packages.
10
 */
11
class System extends ConfigOutput
12
{
13 2
    public function setValue(string $name, $value): self
14
    {
15 2
        $this->values[$name] = $value;
16
17 2
        return $this;
18
    }
19
20
    public function setValues(array $values): self
21
    {
22
        $this->values = $values;
23
24
        return $this;
25
    }
26
27
    public function mergeValues(array $values): self
28
    {
29
        $this->values = array_merge($this->values, $values);
30
31
        return $this;
32
    }
33
34
    public function load(array $paths = []): self
35
    {
36
        $path = $this->getOutputPath();
37
        if (!file_exists($path)) {
38
            return $this;
39
        }
40
41
        $this->values = array_merge($this->loadFile($path), $this->values);
42
43
        return $this;
44
    }
45
46 2
    public function build(): self
47
    {
48 2
        $this->values = $this->substituteOutputDirs($this->values);
49
50 2
        return $this;
51
    }
52
}
53