Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
11 / 11
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
NotificationLogService
100.00% covered (success)
100.00%
11 / 11
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
3
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
 save
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%
9 / 9
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\Service\Data;
4
5use App\Entity\Notification;
6use App\Entity\NotificationLog;
7use App\Service\Notification\Dispatcher\NotificationDispatchResult;
8use Doctrine\ORM\EntityManagerInterface;
9use Psr\Clock\ClockInterface;
10
11/**
12 * @author Wilhelm Zwertvaegher
13 */
14readonly class NotificationLogService implements NotificationLogServiceInterface
15{
16    public function __construct(
17        private EntityManagerInterface $entityManager,
18        private ClockInterface $clock)
19    {
20    }
21
22    public function save(NotificationLog $notificationLog): void
23    {
24        $this->entityManager->persist($notificationLog);
25    }
26
27    public function createFromNotification(Notification $notification, NotificationDispatchResult $result): NotificationLog
28    {
29        $notificationLog = new NotificationLog(
30            notification: $notification,
31            sender: $result->getSender(),
32            status: $result->getStatus(),
33            statusMessage: $result->getMessage(),
34            createdAt: $this->clock->now()
35        );
36        $this->save($notificationLog);
37
38        return $notificationLog;
39    }
40}

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.

NotificationLogService->__construct
16    public function __construct(
17        private EntityManagerInterface $entityManager,
18        private ClockInterface $clock)
19    {
20    }
NotificationLogService->createFromNotification
27    public function createFromNotification(Notification $notification, NotificationDispatchResult $result): NotificationLog
28    {
29        $notificationLog = new NotificationLog(
30            notification: $notification,
31            sender: $result->getSender(),
32            status: $result->getStatus(),
33            statusMessage: $result->getMessage(),
34            createdAt: $this->clock->now()
35        );
36        $this->save($notificationLog);
37
38        return $notificationLog;
39    }
NotificationLogService->save
22    public function save(NotificationLog $notificationLog): void
23    {
24        $this->entityManager->persist($notificationLog);
25    }
{main}
3namespace App\Service\Data;
4
5use App\Entity\Notification;
6use App\Entity\NotificationLog;
7use App\Service\Notification\Dispatcher\NotificationDispatchResult;
8use Doctrine\ORM\EntityManagerInterface;
9use Psr\Clock\ClockInterface;
10
11/**
12 * @author Wilhelm Zwertvaegher
13 */
14readonly class NotificationLogService implements NotificationLogServiceInterface
15{
16    public function __construct(
17        private EntityManagerInterface $entityManager,
18        private ClockInterface $clock)
19    {
20    }
21
22    public function save(NotificationLog $notificationLog): void
23    {
24        $this->entityManager->persist($notificationLog);
25    }
26
27    public function createFromNotification(Notification $notification, NotificationDispatchResult $result): NotificationLog
28    {
29        $notificationLog = new NotificationLog(
30            notification: $notification,
31            sender: $result->getSender(),
32            status: $result->getStatus(),
33            statusMessage: $result->getMessage(),
34            createdAt: $this->clock->now()
35        );
36        $this->save($notificationLog);
37
38        return $notificationLog;
39    }