Passed
Push — master ( 81e780...d41685 )
by Mariano
03:19 queued 27s
created

Config   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
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\Port;
8
9
class Config
10
{
11
    /** @var array */
12
    private $configurationArray;
13
14
    public function __construct(array $configurationArray)
15
    {
16
        $this->configurationArray = $configurationArray;
17
    }
18
19
    public function getInterfaceIp(): HostInterface
20
    {
21
        return new HostInterface($this->configurationArray['ip']);
22
    }
23
24
    public function getPort(): Port
25
    {
26
        return new Port((int) $this->configurationArray['port']);
27
    }
28
29
    public function isDebugMode(): bool
30
    {
31
        return $this->configurationArray['debug'];
32
    }
33
34
    public function getExpectationsPath(): ExpectationsDirectory
35
    {
36
        return new ExpectationsDirectory($this->configurationArray['expectations-dir']);
37
    }
38
}
39