Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
42.86% covered (danger)
42.86%
3 / 7
66.67% covered (warning)
66.67%
6 / 9
66.67% covered (warning)
66.67%
4 / 6
75.00% covered (warning)
75.00%
3 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
RetrieveIdentityInfoAdapter
42.86% covered (danger)
42.86%
3 / 7
66.67% covered (warning)
66.67%
6 / 9
66.67% covered (warning)
66.67%
4 / 6
75.00% covered (warning)
75.00%
3 / 4
7.33
0.00% covered (danger)
0.00%
0 / 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
 getIdentityInfoFromId
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
 getIdentityInfoFromUserId
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace App\Notification\Application\Adapter;
4
5use App\Notification\Application\Port\Driven\RetrieveIdentityDto;
6use App\Notification\Application\Port\Driven\RetrieveUserDto;
7use App\Notification\Domain\Model\IdentityInfo;
8use App\Notification\Domain\Port\Driven\RetrieveIdentityInfo;
9use MyLegoCollection\SharedContracts\Dto\IdentityDto;
10
11/**
12 * @author Wilhelm Zwertvaegher
13 */
14readonly class RetrieveIdentityInfoAdapter implements RetrieveIdentityInfo
15{
16
17    public function __construct(
18        private RetrieveIdentityDto $retrieveIdentityDto,
19        private RetrieveUserDto $retrieveUserDto
20    )
21    {
22    }
23
24    private function map(?IdentityDto $identityDto): ?IdentityInfo
25    {
26        return null === $identityDto ? null : new IdentityInfo($identityDto->getId(), $identityDto->getEmail(), $identityDto->getUsername());
27    }
28
29    public function getIdentityInfoFromId(string $identityId): ?IdentityInfo
30    {
31        return $this->map($this->retrieveIdentityDto->getIdentityDtoFromId($identityId));
32    }
33
34    public function getIdentityInfoFromUserId(string $userId): ?IdentityInfo
35    {
36        $userDto = $this->retrieveUserDto->getUserDtoFromId($userId);
37        if (null === $userDto) {
38            return null;
39        }
40
41        return $this->getIdentityInfoFromId($userDto->getIdentityId());
42    }
43}

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.

RetrieveIdentityInfoAdapter->__construct
17    public function __construct(
18        private RetrieveIdentityDto $retrieveIdentityDto,
19        private RetrieveUserDto $retrieveUserDto
20    )
21    {
22    }
RetrieveIdentityInfoAdapter->getIdentityInfoFromId
29    public function getIdentityInfoFromId(string $identityId): ?IdentityInfo
30    {
31        return $this->map($this->retrieveIdentityDto->getIdentityDtoFromId($identityId));
32    }
RetrieveIdentityInfoAdapter->getIdentityInfoFromUserId
34    public function getIdentityInfoFromUserId(string $userId): ?IdentityInfo
35    {
36        $userDto = $this->retrieveUserDto->getUserDtoFromId($userId);
37        if (null === $userDto) {
 
38            return null;
34    public function getIdentityInfoFromUserId(string $userId): ?IdentityInfo
35    {
36        $userDto = $this->retrieveUserDto->getUserDtoFromId($userId);
37        if (null === $userDto) {
 
41        return $this->getIdentityInfoFromId($userDto->getIdentityId());
42    }
RetrieveIdentityInfoAdapter->map
24    private function map(?IdentityDto $identityDto): ?IdentityInfo
25    {
26        return null === $identityDto ? null : new IdentityInfo($identityDto->getId(), $identityDto->getEmail(), $identityDto->getUsername());
 
26        return null === $identityDto ? null : new IdentityInfo($identityDto->getId(), $identityDto->getEmail(), $identityDto->getUsername());
 
26        return null === $identityDto ? null : new IdentityInfo($identityDto->getId(), $identityDto->getEmail(), $identityDto->getUsername());
27    }
24    private function map(?IdentityDto $identityDto): ?IdentityInfo
25    {
26        return null === $identityDto ? null : new IdentityInfo($identityDto->getId(), $identityDto->getEmail(), $identityDto->getUsername());
 
26        return null === $identityDto ? null : new IdentityInfo($identityDto->getId(), $identityDto->getEmail(), $identityDto->getUsername());
 
26        return null === $identityDto ? null : new IdentityInfo($identityDto->getId(), $identityDto->getEmail(), $identityDto->getUsername());
27    }
{main}
3namespace App\Notification\Application\Adapter;
4
5use App\Notification\Application\Port\Driven\RetrieveIdentityDto;
6use App\Notification\Application\Port\Driven\RetrieveUserDto;
7use App\Notification\Domain\Model\IdentityInfo;
8use App\Notification\Domain\Port\Driven\RetrieveIdentityInfo;
9use MyLegoCollection\SharedContracts\Dto\IdentityDto;
10
11/**
12 * @author Wilhelm Zwertvaegher
13 */
14readonly class RetrieveIdentityInfoAdapter implements RetrieveIdentityInfo
15{
16
17    public function __construct(
18        private RetrieveIdentityDto $retrieveIdentityDto,
19        private RetrieveUserDto $retrieveUserDto
20    )
21    {
22    }
23
24    private function map(?IdentityDto $identityDto): ?IdentityInfo
25    {
26        return null === $identityDto ? null : new IdentityInfo($identityDto->getId(), $identityDto->getEmail(), $identityDto->getUsername());
27    }
28
29    public function getIdentityInfoFromId(string $identityId): ?IdentityInfo
30    {
31        return $this->map($this->retrieveIdentityDto->getIdentityDtoFromId($identityId));
32    }
33
34    public function getIdentityInfoFromUserId(string $userId): ?IdentityInfo
35    {
36        $userDto = $this->retrieveUserDto->getUserDtoFromId($userId);
37        if (null === $userDto) {
38            return null;
39        }
40
41        return $this->getIdentityInfoFromId($userDto->getIdentityId());
42    }