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

ConfigBusinessFactory::getConfigContainer()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 0
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 2
rs 10
c 0
b 0
f 0
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