Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
3 / 3 |
|
66.67% |
2 / 3 |
|
66.67% |
2 / 3 |
|
100.00% |
3 / 3 |
CRAP | |
0.00% |
0 / 1 |
| UserCreatedEventHandler | |
100.00% |
3 / 3 |
|
66.67% |
2 / 3 |
|
66.67% |
2 / 3 |
|
100.00% |
3 / 3 |
3.33 | |
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 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\User\Infrastructure\EventHandler; |
| 4 | |
| 5 | use App\Shared\Infrastructure\EventHandler\DomainEventHandler; |
| 6 | use App\Shared\Infrastructure\EventHandler\MessageHandler; |
| 7 | use App\User\Application\Orchestrator\UserCreatedOrchestrator; |
| 8 | use App\User\Domain\Event\UserCreatedEvent; |
| 9 | use Symfony\Component\Messenger\Attribute\AsMessageHandler; |
| 10 | |
| 11 | /** |
| 12 | * @implements DomainEventHandler<UserCreatedEvent> |
| 13 | * @author Wilhelm Zwertvaegher |
| 14 | */ |
| 15 | #[AsMessageHandler] |
| 16 | readonly class UserCreatedEventHandler implements DomainEventHandler |
| 17 | { |
| 18 | public function __construct(private UserCreatedOrchestrator $userCreatedOrchestrator) |
| 19 | { |
| 20 | } |
| 21 | |
| 22 | |
| 23 | public static function getMessageHandled(): string |
| 24 | { |
| 25 | return UserCreatedEvent::class; |
| 26 | } |
| 27 | |
| 28 | public function __invoke(UserCreatedEvent $event): void |
| 29 | { |
| 30 | ($this->userCreatedOrchestrator)($event); |
| 31 | } |
| 32 | } |