Parser   A
last analyzed

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