Completed
Push — master ( b7f544...05e48a )
by Mike
05:04
created

ConfigBusinessFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 34
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createParser() 0 4 1
A getConfigContainer() 0 6 2
A createEnvironment() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
5
namespace Xervice\Config\Business;
6
7
8
use Xervice\Config\Business\Container\ConfigContainer;
9
use Xervice\Config\Business\Environment\Environment;
10
use Xervice\Config\Business\Parser\Parser;
11
12
class ConfigBusinessFactory
13
{
14
    /**
15
     * @var ConfigContainer
16
     */
17
    private $configContainer;
18
19
    /**
20
     * @return \Xervice\Config\Business\Container\ConfigContainer
21
     */
22 8
    public function getConfigContainer(): ConfigContainer
23
    {
24 8
        if ($this->configContainer === null) {
25 8
            $this->configContainer = new ConfigContainer();
26
        }
27 8
        return $this->configContainer;
28
    }
29
30
    /**
31
     * @return \Xervice\Config\Business\Parser\Parser
32
     */
33 8
    public function createParser(): Parser
34
    {
35 8
        return new Parser(
36 8
            $this->getConfigContainer()
37
        );
38
    }
39
40
    /**
41
     * @return \Xervice\Config\Business\Environment\Environment
42
     */
43 8
    public function createEnvironment(): Environment
44
    {
45 8
        return new Environment();
46
    }
47
}
48