Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
33.33% |
1 / 3 |
|
16.67% |
1 / 6 |
|
25.00% |
1 / 4 |
|
33.33% |
1 / 3 |
CRAP | |
0.00% |
0 / 1 |
| RetrieveUserDtoAdapter | |
33.33% |
1 / 3 |
|
16.67% |
1 / 6 |
|
25.00% |
1 / 4 |
|
33.33% |
1 / 3 |
10.75 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| map | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
| getUserDtoFromId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\User\Infrastructure\Adapter; |
| 4 | |
| 5 | use App\Auth\Domain\Model\Identity; |
| 6 | use App\Auth\Domain\Port\Driven\IdentityRepository; |
| 7 | use App\Notification\Application\Port\Driven\RetrieveIdentityDto; |
| 8 | use App\Notification\Application\Port\Driven\RetrieveUserDto; |
| 9 | use App\Notification\Domain\Model\IdentityInfo; |
| 10 | use App\Shared\Domain\Model\EntityId; |
| 11 | use App\User\Domain\Model\User; |
| 12 | use App\User\Domain\Port\Driven\UserRepository; |
| 13 | use MyLegoCollection\SharedContracts\Dto\IdentityDto; |
| 14 | use MyLegoCollection\SharedContracts\Dto\UserDto; |
| 15 | |
| 16 | /** |
| 17 | * @author Wilhelm Zwertvaegher |
| 18 | */ |
| 19 | class RetrieveUserDtoAdapter implements RetrieveUserDto |
| 20 | { |
| 21 | public function __construct(private readonly UserRepository $userRepository) |
| 22 | { |
| 23 | } |
| 24 | |
| 25 | private function map(?User $user): ?UserDto |
| 26 | { |
| 27 | return null === $user ? null : new UserDto($user->getId(), $user->getIdentityId()); |
| 28 | } |
| 29 | |
| 30 | public function getUserDtoFromId(string $userId): ?UserDto |
| 31 | { |
| 32 | return $this->map($this->userRepository->findById(EntityId::fromString($userId))); |
| 33 | } |
| 34 | } |
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.
| 21 | public function __construct(private readonly UserRepository $userRepository) |
| 22 | { |
| 23 | } |
| 30 | public function getUserDtoFromId(string $userId): ?UserDto |
| 31 | { |
| 32 | return $this->map($this->userRepository->findById(EntityId::fromString($userId))); |
| 33 | } |
| 25 | private function map(?User $user): ?UserDto |
| 26 | { |
| 27 | return null === $user ? null : new UserDto($user->getId(), $user->getIdentityId()); |
| 27 | return null === $user ? null : new UserDto($user->getId(), $user->getIdentityId()); |
| 27 | return null === $user ? null : new UserDto($user->getId(), $user->getIdentityId()); |
| 28 | } |
| 25 | private function map(?User $user): ?UserDto |
| 26 | { |
| 27 | return null === $user ? null : new UserDto($user->getId(), $user->getIdentityId()); |
| 27 | return null === $user ? null : new UserDto($user->getId(), $user->getIdentityId()); |
| 27 | return null === $user ? null : new UserDto($user->getId(), $user->getIdentityId()); |
| 28 | } |
| 3 | namespace App\User\Infrastructure\Adapter; |
| 4 | |
| 5 | use App\Auth\Domain\Model\Identity; |
| 6 | use App\Auth\Domain\Port\Driven\IdentityRepository; |
| 7 | use App\Notification\Application\Port\Driven\RetrieveIdentityDto; |
| 8 | use App\Notification\Application\Port\Driven\RetrieveUserDto; |
| 9 | use App\Notification\Domain\Model\IdentityInfo; |
| 10 | use App\Shared\Domain\Model\EntityId; |
| 11 | use App\User\Domain\Model\User; |
| 12 | use App\User\Domain\Port\Driven\UserRepository; |
| 13 | use MyLegoCollection\SharedContracts\Dto\IdentityDto; |
| 14 | use MyLegoCollection\SharedContracts\Dto\UserDto; |
| 15 | |
| 16 | /** |
| 17 | * @author Wilhelm Zwertvaegher |
| 18 | */ |
| 19 | class RetrieveUserDtoAdapter implements RetrieveUserDto |
| 20 | { |
| 21 | public function __construct(private readonly UserRepository $userRepository) |
| 22 | { |
| 23 | } |
| 24 | |
| 25 | private function map(?User $user): ?UserDto |
| 26 | { |
| 27 | return null === $user ? null : new UserDto($user->getId(), $user->getIdentityId()); |
| 28 | } |
| 29 | |
| 30 | public function getUserDtoFromId(string $userId): ?UserDto |
| 31 | { |
| 32 | return $this->map($this->userRepository->findById(EntityId::fromString($userId))); |
| 33 | } |