Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| AddUserSetHandler | |
100.00% |
7 / 7 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| __invoke | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\CollectionManagement\Application\Handler; |
| 4 | |
| 5 | use App\CollectionManagement\Application\Command\AddUserSetCommand; |
| 6 | use App\CollectionManagement\Application\Command\SearchSetQuery; |
| 7 | use App\CollectionManagement\Domain\Model\EnrichedSetCollection; |
| 8 | use App\CollectionManagement\Domain\Model\Local\Set; |
| 9 | use App\CollectionManagement\Domain\Model\Local\UserSet; |
| 10 | use App\CollectionManagement\Domain\Service\RetrieveUserId; |
| 11 | use App\CollectionManagement\Domain\Service\SetService; |
| 12 | use App\Shared\Domain\Model\EntityId; |
| 13 | use App\User\Domain\Model\User; |
| 14 | |
| 15 | final readonly class AddUserSetHandler |
| 16 | { |
| 17 | public function __construct(private readonly RetrieveUserId $retrieveUser) |
| 18 | { |
| 19 | } |
| 20 | |
| 21 | public function __invoke(AddUserSetCommand $command): UserSet |
| 22 | { |
| 23 | // get the user id associated to the command's identityId |
| 24 | |
| 25 | $userId = $this->retrieveUser->getUserId($command->getIdentityId()); |
| 26 | |
| 27 | // add the event(s) to the message bus |
| 28 | |
| 29 | // TODO |
| 30 | return new UserSet( |
| 31 | EntityId::generate(), |
| 32 | $userId, |
| 33 | new Set(EntityId::generate(), 'externalId', 'legoId', 'name', 10, '', 2005) |
| 34 | ); |
| 35 | } |
| 36 | } |