Example #1
0
 /**
  * @param BaseEvent|CollectorEntry $event
  *
  * @return BaseEvent
  */
 public function dispatch(BaseEvent $event) : BaseEvent
 {
     if (!$event instanceof CollectorEntry) {
         throw new InvalidArgumentException('Invalid event type. Expected ' . CollectorEntry::class);
     }
     $this->collection->sort();
     $collector = $event->getCollector();
     /** @var Route $handler */
     foreach ($this->router->match($event) as $handler) {
         $callback = $handler->getAction();
         $callback($collector);
     }
     return $event;
 }
Example #2
0
 public function __construct($name, AbstractCollector $collector)
 {
     $this->collector = $collector;
     parent::__construct($name);
 }
Example #3
0
 /**
  * 
  * @param   \Opis\Colibri\Application   $app
  * @param   string                      $name
  * @param   boolean                     $cancelable (optional)
  */
 public function __construct(Application $app, $name, $cancelable = false)
 {
     $this->app = $app;
     parent::__construct($name, $cancelable);
 }
Example #4
0
 public function __construct(string $name, Collector $collector)
 {
     $this->collector = $collector;
     parent::__construct($name);
 }