Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
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
RegistrationHandler
100.00% covered (success)
100.00%
6 / 6
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%
5 / 5
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\Handler;
4
5use App\Auth\Application\Command\RegistrationCommand;
6use App\Auth\Domain\Port\Driven\IdentityRepository;
7use App\Auth\Domain\Service\IdentityService;
8use App\Shared\Domain\Port\Driven\EventBus;
9use App\Shared\Domain\Port\Driven\TransactionProvider;
10
11readonly class RegistrationHandler
12{
13    public function __construct(
14        private IdentityService $identityService,
15        private IdentityRepository  $identityRepository,
16        private TransactionProvider $transactionProvider,
17        private EventBus        $eventBus
18    ) {
19    }
20
21    public function __invoke(RegistrationCommand $command): void
22    {
23        $this->transactionProvider->transactional(function () use ($command) {
24            $identity = $this->identityService->createIdentity($command->email, $command->username, $command->password);
25            $this->identityRepository->save($identity);
26            $this->eventBus->dispatchAll($identity);
27        });
28    }
29}

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.

RegistrationHandler->__construct
13    public function __construct(
14        private IdentityService $identityService,
15        private IdentityRepository  $identityRepository,
16        private TransactionProvider $transactionProvider,
17        private EventBus        $eventBus
18    ) {
19    }
RegistrationHandler->__invoke
21    public function __invoke(RegistrationCommand $command): void
22    {
23        $this->transactionProvider->transactional(function () use ($command) {
24            $identity = $this->identityService->createIdentity($command->email, $command->username, $command->password);
25            $this->identityRepository->save($identity);
26            $this->eventBus->dispatchAll($identity);
27        });
28    }
{closure:/home/runner/work/my-lego-collection/my-lego-collection/back/src/Auth/Application/Handler/RegistrationHandler.php:23-27}
23        $this->transactionProvider->transactional(function () use ($command) {
24            $identity = $this->identityService->createIdentity($command->email, $command->username, $command->password);
25            $this->identityRepository->save($identity);
26            $this->eventBus->dispatchAll($identity);
27        });
{main}
3namespace App\Auth\Application\Handler;
4
5use App\Auth\Application\Command\RegistrationCommand;
6use App\Auth\Domain\Port\Driven\IdentityRepository;
7use App\Auth\Domain\Service\IdentityService;
8use App\Shared\Domain\Port\Driven\EventBus;
9use App\Shared\Domain\Port\Driven\TransactionProvider;
10
11readonly class RegistrationHandler
12{
13    public function __construct(
14        private IdentityService $identityService,
15        private IdentityRepository  $identityRepository,
16        private TransactionProvider $transactionProvider,
17        private EventBus        $eventBus
18    ) {
19    }
20
21    public function __invoke(RegistrationCommand $command): void
22    {
23        $this->transactionProvider->transactional(function () use ($command) {
24            $identity = $this->identityService->createIdentity($command->email, $command->username, $command->password);
25            $this->identityRepository->save($identity);
26            $this->eventBus->dispatchAll($identity);
27        });
28    }