| Total Complexity | 4 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | final class Year |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var int |
||
| 16 | */ |
||
| 17 | private $value; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @param int $value |
||
| 21 | */ |
||
| 22 | 2 | public function __construct(int $value) |
|
| 23 | { |
||
| 24 | 2 | $this->value = $value; |
|
| 25 | 2 | } |
|
| 26 | |||
| 27 | /** |
||
| 28 | * @param Year $year |
||
| 29 | * @return bool |
||
| 30 | */ |
||
| 31 | 2 | public function equals(Year $year): bool |
|
| 32 | { |
||
| 33 | 2 | return $this->value === $year->value(); |
|
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @return int |
||
| 38 | */ |
||
| 39 | 2 | public function value(): int |
|
| 40 | { |
||
| 41 | 2 | return $this->value; |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @param DateTimeInterface $dateTime |
||
| 46 | * @return Year |
||
| 47 | */ |
||
| 48 | 2 | public static function fromDateTime(DateTimeInterface $dateTime): self |
|
| 51 | } |
||
| 52 | } |
||
| 53 |