Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
RetrieveIdentityDtoAdapter
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
3 / 3
4
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
 map
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
 getIdentityDtoFromId
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
1<?php
2
3namespace App\Auth\Infrastructure\Adapter;
4
5use App\Auth\Domain\Model\Identity;
6use App\Auth\Domain\Port\Driven\IdentityRepository;
7use App\Notification\Application\Port\Driven\RetrieveIdentityDto;
8use App\Notification\Domain\Model\IdentityInfo;
9use App\Shared\Domain\Model\EntityId;
10use MyLegoCollection\SharedContracts\Dto\IdentityDto;
11
12/**
13 * @author Wilhelm Zwertvaegher
14 */
15readonly class RetrieveIdentityDtoAdapter implements RetrieveIdentityDto
16{
17    public function __construct(private IdentityRepository $identityRepository)
18    {
19    }
20
21    private function map(?Identity $identity): ?IdentityDto
22    {
23        return null === $identity ? null : new IdentityDto($identity->getId(), $identity->getEmail(), $identity->getUsername());
24    }
25
26    public function getIdentityDtoFromId(string $identityId): ?IdentityDto
27    {
28        return $this->map($this->identityRepository->findById(EntityId::fromString($identityId)));
29    }
30}

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.

RetrieveIdentityDtoAdapter->__construct
17    public function __construct(private IdentityRepository $identityRepository)
18    {
19    }
RetrieveIdentityDtoAdapter->getIdentityDtoFromId
26    public function getIdentityDtoFromId(string $identityId): ?IdentityDto
27    {
28        return $this->map($this->identityRepository->findById(EntityId::fromString($identityId)));
29    }
RetrieveIdentityDtoAdapter->map
21    private function map(?Identity $identity): ?IdentityDto
22    {
23        return null === $identity ? null : new IdentityDto($identity->getId(), $identity->getEmail(), $identity->getUsername());
 
23        return null === $identity ? null : new IdentityDto($identity->getId(), $identity->getEmail(), $identity->getUsername());
 
23        return null === $identity ? null : new IdentityDto($identity->getId(), $identity->getEmail(), $identity->getUsername());
24    }
21    private function map(?Identity $identity): ?IdentityDto
22    {
23        return null === $identity ? null : new IdentityDto($identity->getId(), $identity->getEmail(), $identity->getUsername());
 
23        return null === $identity ? null : new IdentityDto($identity->getId(), $identity->getEmail(), $identity->getUsername());
 
23        return null === $identity ? null : new IdentityDto($identity->getId(), $identity->getEmail(), $identity->getUsername());
24    }
{main}
3namespace App\Auth\Infrastructure\Adapter;
4
5use App\Auth\Domain\Model\Identity;
6use App\Auth\Domain\Port\Driven\IdentityRepository;
7use App\Notification\Application\Port\Driven\RetrieveIdentityDto;
8use App\Notification\Domain\Model\IdentityInfo;
9use App\Shared\Domain\Model\EntityId;
10use MyLegoCollection\SharedContracts\Dto\IdentityDto;
11
12/**
13 * @author Wilhelm Zwertvaegher
14 */
15readonly class RetrieveIdentityDtoAdapter implements RetrieveIdentityDto
16{
17    public function __construct(private IdentityRepository $identityRepository)
18    {
19    }
20
21    private function map(?Identity $identity): ?IdentityDto
22    {
23        return null === $identity ? null : new IdentityDto($identity->getId(), $identity->getEmail(), $identity->getUsername());
24    }
25
26    public function getIdentityDtoFromId(string $identityId): ?IdentityDto
27    {
28        return $this->map($this->identityRepository->findById(EntityId::fromString($identityId)));
29    }