Passed
Pull Request — master (#39)
by Daniel
03:37
created

ConfigFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Jellyfish\Config;
4
5
class ConfigFactory
6
{
7
    /**
8
     * @var string
9
     */
10
    protected $appDir;
11
12
    /**
13
     * @var string
14
     */
15
    protected $environment;
16
17
    /**
18
     * @var \Jellyfish\Config\ConfigInterface
19
     */
20
    protected $config;
21
22
    /**
23
     * @param string $appDir
24
     * @param string $environment
25
     */
26
    public function __construct(
27
        string $appDir,
28
        string $environment
29
    ) {
30
        $this->appDir = $appDir;
31
        $this->environment = $environment;
32
    }
33
34
    /**
35
     * @return \Jellyfish\Config\ConfigInterface
36
     */
37
    public function getConfig(): ConfigInterface
38
    {
39
        if ($this->config === null) {
40
            $this->config = new Config($this->appDir, $this->environment);
41
        }
42
43
        return $this->config;
44
    }
45
}
46