Completed
Push — master ( 706672...0f2117 )
by Daniel
02:07
created

Project   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 60
ccs 14
cts 16
cp 0.875
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
A __construct() 0 5 1
A fromArray() 0 6 1
A isMergeRequestsEnabled() 0 3 1
A getName() 0 3 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 21
    public function __construct(int $id, string $name, bool $isMergeRequestsEnabled)
24
    {
25 21
        $this->id = $id;
26 21
        $this->name = $name;
27 21
        $this->isMergeRequestsEnabled = $isMergeRequestsEnabled;
28 21
    }
29
30
    /**
31
     * @param array $project
32
     * @return Project
33
     */
34 21
    public static function fromArray(array $project): self
35
    {
36 21
        return new self(
37 21
            (int)$project['id'],
38 21
            (string)$project['name'],
39 21
            (bool)$project['merge_requests_enabled']
40
        );
41
    }
42
43
    /**
44
     * @return int
45
     */
46 9
    public function getId(): int
47
    {
48 9
        return $this->id;
49
    }
50
51
    /**
52
     * @return string
53
     */
54 2
    public function getName(): string
55
    {
56 2
        return $this->name;
57
    }
58
59
    /**
60
     * @return bool
61
     */
62
    public function isMergeRequestsEnabled(): bool
63
    {
64
        return $this->isMergeRequestsEnabled;
65
    }
66
}
67