protected function tryToRouteIt(RouteCollectionInterface $routes = null)
	{
		if (empty($routes) || ! $routes instanceof RouteCollectionInterface)
		{
			require APPPATH . 'Config/Routes.php';
		}

		// $routes is defined in Config/Routes.php
		$this->router = Services::router($routes);

		$path = $this->determinePath();

		$this->benchmark->stop('bootstrap');
		$this->benchmark->start('routing');

		ob_start();

		$this->controller = $this->router->handle($path);
		$this->method     = $this->router->methodName();

		// If a {locale} segment was matched in the final route,
		// then we need to set the correct locale on our Request.
		if ($this->router->hasLocale())
		{
			$this->request->setLocale($this->router->getLocale());
		}

		$this->benchmark->stop('routing');

		return $this->router->getFilter();
	}
protected function tryToRouteIt(RouteCollectionInterface $routes = null)
	{
		if (empty($routes) || ! $routes instanceof RouteCollectionInterface)
		{
			require APPPATH . 'Config/Routes.php';
		}

		// $routes is defined in Config/Routes.php
		$this->router = Services::router($routes);

		$path = $this->determinePath();

		$this->benchmark->stop('bootstrap');
		$this->benchmark->start('routing');

		ob_start();

		$this->controller = $this->router->handle($path);
		$this->method     = $this->router->methodName();

		// If a {locale} segment was matched in the final route,
		// then we need to set the correct locale on our Request.
		if ($this->router->hasLocale())
		{
			$this->request->setLocale($this->router->getLocale());
		}

		$this->benchmark->stop('routing');

		return $this->router->getFilter();
	}
protected function tryToRouteIt ( RouteCollectionInterface $ routes = null ) { if ( empty ( $ routes ) || ! $ routes instanceof RouteCollectionInterface ) { require APPPATH . 'Config/Routes.php' ; } // $routes is defined in Config/Routes.php $ this -> router = Services :: router ( $ routes ) ; $ path = $ this -> determinePath ( ) ; $ this -> benchmark -> stop ( 'bootstrap' ) ; $ this -> benchmark -> start ( 'routing' ) ; ob_start ( ) ; $ this -> controller = $ this -> router -> handle ( $ path ) ; $ this -> method = $ this -> router -> methodName ( ) ; // If a {locale} segment was matched in the final route, // then we need to set the correct locale on our Request. if ( $ this -> router -> hasLocale ( ) ) { $ this -> request -> setLocale ( $ this -> router -> getLocale ( ) ) ; } $ this -> benchmark -> stop ( 'routing' ) ; return $ this -> router -> getFilter ( ) ; }
Try to Route It - As it sounds like, works with the router to
match a route against the current URI. If the route is a
"redirect route", will also handle the redirect.

@param RouteCollectionInterface $routes An collection interface to use in place
of the config file.

@return string
@throws \CodeIgniter\Router\Exceptions\RedirectException
Try to Route It - As it sounds like works with the router to match a route against the current URI . If the route is a redirect route will also handle the redirect .