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

Config::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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