Config   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 14
c 1
b 0
f 0
dl 0
loc 37
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 17 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Koriym\AppStateDiagram;
6
7
use Koriym\AppStateDiagram\Exception\AlpsFileNotReadableException;
8
9
use function is_file;
10
11
final class Config
12
{
13
    /** @var string  */
14
    public $profile;
15
16
    /** @var bool  */
17
    public $watch;
18
19
    /** @var ConfigFilter */
20
    public $filter;
21
22
    /** @var bool */
23
    public $hasTag;
24
25
    /** @var string */
26
    public $outputMode;
27
28
    /** @var int */
29
    public $port;
30
31
    public function __construct(
32
        string $profile,
33
        bool $watch,
34
        ConfigFilter $filter,
35
        string $outputMode = DumpDocs::MODE_HTML,
36
        int $port = 3000
37
    ) {
38
        if (! is_file($profile)) {
39
            throw new AlpsFileNotReadableException($profile);
40
        }
41
42
        $this->profile = $profile;
43
        $this->watch = $watch;
44
        $this->filter = $filter;
45
        $this->hasTag = $filter->and || $filter->or;
46
        $this->outputMode = $outputMode;
47
        $this->port = $port;
48
    }
49
}
50