Example #1
0
 /**
  * Helper method for dispatching events. Silent if an event dispatcher is
  * not set.
  * 
  * @param string $name
  * @param mixed  $arguments [optional]
  * @return array
  */
 protected function event($name, array $arguments = array())
 {
     if ($this->eventDispatcher) {
         return $this->eventDispatcher->dispatch($name, $arguments);
     }
     return array();
 }
Example #2
0
 /**
  * Helper method for unsubscribing objects from the router's event
  * dispatcher.
  * 
  * Silent if $subscriber does not implement `Subscriber`.
  * 
  * @param mixed $subscriber
  * @return bool
  */
 protected function unsubscribe($subscriber)
 {
     if ($this->eventDispatcher && $subscriber instanceof Subscriber) {
         $this->eventDispatcher->unsubscribe($subscriber);
         return true;
     }
     return false;
 }