Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
13 / 13
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
IdentityCreatedOrchestrator
100.00% covered (success)
100.00%
13 / 13
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 __invoke
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Auth\Application\Orchestrator;
4
5use App\Auth\Domain\Event\IdentityCreatedEvent;
6use App\Shared\Infrastructure\Messenger\CommandBus;
7use App\Shared\Infrastructure\Messenger\IntegrationEventBus;
8use MyLegoCollection\SharedContracts\Command\CreateUserCommand;
9use MyLegoCollection\SharedContracts\Event\IdentityCreatedIntegrationEvent;
10
11/**
12 * @author Wilhelm Zwertvaegher
13 */
14readonly class IdentityCreatedOrchestrator
15{
16    public function __construct(
17        private CommandBus          $commandBus,
18        private IntegrationEventBus $integrationBus,
19    ) {
20    }
21
22    public function __invoke(IdentityCreatedEvent $event): void
23    {
24        // identity creation MUST trigger user creation
25        $this->commandBus->dispatch(
26            new CreateUserCommand(
27                $event->getIdentity()->getId(),
28                $event->metadata()
29            ),
30        );
31
32        // an integration event should be dispatched for possible handlers
33        $this->integrationBus->dispatch(
34            new IdentityCreatedIntegrationEvent(
35                $event->getIdentity()->getId(),
36                $event->metadata()
37            )
38        );
39    }
40
41}

Paths

Below are the source code lines that represent each code path as identified by Xdebug. Please note a path is not necessarily coterminous with a line, a line may contain multiple paths and therefore show up more than once. Please also be aware that some paths may include implicit rather than explicit branches, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

IdentityCreatedOrchestrator->__construct
16    public function __construct(
17        private CommandBus          $commandBus,
18        private IntegrationEventBus $integrationBus,
19    ) {
20    }
IdentityCreatedOrchestrator->__invoke
22    public function __invoke(IdentityCreatedEvent $event): void
23    {
24        // identity creation MUST trigger user creation
25        $this->commandBus->dispatch(
26            new CreateUserCommand(
27                $event->getIdentity()->getId(),
28                $event->metadata()
29            ),
30        );
31
32        // an integration event should be dispatched for possible handlers
33        $this->integrationBus->dispatch(
34            new IdentityCreatedIntegrationEvent(
35                $event->getIdentity()->getId(),
36                $event->metadata()
37            )
38        );
39    }
{main}
3namespace App\Auth\Application\Orchestrator;
4
5use App\Auth\Domain\Event\IdentityCreatedEvent;
6use App\Shared\Infrastructure\Messenger\CommandBus;
7use App\Shared\Infrastructure\Messenger\IntegrationEventBus;
8use MyLegoCollection\SharedContracts\Command\CreateUserCommand;
9use MyLegoCollection\SharedContracts\Event\IdentityCreatedIntegrationEvent;
10
11/**
12 * @author Wilhelm Zwertvaegher
13 */
14readonly class IdentityCreatedOrchestrator
15{
16    public function __construct(
17        private CommandBus          $commandBus,
18        private IntegrationEventBus $integrationBus,
19    ) {
20    }
21
22    public function __invoke(IdentityCreatedEvent $event): void
23    {
24        // identity creation MUST trigger user creation
25        $this->commandBus->dispatch(
26            new CreateUserCommand(
27                $event->getIdentity()->getId(),
28                $event->metadata()
29            ),
30        );
31
32        // an integration event should be dispatched for possible handlers
33        $this->integrationBus->dispatch(
34            new IdentityCreatedIntegrationEvent(
35                $event->getIdentity()->getId(),
36                $event->metadata()
37            )
38        );
39    }
40