Total Complexity | 9 |
Total Lines | 139 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | class Commit |
||
21 | { |
||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $hash; |
||
26 | |||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | private $names; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | private $subject; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | private $body; |
||
41 | |||
42 | /** |
||
43 | * @var \DateTimeImmutable |
||
44 | */ |
||
45 | private $date; |
||
46 | |||
47 | /** |
||
48 | * @var string |
||
49 | */ |
||
50 | private $author; |
||
51 | |||
52 | /** |
||
53 | * Commit constructor. |
||
54 | * |
||
55 | * @param string $hash |
||
56 | * @param array $names |
||
57 | * @param string $subject |
||
58 | * @param string $body |
||
59 | * @param \DateTimeImmutable $date |
||
60 | * @param string $author |
||
61 | */ |
||
62 | 4 | public function __construct( |
|
63 | string $hash, |
||
64 | array $names, |
||
65 | string $subject, |
||
66 | string $body, |
||
67 | \DateTimeImmutable $date, |
||
68 | string $author |
||
69 | ) |
||
70 | { |
||
71 | 4 | $this->hash = $hash; |
|
72 | 4 | $this->names = $names; |
|
73 | 4 | $this->subject = $subject; |
|
74 | 4 | $this->body = $body; |
|
75 | 4 | $this->date = $date; |
|
76 | 4 | $this->author = $author; |
|
77 | 4 | } |
|
78 | |||
79 | /** |
||
80 | * Hash getter. |
||
81 | * |
||
82 | * @return string |
||
83 | */ |
||
84 | 2 | public function getHash(): string |
|
85 | { |
||
86 | 2 | return $this->hash; |
|
87 | } |
||
88 | |||
89 | /** |
||
90 | * Does the commit have names. |
||
91 | * |
||
92 | * @return bool |
||
93 | */ |
||
94 | 1 | public function hasNames(): bool |
|
95 | { |
||
96 | 1 | return !empty($this->names); |
|
97 | } |
||
98 | |||
99 | /** |
||
100 | * Names getter. |
||
101 | * |
||
102 | * @return array |
||
103 | */ |
||
104 | 1 | public function getNames(): array |
|
105 | { |
||
106 | 1 | return $this->names; |
|
107 | } |
||
108 | |||
109 | /** |
||
110 | * Description getter. |
||
111 | * |
||
112 | * @deprecated |
||
113 | * |
||
114 | * @return string |
||
115 | */ |
||
116 | 1 | public function getDescription(): string |
|
117 | { |
||
118 | 1 | return $this->getSubject(); |
|
119 | } |
||
120 | |||
121 | /** |
||
122 | * Subject getter. |
||
123 | * |
||
124 | * @return string |
||
125 | */ |
||
126 | 1 | public function getSubject(): string |
|
127 | { |
||
128 | 1 | return $this->subject; |
|
129 | } |
||
130 | |||
131 | /** |
||
132 | * Body getter. |
||
133 | * |
||
134 | * @return string |
||
135 | */ |
||
136 | 1 | public function getBody(): string |
|
137 | { |
||
138 | 1 | return $this->body; |
|
139 | } |
||
140 | |||
141 | /** |
||
142 | * Date getter. |
||
143 | * |
||
144 | * @return \DateTimeImmutable |
||
145 | */ |
||
146 | 1 | public function getDate(): \DateTimeImmutable |
|
147 | { |
||
148 | 1 | return $this->date; |
|
149 | } |
||
150 | |||
151 | /** |
||
152 | * Author getter. |
||
153 | * |
||
154 | * @return string |
||
155 | */ |
||
156 | 4 | public function getAuthor(): string |
|
159 | } |
||
160 | } |
||
161 |