/** * Process task notification * @param NotificationMessage $message * @param TaskNotificationRules $rule * @param string $action */ protected static function processTaskNotification(NotificationMessage $message, TaskNotificationRules $rule, $action) { assert('is_string($action)'); $users = $rule->getUsers(); //This scenario would be there when there is only one subscriber. In that case users would //be zero if (count($users) == 0) { return; } $notifications = static::resolveAndGetNotifications($users, $rule->getType(), $message, $rule->allowDuplicates()); if (static::resolveShouldSendEmailIfCritical() && $rule->isCritical()) { foreach ($notifications as $notification) { static::sendTaskEmail($notification, $rule, $action); } } }