Skip to content

Commit f877245

Browse files
committed
ICL: Notification recipients filtration added.
1 parent d5c747d commit f877245

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Loggable.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private function getLogHandlers()
7272

7373
protected function getMailerHandler()
7474
{
75-
$recipients = $this->getNotificationRecipients();
75+
$recipients = $this->getFilteredNotificationRecipients();
7676
if (empty($recipients)) {
7777
return false;
7878
}
@@ -88,6 +88,20 @@ protected function getMailerHandler()
8888
return $mailerHandler;
8989
}
9090

91+
private function getFilteredNotificationRecipients()
92+
{
93+
$result = [];
94+
95+
$recipients = $this->getNotificationRecipients();
96+
foreach ($recipients as $recipient) {
97+
if (!empty($recipient['address']) && filter_var($recipient['address'], FILTER_VALIDATE_EMAIL)) {
98+
$result[] = $recipient;
99+
}
100+
}
101+
102+
return $result;
103+
}
104+
91105
protected function logDebug($message, array $context = [])
92106
{
93107
return $this->icLogger->debug($message, $context);

0 commit comments

Comments
 (0)