Total Complexity | 6 |
Total Lines | 71 |
Duplicated Lines | 0 % |
Coverage | 88.24% |
Changes | 0 |
1 | <?php declare(strict_types = 1); |
||
22 | final class Person |
||
23 | { |
||
24 | /** |
||
25 | * @var Uuid |
||
26 | * |
||
27 | * @ORM\Id() |
||
28 | * @ORM\Column(type="uuid") |
||
29 | * @ORM\GeneratedValue(strategy="NONE") |
||
30 | * |
||
31 | * @Serializer\Exclude() |
||
32 | */ |
||
33 | private $id; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | * |
||
38 | * @ORM\Column(type="string") |
||
39 | */ |
||
40 | private $name; |
||
41 | |||
42 | /** |
||
43 | * @var string |
||
44 | * |
||
45 | * @ORM\Column(type="string") |
||
46 | */ |
||
47 | private $email; |
||
48 | |||
49 | /** |
||
50 | * @var string |
||
51 | * |
||
52 | * @ORM\Column(type="string", length=255) |
||
53 | * |
||
54 | * @Serializer\Exclude() |
||
55 | */ |
||
56 | private $passwordHash; |
||
57 | |||
58 | 7 | private function __construct() |
|
60 | 7 | } |
|
61 | |||
62 | 7 | public static function register(string $name, string $email, string $password): Person |
|
63 | { |
||
64 | 7 | $person = new self(); |
|
65 | |||
66 | 7 | $person->id = Uuid::uuid4(); |
|
67 | 7 | $person->name = $name; |
|
68 | 7 | $person->email = $email; |
|
69 | /** @scrutinizer ignore-call */ |
||
70 | 7 | $person->passwordHash = password_hash($password, \PASSWORD_DEFAULT); |
|
71 | |||
72 | 7 | return $person; |
|
73 | } |
||
74 | |||
75 | 3 | public function getId(): Uuid |
|
78 | } |
||
79 | |||
80 | 1 | public function getName(): string |
|
83 | } |
||
84 | |||
85 | 1 | public function getEmail(): string |
|
86 | { |
||
87 | 1 | return $this->email; |
|
88 | } |
||
89 | |||
90 | public function getPasswordHash(): string |
||
93 | } |
||
94 | } |
||
95 |