original_string: protected function _invoke(Controller $controller)
      {
          $this->dispatchEvent('Dispatcher.invokeController', ['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 return Cake\Http\Response or null.');
          }
  
          if (!$response && $controller->isAutoRenderEnabled()) {
              $controller->render();
          }
  
          $result = $controller->shutdownProcess();
          if ($result instanceof Response) {
              return $result;
          }
          if (!$response) {
              $response = $controller->getResponse();
          }
  
          return $response;
      }
code: protected function _invoke(Controller $controller)
      {
          $this->dispatchEvent('Dispatcher.invokeController', ['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 return Cake\Http\Response or null.');
          }
  
          if (!$response && $controller->isAutoRenderEnabled()) {
              $controller->render();
          }
  
          $result = $controller->shutdownProcess();
          if ($result instanceof Response) {
              return $result;
          }
          if (!$response) {
              $response = $controller->getResponse();
          }
  
          return $response;
      }
code_tokens: protected function _invoke ( Controller $ controller ) { $ this -> dispatchEvent ( 'Dispatcher.invokeController' , [ '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 return Cake\Http\Response or null.' ) ; } if ( ! $ response && $ controller -> isAutoRenderEnabled ( ) ) { $ controller -> render ( ) ; } $ result = $ controller -> shutdownProcess ( ) ; if ( $ result instanceof Response ) { return $ result ; } if ( ! $ response ) { $ response = $ controller -> getResponse ( ) ; } return $ response ; }
docstring: Invoke a controller's action and wrapping methods.
  
  @param \Cake\Controller\Controller $controller The controller to invoke.
  @return \Cake\Http\Response The response
  @throws \LogicException If the controller action returns a non-response value.
docstring_tokens: Invoke a controller s action and wrapping methods .