Passed
Push — master ( b0dfbc...4d3ad3 )
by Mariano
12:04
created

Config   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 33
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getFactoryClassName() 0 3 1
A isDebugMode() 0 3 1
A getInterfaceIp() 0 3 1
A __construct() 0 3 1
A getExpectationsPath() 0 3 1
A getPort() 0 3 1
1
<?php
2
3
namespace Mcustiel\Phiremock\Server\Utils\Config;
4
5
use Mcustiel\Phiremock\Server\Cli\Options\ExpectationsDirectory;
6
use Mcustiel\Phiremock\Server\Cli\Options\HostInterface;
7
use Mcustiel\Phiremock\Server\Cli\Options\PhpFactoryFqcn;
8
use Mcustiel\Phiremock\Server\Cli\Options\Port;
9
10
class Config
11
{
12
    /** @var array */
13
    private $configurationArray;
14
15
    public function __construct(array $configurationArray)
16
    {
17
        $this->configurationArray = $configurationArray;
18
    }
19
20
    public function getInterfaceIp(): HostInterface
21
    {
22
        return new HostInterface($this->configurationArray['ip']);
23
    }
24
25
    public function getPort(): Port
26
    {
27
        return new Port((int) $this->configurationArray['port']);
28
    }
29
30
    public function isDebugMode(): bool
31
    {
32
        return $this->configurationArray['debug'];
33
    }
34
35
    public function getExpectationsPath(): ExpectationsDirectory
36
    {
37
        return new ExpectationsDirectory($this->configurationArray['expectations-dir']);
38
    }
39
40
    public function getFactoryClassName(): PhpFactoryFqcn
41
    {
42
        return new PhpFactoryFqcn($this->configurationArray['factory-class']);
43
    }
44
}
45