/** * Handle a notification * * @return bool */ public function handle(NotificationInterface $notification, $level) { if (!headers_sent()) { if ($notification instanceof AttributeAwareInterface) { $options = $notification->attributes(); } else { $options = []; } if ($notification instanceof TitleAwareInterface) { $options['header'] = $notification->title(); } header('X-' . $this->identifier . '-Notification-' . self::$messageindex++ . ':' . json_encode(['message' => $notification->message(), 'type' => isset($this->levelMapping[$level]) ? $this->levelMapping[$level] : self::STANDARD, 'options' => $options])); return true; } return true; }
/** * Handle a notification. * * @return boolean */ public function handle(NotificationInterface $notification, $level) { if ($notification instanceof AttributeAwareInterface) { $options = $notification->attributes(); } else { $options = []; } if ($notification instanceof TitleAwareInterface) { $options['header'] = $notification->title(); } $variable = ['message' => $notification->message(), 'type' => isset($this->levelMapping[$level]) ? $this->levelMapping[$level] : self::STANDARD, 'options' => $options]; $current = $this->smarty->getTemplateVars($this->var); if (!$current) { $this->smarty->assign($this->var, [$variable]); } else { $this->smarty->append($this->var, $variable); } return true; }