Example #1
0
 /**
  * Execute the action
  *
  * @access public
  * @param  \Event\GenericEvent   $event   Event data dictionary
  * @return bool                           True if the action was executed or false when not executed
  */
 public function execute(GenericEvent $event)
 {
     // Avoid infinite loop, a listener instance can be called only one time
     if ($this->called) {
         return false;
     }
     $data = $event->getAll();
     if ($this->isExecutable($data)) {
         $this->called = true;
         return $this->doAction($data);
     }
     return false;
 }
Example #2
0
 /**
  * Execute the action
  *
  * @access public
  * @param  \Event\GenericEvent   $event   Event data dictionary
  * @return bool                           True if the action was executed or false when not executed
  */
 public function execute(GenericEvent $event)
 {
     // Avoid infinite loop, a listener instance can be called only one time
     if ($this->called) {
         return false;
     }
     $data = $event->getAll();
     $result = false;
     if ($this->isExecutable($data)) {
         $this->called = true;
         $result = $this->doAction($data);
     }
     if (DEBUG) {
         $this->container['logger']->debug(get_called_class() . ' => ' . ($result ? 'true' : 'false'));
     }
     return $result;
 }
Example #3
0
 public function execute(GenericEvent $event, $event_name)
 {
     $payload = array('event_name' => $event_name, 'event_data' => $event->getAll());
     $this->webhook->notify($payload);
 }