Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| CreateUserCommandHandler | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getMessageHandled | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| __invoke | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\User\Infrastructure\EventHandler; |
| 4 | |
| 5 | use App\Shared\Infrastructure\EventHandler\CommandHandler; |
| 6 | use App\Shared\Infrastructure\EventHandler\MessageHandler; |
| 7 | use App\User\Application\Handler\CreateUserHandler; |
| 8 | use MyLegoCollection\SharedContracts\Command\CreateUserCommand; |
| 9 | use Symfony\Component\Messenger\Attribute\AsMessageHandler; |
| 10 | |
| 11 | /** |
| 12 | * @implements CommandHandler<CreateUserCommand> |
| 13 | * @author Wilhelm Zwertvaegher |
| 14 | */ |
| 15 | #[AsMessageHandler] |
| 16 | readonly class CreateUserCommandHandler implements CommandHandler |
| 17 | { |
| 18 | public function __construct(private CreateUserHandler $createUserHandler) |
| 19 | { |
| 20 | } |
| 21 | |
| 22 | public static function getMessageHandled(): string |
| 23 | { |
| 24 | return CreateUserCommand::class; |
| 25 | } |
| 26 | |
| 27 | public function __invoke(CreateUserCommand $command): void |
| 28 | { |
| 29 | ($this->createUserHandler)($command); |
| 30 | } |
| 31 | } |