/** * @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; }
public function __construct($name, AbstractCollector $collector) { $this->collector = $collector; parent::__construct($name); }
/** * * @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); }
public function __construct(string $name, Collector $collector) { $this->collector = $collector; parent::__construct($name); }