Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
5 / 5
CRAP
100.00% covered (success)
100.00%
1 / 1
NotificationLogRepository
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
5 / 5
5
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
 findByNotificationId
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
 findByNotificationIdAndSenderAndStatus
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
 findByNotificationIdAndStatus
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
 hasSuccess
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\Repository;
4
5use App\Entity\NotificationLog;
6use App\Enum\NotificationLogStatus;
7use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
8use Doctrine\Persistence\ManagerRegistry;
9
10/**
11 * @author Wilhelm Zwertvaegher
12 *
13 * @extends ServiceEntityRepository<NotificationLog>
14 */
15class NotificationLogRepository extends ServiceEntityRepository implements NotificationLogRepositoryInterface
16{
17    public function __construct(ManagerRegistry $managerRegistry)
18    {
19        parent::__construct($managerRegistry, NotificationLog::class);
20    }
21
22    /**
23     * @return array<NotificationLog>
24     */
25    public function findByNotificationId(int $notificationId): array
26    {
27        return parent::findBy(['notification' => $notificationId]);
28    }
29
30    /**
31     * @return array<NotificationLog>
32     */
33    public function findByNotificationIdAndSenderAndStatus(int $notificationId, string $sender, NotificationLogStatus $status): array
34    {
35        return parent::findBy(['notification' => $notificationId, 'sender' => $sender, 'status' => $status]);
36    }
37
38    /**
39     * @return array<NotificationLog>
40     */
41    public function findByNotificationIdAndStatus(int $notificationId, NotificationLogStatus $status): array
42    {
43        return parent::findBy(['notification' => $notificationId, 'status' => $status]);
44    }
45
46    public function hasSuccess(int $notificationId, string $sender): bool
47    {
48        return count($this->findByNotificationIdAndSenderAndStatus($notificationId, $sender, NotificationLogStatus::SENT)) > 0;
49    }
50}