Namshi\Notificator\Manager::trigger PHP Method

trigger() public method

public trigger ( Namshi\Notificator\NotificationInterface $notification )
$notification Namshi\Notificator\NotificationInterface
    public function trigger(NotificationInterface $notification)
    {
        foreach ($this->getHandlers() as $handler) {
            if ($handler->shouldHandle($notification)) {
                if ($logger = $this->getLogger()) {
                    $message = sprintf('notification handler "%s" processed message', get_class($handler));
                    $logger->info($message, array('Notification' => serialize($notification)));
                }
                if (false === $handler->handle($notification)) {
                    return true;
                }
            }
        }
        return true;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function handle(NotificationInterface $notification)
 {
     /** @var ChainedNotificationInterface $notification */
     foreach ($notification->getNotifications() as $notify) {
         $this->manager->trigger($notify);
     }
 }
All Usage Examples Of Namshi\Notificator\Manager::trigger