Passed
Push — master ( 6c9947...5a4f88 )
by Mike
04:02
created

Parser   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 26
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A parseFile() 0 6 2
1
<?php
2
declare(strict_types=1);
3
4
5
namespace Xervice\Config\Parser;
6
7
8
use Xervice\Config\Container\ConfigContainer;
9
10
class Parser
11
{
12
    /**
13
     * @var \Xervice\Config\Container\ConfigContainer
14
     */
15
    private $configContainer;
16
17
    /**
18
     * Parser constructor.
19
     *
20
     * @param \Xervice\Config\Container\ConfigContainer $configContainer
21
     */
22 5
    public function __construct(ConfigContainer $configContainer)
23
    {
24 5
        $this->configContainer = $configContainer;
25 5
    }
26
27
    /**
28
     * @param string $file
29
     */
30 5
    public function parseFile(string $file): void
31
    {
32 5
        $config = $this->configContainer->toArray();
33 5
        if (file_exists($file)) {
34 5
            require $file;
35 5
            $this->configContainer->fromArray($config);
36
        }
37 5
    }
38
}
39