ConfigBusinessFactory::createEnvironment()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
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 14
    public function getConfigContainer(): ConfigContainer
23
    {
24 14
        if ($this->configContainer === null) {
25 14
            $this->configContainer = new ConfigContainer();
26
        }
27 14
        return $this->configContainer;
28
    }
29
30
    /**
31
     * @return \Xervice\Config\Business\Parser\Parser
32
     */
33 14
    public function createParser(): Parser
34
    {
35 14
        return new Parser(
36 14
            $this->getConfigContainer()
37
        );
38
    }
39
40
    /**
41
     * @return \Xervice\Config\Business\Environment\Environment
42
     */
43 14
    public function createEnvironment(): Environment
44
    {
45 14
        return new Environment();
46
    }
47
}
48