Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
19 / 19 |
|
100.00% |
12 / 12 |
|
90.91% |
10 / 11 |
|
100.00% |
10 / 10 |
CRAP | |
100.00% |
1 / 1 |
| Notification | |
100.00% |
19 / 19 |
|
100.00% |
12 / 12 |
|
90.91% |
10 / 11 |
|
100.00% |
10 / 10 |
11.09 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getType | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getRecipientEmail | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getSubject | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getContent | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getStatus | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setStatus | |
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
|
50.00% |
1 / 2 |
|
100.00% |
1 / 1 |
2.50 | |||
| getCreatedAt | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getStatusUpdatedAt | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Entity; |
| 4 | |
| 5 | use App\Enum\NotificationStatus; |
| 6 | use App\Enum\NotificationType; |
| 7 | use Doctrine\ORM\Mapping as ORM; |
| 8 | |
| 9 | /** |
| 10 | * @author Wilhelm Zwertvaegher |
| 11 | */ |
| 12 | #[ORM\Entity] |
| 13 | #[ORM\Table(name: 'notification')] |
| 14 | class Notification |
| 15 | { |
| 16 | #[ORM\Id] |
| 17 | #[ORM\GeneratedValue] |
| 18 | #[ORM\Column(type: 'integer')] |
| 19 | private ?int $id = null; |
| 20 | |
| 21 | #[ORM\Column(type: 'string', length: 10, enumType: NotificationType::class)] |
| 22 | private NotificationType $type; |
| 23 | |
| 24 | #[ORM\Column(type: 'string', length: 100)] |
| 25 | private ?string $recipientEmail; |
| 26 | |
| 27 | #[ORM\Column(type: 'text')] |
| 28 | private string $subject; |
| 29 | |
| 30 | #[ORM\Column(type: 'text')] |
| 31 | private string $content; |
| 32 | |
| 33 | #[ORM\Column(type: 'string', length: 10, enumType: NotificationStatus::class)] |
| 34 | private NotificationStatus $status; |
| 35 | |
| 36 | #[ORM\Column(type: 'datetime_immutable')] |
| 37 | private \DateTimeImmutable $createdAt; |
| 38 | |
| 39 | #[ORM\Column(type: 'datetime_immutable')] |
| 40 | private \DateTimeImmutable $statusUpdatedAt; |
| 41 | |
| 42 | public function __construct( |
| 43 | NotificationType $type, |
| 44 | string $recipientEmail, |
| 45 | string $subject, |
| 46 | string $content, |
| 47 | NotificationStatus $status, |
| 48 | \DateTimeImmutable $createdAt, |
| 49 | \DateTimeImmutable $statusUpdatedAt) |
| 50 | { |
| 51 | $this->type = $type; |
| 52 | $this->recipientEmail = $recipientEmail; |
| 53 | $this->subject = $subject; |
| 54 | $this->content = $content; |
| 55 | $this->status = $status; |
| 56 | $this->createdAt = $createdAt; |
| 57 | $this->statusUpdatedAt = $statusUpdatedAt; |
| 58 | } |
| 59 | |
| 60 | public function getId(): ?int |
| 61 | { |
| 62 | return $this->id; |
| 63 | } |
| 64 | |
| 65 | public function getType(): NotificationType |
| 66 | { |
| 67 | return $this->type; |
| 68 | } |
| 69 | |
| 70 | public function getRecipientEmail(): ?string |
| 71 | { |
| 72 | return $this->recipientEmail; |
| 73 | } |
| 74 | |
| 75 | public function getSubject(): string |
| 76 | { |
| 77 | return $this->subject; |
| 78 | } |
| 79 | |
| 80 | public function getContent(): string |
| 81 | { |
| 82 | return $this->content; |
| 83 | } |
| 84 | |
| 85 | public function getStatus(): NotificationStatus |
| 86 | { |
| 87 | return $this->status; |
| 88 | } |
| 89 | |
| 90 | public function setStatus(NotificationStatus $status, \DateTimeImmutable $statusUpdatedAt): self |
| 91 | { |
| 92 | if ($this->status !== $status) { |
| 93 | $this->status = $status; |
| 94 | $this->statusUpdatedAt = $statusUpdatedAt; |
| 95 | } |
| 96 | |
| 97 | return $this; |
| 98 | } |
| 99 | |
| 100 | public function getCreatedAt(): \DateTimeImmutable |
| 101 | { |
| 102 | return $this->createdAt; |
| 103 | } |
| 104 | |
| 105 | public function getStatusUpdatedAt(): \DateTimeImmutable |
| 106 | { |
| 107 | return $this->statusUpdatedAt; |
| 108 | } |
| 109 | } |