Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
15 / 15
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
9 / 9
CRAP
100.00% covered (success)
100.00%
1 / 1
User
100.00% covered (success)
100.00%
15 / 15
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
9 / 9
9
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
 create
100.00% covered (success)
100.00%
3 / 3
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
 getId
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
 getIdentityId
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
 getCreatedAt
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
 getUpdatedAt
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
 getAvatar
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
 setAvatar
100.00% covered (success)
100.00%
3 / 3
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
 pullEvents
100.00% covered (success)
100.00%
3 / 3
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\User\Domain\Model;
4
5use App\Shared\Domain\Event\DomainEvent;
6use App\Shared\Domain\Model\ProducesDomainEvents;
7use App\Shared\Domain\Model\StoredFile;
8use App\Shared\Domain\Model\EntityId;
9use App\User\Domain\Event\AvatarUpdatedEvent;
10use App\User\Domain\Event\UserCreatedEvent;
11use DateTimeImmutable;
12
13class User implements ProducesDomainEvents
14{
15    /**
16     * @var array<DomainEvent>
17     */
18    private array $events = [];
19
20
21    /**
22     * @param EntityId $id
23     * @param EntityId $identityId
24     * @param DateTimeImmutable $createdAt
25     * @param DateTimeImmutable $updatedAt
26     * @param StoredFile|null $avatar
27     */
28    public function __construct(
29        private readonly EntityId           $id,
30        private readonly EntityId           $identityId,
31        private readonly DateTimeImmutable $createdAt,
32        private readonly DateTimeImmutable $updatedAt,
33        private readonly ?StoredFile $avatar = null
34    ) {
35    }
36
37    public static function create(
38        EntityId           $id,
39        EntityId           $identityId,
40        DateTimeImmutable $createdAt,
41        DateTimeImmutable $updatedAt,
42        ?StoredFile $avatar = null
43    ): self {
44        $newUser = new self($id, $identityId, $createdAt, $updatedAt, $avatar);
45        $newUser->events = [new UserCreatedEvent($newUser)];
46        return $newUser;
47    }
48
49    public function getId(): EntityId
50    {
51        return $this->id;
52    }
53
54    public function getIdentityId(): EntityId
55    {
56        return $this->identityId;
57    }
58
59    public function getCreatedAt(): DateTimeImmutable
60    {
61        return $this->createdAt;
62    }
63
64    public function getUpdatedAt(): DateTimeImmutable
65    {
66        return $this->updatedAt;
67    }
68
69    public function getAvatar(): ?StoredFile
70    {
71        return $this->avatar;
72    }
73
74    public function setAvatar(?StoredFile $avatar): self
75    {
76        $result = new User($this->id, $this->identityId, $this->createdAt, new DateTimeImmutable(), $avatar);
77        $result->events = [new AvatarUpdatedEvent($result)];
78        return $result;
79    }
80
81    /**
82     * @return array<DomainEvent>
83     */
84    public function pullEvents(): array
85    {
86        $events = $this->events;
87        $this->events = [];
88        return $events;
89    }
90}

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.

User->__construct
28    public function __construct(
29        private readonly EntityId           $id,
30        private readonly EntityId           $identityId,
31        private readonly DateTimeImmutable $createdAt,
32        private readonly DateTimeImmutable $updatedAt,
33        private readonly ?StoredFile $avatar = null
34    ) {
35    }
User->create
37    public static function create(
38        EntityId           $id,
39        EntityId           $identityId,
40        DateTimeImmutable $createdAt,
41        DateTimeImmutable $updatedAt,
42        ?StoredFile $avatar = null
43    ): self {
44        $newUser = new self($id, $identityId, $createdAt, $updatedAt, $avatar);
45        $newUser->events = [new UserCreatedEvent($newUser)];
46        return $newUser;
47    }
User->getAvatar
71        return $this->avatar;
72    }
User->getCreatedAt
61        return $this->createdAt;
62    }
User->getId
51        return $this->id;
52    }
User->getIdentityId
56        return $this->identityId;
57    }
User->getUpdatedAt
66        return $this->updatedAt;
67    }
User->pullEvents
86        $events = $this->events;
87        $this->events = [];
88        return $events;
89    }
User->setAvatar
74    public function setAvatar(?StoredFile $avatar): self
75    {
76        $result = new User($this->id, $this->identityId, $this->createdAt, new DateTimeImmutable(), $avatar);
77        $result->events = [new AvatarUpdatedEvent($result)];
78        return $result;
79    }
{main}
3namespace App\User\Domain\Model;
4
5use App\Shared\Domain\Event\DomainEvent;
6use App\Shared\Domain\Model\ProducesDomainEvents;
7use App\Shared\Domain\Model\StoredFile;
8use App\Shared\Domain\Model\EntityId;
9use App\User\Domain\Event\AvatarUpdatedEvent;
10use App\User\Domain\Event\UserCreatedEvent;
11use DateTimeImmutable;
12
13class User implements ProducesDomainEvents
14{
15    /**
16     * @var array<DomainEvent>
17     */
18    private array $events = [];
19
20
21    /**
22     * @param EntityId $id
23     * @param EntityId $identityId
24     * @param DateTimeImmutable $createdAt
25     * @param DateTimeImmutable $updatedAt
26     * @param StoredFile|null $avatar
27     */
28    public function __construct(
29        private readonly EntityId           $id,
30        private readonly EntityId           $identityId,
31        private readonly DateTimeImmutable $createdAt,
32        private readonly DateTimeImmutable $updatedAt,
33        private readonly ?StoredFile $avatar = null
34    ) {
35    }
36
37    public static function create(
38        EntityId           $id,
39        EntityId           $identityId,
40        DateTimeImmutable $createdAt,
41        DateTimeImmutable $updatedAt,
42        ?StoredFile $avatar = null
43    ): self {
44        $newUser = new self($id, $identityId, $createdAt, $updatedAt, $avatar);
45        $newUser->events = [new UserCreatedEvent($newUser)];
46        return $newUser;
47    }
48
49    public function getId(): EntityId
50    {
51        return $this->id;
52    }
53
54    public function getIdentityId(): EntityId
55    {
56        return $this->identityId;
57    }
58
59    public function getCreatedAt(): DateTimeImmutable
60    {
61        return $this->createdAt;
62    }
63
64    public function getUpdatedAt(): DateTimeImmutable
65    {
66        return $this->updatedAt;
67    }
68
69    public function getAvatar(): ?StoredFile
70    {
71        return $this->avatar;
72    }
73
74    public function setAvatar(?StoredFile $avatar): self
75    {
76        $result = new User($this->id, $this->identityId, $this->createdAt, new DateTimeImmutable(), $avatar);
77        $result->events = [new AvatarUpdatedEvent($result)];
78        return $result;
79    }
80
81    /**
82     * @return array<DomainEvent>
83     */
84    public function pullEvents(): array
85    {
86        $events = $this->events;
87        $this->events = [];
88        return $events;
89    }