Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
19 | public function denormalize($data, $class, $format = null, array $context = array()): User |
||
20 | { |
||
21 | $user = new User( |
||
22 | Uuid::fromString($data['id']), |
||
23 | new Email($data['email']), |
||
24 | new NotEmptyString($data['lastName']), |
||
25 | new NotEmptyString($data['firstName']), |
||
26 | new Role($data['role']), |
||
27 | new Language($data['language']) |
||
28 | ); |
||
29 | |||
30 | if (isset($data['password'])) { |
||
31 | $user = $user->withPassword(Password::fromPlainText($data['password'])); |
||
32 | } |
||
33 | |||
34 | return $user; |
||
35 | } |
||
45 |