$this->benchmark->
start('controller_constructor'
);
// Is it routed to a Closure?
if (is_object($this->controller
) && (get_class($this->controller
) === 'Closure'
)) { $controller =
$this->controller;
return $controller(...
$this->router->
params());
} // No controller specified - we don't know what to do now.
if (empty($this->controller
)) { throw PageNotFoundException::
forEmptyController();
} // Try to autoload the class
if (!
class_exists($this->controller, true
) ||
$this->method
[0
] === '_'
) { throw PageNotFoundException::
forControllerNotFound($this->controller,
$this->method
);
} } /**
* Instantiates the controller class.
*
* @return Controller
*/