src/Mvc/Router/AbstractRouter.php
public function route(string $name, Request $request)
	{
		$parts = \explode('/', $request->getOrigin());
		$found = false;
		for($i = 0; $i < count($parts); $i++) {
			if($parts[$i] === $name && isset($parts[$i+1])) {
				$action = $parts[$i+1];
				if(strpos($action, "?")) {
					$action = strstr($action, "?", true);
				}
				
				$request->setAction($action);
				$found = true;
			}
		}
		if(!$found) {
			$request->setAction("index");
		}
		$controller = $this->getRoute($name);
		$request->setController($controller->getControllerSimpleName());
		
		return $controller;
	}
public function route(string $name, Request $request)
	{
		$parts = \explode('/', $request->getOrigin());
		$found = false;
		for($i = 0; $i < count($parts); $i++) {
			if($parts[$i] === $name && isset($parts[$i+1])) {
				$action = $parts[$i+1];
				if(strpos($action, "?")) {
					$action = strstr($action, "?", true);
				}
				
				$request->setAction($action);
				$found = true;
			}
		}
		if(!$found) {
			$request->setAction("index");
		}
		$controller = $this->getRoute($name);
		$request->setController($controller->getControllerSimpleName());
		
		return $controller;
	}
Route the existing request into a new controller

@param string $name The name of route
@param Request $request The existing request instance
@return \Nkey\Caribu\Mvc\Controller\AbstractController