Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
18 / 18 |
|
100.00% |
12 / 12 |
CRAP | |
100.00% |
1 / 1 |
| ChatMessage | |
100.00% |
18 / 18 |
|
100.00% |
12 / 12 |
12 | |
100.00% |
1 / 1 |
| getId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setId | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getSenderId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setSenderId | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getRecipientId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setRecipientId | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getMessage | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setMessage | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| isRead | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setIsRead | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getCreatedAt | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setCreatedAt | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * The ChatMessage entity class. |
| 5 | * |
| 6 | * This Source Code Form is subject to the terms of the Mozilla Public License, |
| 7 | * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
| 8 | * obtain one at https://mozilla.org/MPL/2.0/. |
| 9 | * |
| 10 | * @package phpMyFAQ\Entity |
| 11 | * @author Thorsten Rinne <thorsten@phpmyfaq.de> |
| 12 | * @copyright 2026 phpMyFAQ Team |
| 13 | * @license https://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
| 14 | * @link https://www.phpmyfaq.de |
| 15 | * @since 2026-01-19 |
| 16 | */ |
| 17 | |
| 18 | declare(strict_types=1); |
| 19 | |
| 20 | namespace phpMyFAQ\Entity; |
| 21 | |
| 22 | use DateTimeImmutable; |
| 23 | |
| 24 | class ChatMessage |
| 25 | { |
| 26 | public int $id; |
| 27 | |
| 28 | public int $senderId; |
| 29 | |
| 30 | public int $recipientId; |
| 31 | |
| 32 | public string $message; |
| 33 | |
| 34 | public bool $isRead; |
| 35 | |
| 36 | public DateTimeImmutable $createdAt; |
| 37 | |
| 38 | public function getId(): int |
| 39 | { |
| 40 | return $this->id; |
| 41 | } |
| 42 | |
| 43 | public function setId(int $id): ChatMessage |
| 44 | { |
| 45 | $this->id = $id; |
| 46 | return $this; |
| 47 | } |
| 48 | |
| 49 | public function getSenderId(): int |
| 50 | { |
| 51 | return $this->senderId; |
| 52 | } |
| 53 | |
| 54 | public function setSenderId(int $senderId): ChatMessage |
| 55 | { |
| 56 | $this->senderId = $senderId; |
| 57 | return $this; |
| 58 | } |
| 59 | |
| 60 | public function getRecipientId(): int |
| 61 | { |
| 62 | return $this->recipientId; |
| 63 | } |
| 64 | |
| 65 | public function setRecipientId(int $recipientId): ChatMessage |
| 66 | { |
| 67 | $this->recipientId = $recipientId; |
| 68 | return $this; |
| 69 | } |
| 70 | |
| 71 | public function getMessage(): string |
| 72 | { |
| 73 | return $this->message; |
| 74 | } |
| 75 | |
| 76 | public function setMessage(string $message): ChatMessage |
| 77 | { |
| 78 | $this->message = $message; |
| 79 | return $this; |
| 80 | } |
| 81 | |
| 82 | public function isRead(): bool |
| 83 | { |
| 84 | return $this->isRead; |
| 85 | } |
| 86 | |
| 87 | public function setIsRead(bool $isRead): ChatMessage |
| 88 | { |
| 89 | $this->isRead = $isRead; |
| 90 | return $this; |
| 91 | } |
| 92 | |
| 93 | public function getCreatedAt(): DateTimeImmutable |
| 94 | { |
| 95 | return $this->createdAt; |
| 96 | } |
| 97 | |
| 98 | public function setCreatedAt(DateTimeImmutable $createdAt): ChatMessage |
| 99 | { |
| 100 | $this->createdAt = $createdAt; |
| 101 | return $this; |
| 102 | } |
| 103 | } |