/** * Dispatch route's rule and arguments for matching. * * @param array $args */ public function dispatch(array $args) { if (count($args) !== 2) { throw new \InvalidArgumentException('Route method is expecting two arguments.'); } if (!$this->app->arrIsAssoc($args[1])) { throw new \InvalidArgumentException('Invalid data type. Second argument must be associative array.'); } $this->rule = $args[0]; $this->filters = $args[1]; if ($this->fulfill = $this->matchRoute()) { $this->setRouteParams()->initController(); } }