original_string: public function recognizeErrorResponseHandler($exception, $inspector, Run $run)
      {
          $app = $this->application;
  
          $handlerClass = PrettyPageHandler::class;
          if ($app->isCli() || false === $app->getConfig(ApplicationInterface::KEY_ERROR, ApplicationInterface::DEFAULT_ERROR)) {
              $handlerClass = PlainTextHandler::class;
          }
  
          if ($app instanceof Application) {
              if ($app->isSoapRequest() || $app->isXmlRequest()) {
                  $handlerClass = XmlResponseHandler::class;
              } elseif ($app->isAjaxRequest() || $app->isJsonRequest()) {
                  $handlerClass = JsonResponseHandler::class;
              }
          }
  
          /** @var HandlerInterface $handler */
          $handler = new $handlerClass;
          $handler->setException($exception);
          $handler->setInspector($inspector);
          $handler->setRun($run);
          return $handler->handle();
      }
code: public function recognizeErrorResponseHandler($exception, $inspector, Run $run)
      {
          $app = $this->application;
  
          $handlerClass = PrettyPageHandler::class;
          if ($app->isCli() || false === $app->getConfig(ApplicationInterface::KEY_ERROR, ApplicationInterface::DEFAULT_ERROR)) {
              $handlerClass = PlainTextHandler::class;
          }
  
          if ($app instanceof Application) {
              if ($app->isSoapRequest() || $app->isXmlRequest()) {
                  $handlerClass = XmlResponseHandler::class;
              } elseif ($app->isAjaxRequest() || $app->isJsonRequest()) {
                  $handlerClass = JsonResponseHandler::class;
              }
          }
  
          /** @var HandlerInterface $handler */
          $handler = new $handlerClass;
          $handler->setException($exception);
          $handler->setInspector($inspector);
          $handler->setRun($run);
          return $handler->handle();
      }
code_tokens: public function recognizeErrorResponseHandler ( $ exception , $ inspector , Run $ run ) { $ app = $ this -> application ; $ handlerClass = PrettyPageHandler :: class ; if ( $ app -> isCli ( ) || false === $ app -> getConfig ( ApplicationInterface :: KEY_ERROR , ApplicationInterface :: DEFAULT_ERROR ) ) { $ handlerClass = PlainTextHandler :: class ; } if ( $ app instanceof Application ) { if ( $ app -> isSoapRequest ( ) || $ app -> isXmlRequest ( ) ) { $ handlerClass = XmlResponseHandler :: class ; } elseif ( $ app -> isAjaxRequest ( ) || $ app -> isJsonRequest ( ) ) { $ handlerClass = JsonResponseHandler :: class ; } } /** @var HandlerInterface $handler */ $ handler = new $ handlerClass ; $ handler -> setException ( $ exception ) ; $ handler -> setInspector ( $ inspector ) ; $ handler -> setRun ( $ run ) ; return $ handler -> handle ( ) ; }
docstring: Recognize response handler for error by content type and environment.
  
  Cli is always handled as plaintext!
  
  @param $exception
  @param $inspector
  @param Run $run
  @return int|null
docstring_tokens: Recognize response handler for error by content type and environment .