| Total Complexity | 12 |
| Total Lines | 79 |
| Duplicated Lines | 0 % |
| Coverage | 70% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | final class Message implements MessageInterface |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var array<string> |
||
| 14 | */ |
||
| 15 | private array $msg = []; |
||
| 16 | |||
| 17 | private int $senderId; |
||
| 18 | |||
| 19 | private ?int $recipientId; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param array<string>|null $msg |
||
| 23 | */ |
||
| 24 | 40 | public function __construct( |
|
| 25 | ?int $senderId = null, |
||
| 26 | ?int $recipientId = null, |
||
| 27 | ?array $msg = null |
||
| 28 | ) { |
||
| 29 | 40 | $this->senderId = $senderId ?? UserEnum::USER_NOONE; |
|
| 30 | 40 | $this->recipientId = $recipientId; |
|
| 31 | 40 | if ($msg !== null) { |
|
| 32 | 8 | $this->msg = $msg; |
|
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | 1 | public function getSenderId(): int |
|
| 37 | { |
||
| 38 | 1 | return $this->senderId; |
|
| 39 | } |
||
| 40 | |||
| 41 | 12 | public function getRecipientId(): ?int |
|
| 44 | } |
||
| 45 | |||
| 46 | 31 | public function getMessage(): array |
|
| 47 | { |
||
| 48 | 31 | return $this->msg; |
|
| 49 | } |
||
| 50 | |||
| 51 | 21 | public function add(?string $msg): void |
|
| 52 | { |
||
| 53 | 21 | if ($msg === null) { |
|
| 54 | 2 | return; |
|
| 55 | } |
||
| 56 | |||
| 57 | 19 | $this->msg[] = $msg; |
|
| 58 | } |
||
| 59 | |||
| 60 | public function addInformation(?string $information): InformationInterface |
||
| 65 | } |
||
| 66 | |||
| 67 | public function addInformationf(string $information, ...$args): InformationInterface |
||
| 75 | } |
||
| 76 | |||
| 77 | 7 | public function addMessageMerge(array $msg): void |
|
| 84 | } |
||
| 85 | |||
| 86 | 5 | public function isEmpty(): bool |
|
| 91 |