original_string: protected function _getController()
      {
          $request = $this->request;
          $routerRequest = Router::getRequest(true);
          // Fallback to the request in the router or make a new one from
          // $_SERVER
          if ($request === null) {
              $request = $routerRequest ?: ServerRequestFactory::fromGlobals();
          }
  
          // If the current request doesn't have routing data, but we
          // found a request in the router context copy the params over
          if ($request->getParam('controller') === false && $routerRequest !== null) {
              $request = $request->withAttribute('params', $routerRequest->getAttribute('params'));
          }
  
          $response = new Response();
          $controller = null;
  
          try {
              $namespace = 'Controller';
              $prefix = $request->getParam('prefix');
              if ($prefix) {
                  if (strpos($prefix, '/') === false) {
                      $namespace .= '/' . Inflector::camelize($prefix);
                  } else {
                      $prefixes = array_map(
                          'Cake\Utility\Inflector::camelize',
                          explode('/', $prefix)
                      );
                      $namespace .= '/' . implode('/', $prefixes);
                  }
              }
  
              $class = App::className('Error', $namespace, 'Controller');
              if (!$class && $namespace !== 'Controller') {
                  $class = App::className('Error', 'Controller', 'Controller');
              }
  
              /* @var \Cake\Controller\Controller $controller */
              $controller = new $class($request, $response);
              $controller->startupProcess();
              $startup = true;
          } catch (Exception $e) {
              $startup = false;
          }
  
          // Retry RequestHandler, as another aspect of startupProcess()
          // could have failed. Ignore any exceptions out of startup, as
          // there could be userland input data parsers.
          if ($startup === false && !empty($controller) && isset($controller->RequestHandler)) {
              try {
                  $event = new Event('Controller.startup', $controller);
                  $controller->RequestHandler->startup($event);
              } catch (Exception $e) {
              }
          }
          if (empty($controller)) {
              $controller = new Controller($request, $response);
          }
  
          return $controller;
      }
code: protected function _getController()
      {
          $request = $this->request;
          $routerRequest = Router::getRequest(true);
          // Fallback to the request in the router or make a new one from
          // $_SERVER
          if ($request === null) {
              $request = $routerRequest ?: ServerRequestFactory::fromGlobals();
          }
  
          // If the current request doesn't have routing data, but we
          // found a request in the router context copy the params over
          if ($request->getParam('controller') === false && $routerRequest !== null) {
              $request = $request->withAttribute('params', $routerRequest->getAttribute('params'));
          }
  
          $response = new Response();
          $controller = null;
  
          try {
              $namespace = 'Controller';
              $prefix = $request->getParam('prefix');
              if ($prefix) {
                  if (strpos($prefix, '/') === false) {
                      $namespace .= '/' . Inflector::camelize($prefix);
                  } else {
                      $prefixes = array_map(
                          'Cake\Utility\Inflector::camelize',
                          explode('/', $prefix)
                      );
                      $namespace .= '/' . implode('/', $prefixes);
                  }
              }
  
              $class = App::className('Error', $namespace, 'Controller');
              if (!$class && $namespace !== 'Controller') {
                  $class = App::className('Error', 'Controller', 'Controller');
              }
  
              /* @var \Cake\Controller\Controller $controller */
              $controller = new $class($request, $response);
              $controller->startupProcess();
              $startup = true;
          } catch (Exception $e) {
              $startup = false;
          }
  
          // Retry RequestHandler, as another aspect of startupProcess()
          // could have failed. Ignore any exceptions out of startup, as
          // there could be userland input data parsers.
          if ($startup === false && !empty($controller) && isset($controller->RequestHandler)) {
              try {
                  $event = new Event('Controller.startup', $controller);
                  $controller->RequestHandler->startup($event);
              } catch (Exception $e) {
              }
          }
          if (empty($controller)) {
              $controller = new Controller($request, $response);
          }
  
          return $controller;
      }
code_tokens: protected function _getController ( ) { $ request = $ this -> request ; $ routerRequest = Router :: getRequest ( true ) ; // Fallback to the request in the router or make a new one from // $_SERVER if ( $ request === null ) { $ request = $ routerRequest ? : ServerRequestFactory :: fromGlobals ( ) ; } // If the current request doesn't have routing data, but we // found a request in the router context copy the params over if ( $ request -> getParam ( 'controller' ) === false && $ routerRequest !== null ) { $ request = $ request -> withAttribute ( 'params' , $ routerRequest -> getAttribute ( 'params' ) ) ; } $ response = new Response ( ) ; $ controller = null ; try { $ namespace = 'Controller' ; $ prefix = $ request -> getParam ( 'prefix' ) ; if ( $ prefix ) { if ( strpos ( $ prefix , '/' ) === false ) { $ namespace .= '/' . Inflector :: camelize ( $ prefix ) ; } else { $ prefixes = array_map ( 'Cake\Utility\Inflector::camelize' , explode ( '/' , $ prefix ) ) ; $ namespace .= '/' . implode ( '/' , $ prefixes ) ; } } $ class = App :: className ( 'Error' , $ namespace , 'Controller' ) ; if ( ! $ class && $ namespace !== 'Controller' ) { $ class = App :: className ( 'Error' , 'Controller' , 'Controller' ) ; } /* @var \Cake\Controller\Controller $controller */ $ controller = new $ class ( $ request , $ response ) ; $ controller -> startupProcess ( ) ; $ startup = true ; } catch ( Exception $ e ) { $ startup = false ; } // Retry RequestHandler, as another aspect of startupProcess() // could have failed. Ignore any exceptions out of startup, as // there could be userland input data parsers. if ( $ startup === false && ! empty ( $ controller ) && isset ( $ controller -> RequestHandler ) ) { try { $ event = new Event ( 'Controller.startup' , $ controller ) ; $ controller -> RequestHandler -> startup ( $ event ) ; } catch ( Exception $ e ) { } } if ( empty ( $ controller ) ) { $ controller = new Controller ( $ request , $ response ) ; } return $ controller ; }
docstring: Get the controller instance to handle the exception.
  Override this method in subclasses to customize the controller used.
  This method returns the built in `ErrorController` normally, or if an error is repeated
  a bare controller will be used.
  
  @return \Cake\Controller\Controller
  @triggers Controller.startup $controller
docstring_tokens: Get the controller instance to handle the exception . Override this method in subclasses to customize the controller used . This method returns the built in ErrorController normally or if an error is repeated a bare controller will be used .