protected function _invoke(Controller $controller)
{
$result = $controller->startupProcess();
if ($result instanceof Response) {
return $result;
}
$response = $controller->invokeAction();
if ($response !== null && !$response instanceof Response) {
throw new LogicException('Controller actions can only Cake\\Network\\Response instances');
}
if (!$response && $controller->autoRender) {
$response = $controller->render();
} elseif (!$response) {
$response = $controller->response;
}
$result = $controller->shutdownProcess();
if ($result instanceof Response) {
return $result;
}
return $response;
}