// Prevent access to default method path
if (strtolower($this->method
) ===
strtolower($defaultMethod)) { throw new PageNotFoundException( 'Cannot access the default method "' .
$this->method . '" with the method name URI path.'
);
} } elseif (method_exists($this->controller,
$defaultMethod)) { // The default method is found.
$this->method =
$defaultMethod;
} else { // No method is found.
throw PageNotFoundException::
forControllerNotFound($this->controller,
$method);
} // Ensure the controller is not defined in routes.
$this->
protectDefinedRoutes();
// Ensure the controller does not have _remap() method.
$this->
checkRemap();
// Ensure the URI segments for the controller and method do not contain
// underscores when $translateURIDashes is true.
$this->
checkUnderscore($uri);