Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
12 / 12
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
DefaultNotificationLogService
100.00% covered (success)
100.00%
12 / 12
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
 createFromNotification
100.00% covered (success)
100.00%
11 / 11
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\Notification\Domain\Service;
4
5use App\Notification\Domain\Model\Notification;
6use App\Notification\Domain\Model\NotificationLog;
7use App\Notification\Domain\Model\NotificationDispatchResult;
8use App\Shared\Domain\Model\EntityId;
9use App\Shared\Domain\Port\Driven\Clock;
10
11/**
12 * @author Wilhelm Zwertvaegher
13 */
14class DefaultNotificationLogService implements NotificationLogService
15{
16    public function __construct(private readonly Clock $clock)
17    {
18    }
19
20    public function createFromNotification(Notification $notification, NotificationDispatchResult $result): NotificationLog
21    {
22        return NotificationLog::create(
23            EntityId::generate(),
24            EntityId::fromString($notification->getIdentityInfo()->getIdentityId()),
25            null,
26            EntityId::fromString($notification->getMessageId()),
27            $notification->getType(),
28            $result->getSender(),
29            $result->getStatus(),
30            $result->getMessage(),
31            $this->clock->getNow()
32        );
33    }
34}

Branches

Below are the source code lines that represent each code branch as identified by Xdebug. Please note a branch is not necessarily coterminous with a line, a line may contain multiple branches and therefore show up more than once. Please also be aware that some branches may be implicit rather than explicit, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

DefaultNotificationLogService->__construct
16    public function __construct(private readonly Clock $clock)
17    {
18    }
DefaultNotificationLogService->createFromNotification
20    public function createFromNotification(Notification $notification, NotificationDispatchResult $result): NotificationLog
21    {
22        return NotificationLog::create(
23            EntityId::generate(),
24            EntityId::fromString($notification->getIdentityInfo()->getIdentityId()),
25            null,
26            EntityId::fromString($notification->getMessageId()),
27            $notification->getType(),
28            $result->getSender(),
29            $result->getStatus(),
30            $result->getMessage(),
31            $this->clock->getNow()
32        );
33    }
{main}
3namespace App\Notification\Domain\Service;
4
5use App\Notification\Domain\Model\Notification;
6use App\Notification\Domain\Model\NotificationLog;
7use App\Notification\Domain\Model\NotificationDispatchResult;
8use App\Shared\Domain\Model\EntityId;
9use App\Shared\Domain\Port\Driven\Clock;
10
11/**
12 * @author Wilhelm Zwertvaegher
13 */
14class DefaultNotificationLogService implements NotificationLogService
15{
16    public function __construct(private readonly Clock $clock)
17    {
18    }
19
20    public function createFromNotification(Notification $notification, NotificationDispatchResult $result): NotificationLog
21    {
22        return NotificationLog::create(
23            EntityId::generate(),
24            EntityId::fromString($notification->getIdentityInfo()->getIdentityId()),
25            null,
26            EntityId::fromString($notification->getMessageId()),
27            $notification->getType(),
28            $result->getSender(),
29            $result->getStatus(),
30            $result->getMessage(),
31            $this->clock->getNow()
32        );
33    }