public function getNotifications(LoggerInterface $logger)
 {
     $updates = $this->getUpdates();
     $notifications = array();
     if ($updates['data'][1]) {
         foreach ($updates['data'][1] as $message) {
             $message = strip_tags($message);
             $notifications[] = Notification::create($message, 'notification-message-im')->setUrgency(Notification::URGENCY_CRITICAL);
         }
     }
     $lastChecked = \DateTime::createFromFormat('U', $updates['data'][0]);
     $this->updateLastChecked($lastChecked);
     return $notifications;
 }
<?php

namespace Kyoushu\DesktopNotifications;

use Monolog\Handler\StreamHandler;
use Monolog\Logger;
require_once __DIR__ . '/vendor/autoload.php';
$logger = new Logger('log', array(new StreamHandler(__DIR__ . '/logs/notification.log'), new StreamHandler('php://output')));
try {
    TaskManager::processTasks($logger);
} catch (\Exception $e) {
    Notification::create($e->getMessage(), Notification::ICON_ERROR)->send();
}
 public function getNotifications(LoggerInterface $logger)
 {
     if (!$this->isCheckPending()) {
         $logger->info('no check pending', array('package_name' => $this->packageName));
         return array();
     }
     $stats = $this->getStats();
     $lastStats = $this->getLastStats();
     if ($lastStats === null) {
         $this->setLastStats($stats);
     }
     $this->setLastChecked(new \DateTime('now'));
     if ($lastStats !== null) {
         $downloadDiff = $stats['downloads']['total'] - $lastStats['downloads']['total'];
         if ($downloadDiff < $this->downloadInterval) {
             $logger->info('download total diff has not passed interval', array('package_name' => $this->packageName, 'diff' => $downloadDiff, 'interval' => $this->downloadInterval));
             return array();
         }
     }
     $this->setLastStats($stats);
     return array(Notification::create(sprintf('%s just passed %s downloads!', $this->packageName, $stats['downloads']['total']), 'face-smile-big-symbolic')->setUrgency(Notification::URGENCY_CRITICAL));
 }