| 1 | <?php |
||
| 6 | use NilPortugues\Foundation\Domain\Model\Repository\Contracts\Identity; |
||
| 7 | |||
| 8 | class User implements Identity |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var UserId |
||
| 12 | */ |
||
| 13 | protected $userId; |
||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | protected $name; |
||
| 18 | /** |
||
| 19 | * @var \DateTimeImmutable |
||
| 20 | */ |
||
| 21 | protected $registrationDate; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * User constructor. |
||
| 25 | * |
||
| 26 | * @param UserId $id |
||
| 27 | * @param string $name |
||
| 28 | * @param DateTimeImmutable $registrationDate |
||
| 29 | */ |
||
| 30 | public function __construct(UserId $id, $name, DateTimeImmutable $registrationDate) |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Returns value for userId property. |
||
| 39 | * |
||
| 40 | * @return UserId |
||
| 41 | */ |
||
| 42 | public function userId() |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Returns value for name property. |
||
| 49 | * |
||
| 50 | * @return string |
||
| 51 | */ |
||
| 52 | public function name() |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Returns value for registrationDate property. |
||
| 59 | * |
||
| 60 | * @return DateTimeImmutable |
||
| 61 | */ |
||
| 62 | public function registrationDate() |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @return mixed |
||
| 69 | */ |
||
| 70 | public function id() |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @return string |
||
| 77 | */ |
||
| 78 | public function __toString() |
||
| 79 | { |
||
| 80 | return (string) $this->id(); |
||
| 81 | } |
||
| 83 |