| Total Complexity | 5 |
| Total Lines | 63 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class IdCard |
||
| 9 | { |
||
| 10 | /** @var int card number */ |
||
| 11 | private $number; |
||
| 12 | /** @var int timestamp of expiration date */ |
||
| 13 | private $dateExpire; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * IdCard constructor. |
||
| 17 | * |
||
| 18 | * @param int $number card number |
||
| 19 | */ |
||
| 20 | public function __construct(int $number) |
||
| 21 | { |
||
| 22 | $this->number = $number; |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Getter for card number. |
||
| 27 | * |
||
| 28 | * @see IdCard::$number |
||
| 29 | * |
||
| 30 | * @return int card number |
||
| 31 | */ |
||
| 32 | public function getNumber(): int |
||
| 33 | { |
||
| 34 | return $this->number; |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Getter for expiration date. |
||
| 39 | * |
||
| 40 | * @see IdCard::$dateExpire |
||
| 41 | * |
||
| 42 | * @return string date expire |
||
| 43 | */ |
||
| 44 | public function getDateExpire(): string |
||
| 45 | { |
||
| 46 | return date('d.m.Y', $this->dateExpire); |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Setter for card number. |
||
| 51 | * |
||
| 52 | * @see IdCard::$number |
||
| 53 | * |
||
| 54 | * @param int $number new card number |
||
| 55 | */ |
||
| 56 | public function setNumber(int $number): void |
||
| 57 | { |
||
| 58 | $this->number = $number; |
||
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Setter for expiration date. |
||
| 63 | * |
||
| 64 | * @see IdCard::$dateExpire |
||
| 65 | * |
||
| 66 | * @param int $timestamp timestamp of the expiration date |
||
| 67 | */ |
||
| 68 | public function setDateExpire(int $timestamp): void |
||
| 69 | { |
||
| 70 | $this->dateExpire = $timestamp; |
||
| 71 | } |
||
| 72 | } |