/** * Handle a notification * * @return bool */ public function handle(NotificationInterface $notification, $level) { if ($notification instanceof AttributeAwareInterface) { $notify = $notification->attribute('notify'); $format = $notification->attribute('format') ?: HipChat::FORMAT_HTML; } else { $format = HipChat::FORMAT_HTML; $notify = true; } return $this->hipchat->message_room($this->room, $this->from, $notification->message(), $notify, $this->levelMapping[$level], $format); }
/** * Handle a notification * * @return bool */ public function handle(NotificationInterface $notification, $level) { if ($notification instanceof TitleAwareInterface) { $command = $this->shellCommand . ' ' . escapeshellarg($notification->message()) . ' ' . escapeshellarg($notification->title()); } else { $command = $this->shellCommand . ' ' . escapeshellarg($notification->message()); } if ($notification instanceof AttributeAwareInterface) { $expiry = (int) $notification->attribute('expiry'); if ($expiry) { $command .= "-t " . $expiry . " "; } $icon = $notification->attribute('icon'); if ($expiry) { $command .= "-i " . $icon . " "; } } $command .= "-u " . $this->levelMapping[$level] . " "; exec($command . ' > /dev/null', $output, $code); return $code === 0; }