| Total Complexity | 8 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class MessageStrategy implements EmailStrategyInterface { |
||
| 11 | |||
| 12 | public function __construct(private readonly NotificationSettings $notificationSettings) { } |
||
| 13 | |||
| 14 | public function supports(Notification $notification): bool { |
||
| 15 | return $notification instanceof MessageNotification |
||
| 16 | // Da es sich um eine Massen-Benachrichtigung handelt, sind nur ausgewählte Benutzertypen erlaubt |
||
| 17 | && ArrayUtils::inArray($notification->getRecipient()->getUserType(), $this->notificationSettings->getEmailEnabledUserTypes()) !== false; |
||
| 18 | } |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @param MessageNotification $notification |
||
| 22 | * @return string|null |
||
| 23 | */ |
||
| 24 | public function getReplyTo(Notification $notification): ?string { |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param MessageNotification $notification |
||
| 30 | * @return string |
||
| 31 | */ |
||
| 32 | public function getSender(Notification $notification): string { |
||
| 33 | $user = $notification->getMessage()->getCreatedBy(); |
||
| 34 | |||
| 35 | if($user === null) { |
||
| 36 | return 'N/A'; |
||
| 37 | } |
||
| 38 | |||
| 39 | return sprintf('%s %s', $user->getFirstname(), $user->getLastname()); |
||
| 40 | } |
||
| 41 | |||
| 42 | public function getTemplate(): string { |
||
| 43 | return 'email/message.txt.twig'; |
||
| 44 | } |
||
| 45 | |||
| 46 | public function getHtmlTemplate(): ?string { |
||
| 48 | } |
||
| 49 | } |