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