/**
* Attempts to match a URI path against Controllers and directories
* found in APPPATH/Controllers, to find a matching route.
*
* @return array [directory_name, controller_name, controller_method, params]
*/
public function getRoute(string
$uri, string
$httpVerb): array
{ $segments =
explode('/',
$uri);
// WARNING: Directories get shifted out of the segments array.
$segments =
$this->
scanControllers($segments);
// If we don't have any segments left - use the default controller;
// If not empty, then the first segment should be the controller
if (!
empty($segments)) { $this->controller =
ucfirst(array_shift($segments));
} $controllerName =
$this->
controllerName();
if (!
$this->
isValidSegment($controllerName)) { throw new PageNotFoundException($this->controller . ' is not a valid controller name'
);
}