$segments =
$this->segments;
$controller = '\\' .
$this->namespace;
$controllerPos = -1;
while ($segments !==
[]) { $segment =
array_shift($segments);
$controllerPos++;
$class =
$this->
translateURIDashes(ucfirst($segment));
// as soon as we encounter any segment that is not PSR-4 compliant, stop searching
if (!
$this->
isValidSegment($class)) { return false;
} $controller .= '\\' .
$class;
if (class_exists($controller)) { $this->controller =
$controller;
$this->controllerPos =
$controllerPos;