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

Project::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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