Project   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 60
ccs 0
cts 15
cp 0
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A isMergeRequestsEnabled() 0 3 1
A getId() 0 3 1
A __construct() 0 5 1
A fromArray() 0 6 1
1
<?php declare(strict_types=1);
2
3
namespace DanielPieper\MergeReminder\ValueObject;
4
5
class Project
6
{
7
8
    /** @var int */
9
    private $id;
10
11
    /** @var string */
12
    private $name;
13
14
    /** @var bool */
15
    private $isMergeRequestsEnabled;
16
17
    /**
18
     * Project constructor.
19
     * @param int $id
20
     * @param string $name
21
     * @param bool $isMergeRequestsEnabled
22
     */
23
    public function __construct(int $id, string $name, bool $isMergeRequestsEnabled)
24
    {
25
        $this->id = $id;
26
        $this->name = $name;
27
        $this->isMergeRequestsEnabled = $isMergeRequestsEnabled;
28
    }
29
30
    /**
31
     * @param array $project
32
     * @return Project
33
     */
34
    public static function fromArray(array $project): self
35
    {
36
        return new self(
37
            (int)$project['id'],
38
            (string)$project['name'],
39
            (bool)$project['merge_requests_enabled']
40
        );
41
    }
42
43
    /**
44
     * @return int
45
     */
46
    public function getId(): int
47
    {
48
        return $this->id;
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getName(): string
55
    {
56
        return $this->name;
57
    }
58
59
    /**
60
     * @return bool
61
     */
62
    public function isMergeRequestsEnabled(): bool
63
    {
64
        return $this->isMergeRequestsEnabled;
65
    }
66
}
67