Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| DefaultUserService | |
100.00% |
5 / 5 |
|
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| createUser | |
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\User\Domain\Service; |
| 4 | |
| 5 | use App\Shared\Domain\Model\EntityId; |
| 6 | use App\User\Domain\Model\User; |
| 7 | use App\User\Domain\Port\Driven\RetrieveUserForIdentity; |
| 8 | |
| 9 | readonly class DefaultUserService implements UserService |
| 10 | { |
| 11 | public function __construct( |
| 12 | private RetrieveUserForIdentity $retrieveUserForIdentity |
| 13 | ) { |
| 14 | } |
| 15 | |
| 16 | public function createUser(EntityId $identityId): ?User |
| 17 | { |
| 18 | $user = $this->retrieveUserForIdentity->retrieveUser($identityId); |
| 19 | if ($user) { |
| 20 | return $user; |
| 21 | } |
| 22 | |
| 23 | return User::create(EntityId::generate(), $identityId, new \DateTimeImmutable(), new \DateTimeImmutable()); |
| 24 | } |
| 25 | } |