当前位置: 首页>>代码示例>>PHP>>正文


PHP ExceptionHandler::getStylesheet方法代码示例

本文整理汇总了PHP中Symfony\Component\Debug\ExceptionHandler::getStylesheet方法的典型用法代码示例。如果您正苦于以下问题:PHP ExceptionHandler::getStylesheet方法的具体用法?PHP ExceptionHandler::getStylesheet怎么用?PHP ExceptionHandler::getStylesheet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Debug\ExceptionHandler的用法示例。


在下文中一共展示了ExceptionHandler::getStylesheet方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     switch (get_class($e)) {
         case "Swift_TransportException":
         case "PDOException":
             $errorView = "errors.500_config";
             break;
         case "ErrorException":
             $errorView = "errors.500";
             break;
         case "Symfony\\Component\\HttpKernel\\Exception\\MethodNotAllowedHttpException":
             return abort(400);
         default:
             $errorView = false;
             break;
     }
     if ($errorView) {
         // This makes use of a Symfony error handler to make pretty traces.
         $SymfonyDisplayer = new SymfonyDisplayer(config('app.debug'));
         $FlattenException = FlattenException::create($e);
         $SymfonyCss = $SymfonyDisplayer->getStylesheet($FlattenException);
         $SymfonyHtml = $SymfonyDisplayer->getContent($FlattenException);
         $response = response()->view($errorView, ['exception' => $e, 'error_class' => get_class($e), 'error_css' => $SymfonyCss, 'error_html' => $SymfonyHtml], 500);
         return $this->toIlluminateResponse($response, $e);
     } else {
         return parent::render($request, $e);
     }
 }
开发者ID:RustyGamer,项目名称:infinity-next,代码行数:35,代码来源:Handler.php

示例2: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function render($request, Exception $e)
 {
     $e = FlattenException::create($e);
     $handler = new SymfonyExceptionHandler(env('APP_DEBUG', false));
     $decorated = $this->decorate($handler->getContent($e), $handler->getStylesheet($e));
     return Response::create($decorated, $e->getStatusCode(), $e->getHeaders());
 }
开发者ID:rlacerda83,项目名称:lumen-framework,代码行数:14,代码来源:Handler.php

示例3: handleException

 /**
  * Convert an exception to a response
  *
  * @param \Exception $exception
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function handleException($exception)
 {
     if (!$exception instanceof FlattenException) {
         $exception = FlattenException::create($exception);
     }
     $handler = new BaseExceptionHandler($this->debug);
     $decorated = $this->decorate($handler->getContent($exception), $handler->getStylesheet($exception));
     return new Response($decorated, $exception->getStatusCode(), $exception->getHeaders());
 }
开发者ID:MikeGeorgeff,项目名称:siphon,代码行数:15,代码来源:ExceptionHandler.php

示例4: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($e instanceof ErrorException) {
         // This makes use of a Symfony error handler to make pretty traces.
         $SymfonyDisplayer = new SymfonyDisplayer(config('app.debug'));
         $FlattenException = FlattenException::create($e);
         $SymfonyCss = $SymfonyDisplayer->getStylesheet($FlattenException);
         $SymfonyHtml = $SymfonyDisplayer->getContent($FlattenException);
         return response()->view('errors.500', ['error' => $e, 'error_css' => $SymfonyCss, 'error_html' => $SymfonyHtml], 500);
     } else {
         return parent::render($request, $e);
     }
 }
开发者ID:Cipherwraith,项目名称:infinity-next,代码行数:20,代码来源:Handler.php

示例5: cssAction

 /**
  * Renders the exception panel stylesheet for the given token.
  *
  * @param string $token The profiler token
  *
  * @return Response A Response instance
  *
  * @throws NotFoundHttpException
  */
 public function cssAction($token)
 {
     if (null === $this->profiler) {
         throw new NotFoundHttpException('The profiler must be enabled.');
     }
     $this->profiler->disable();
     $exception = $this->profiler->loadProfile($token)->getCollector('exception')->getException();
     $template = $this->getTemplate();
     if (!$this->templateExists($template)) {
         $handler = new ExceptionHandler($this->debug, $this->twig->getCharset());
         return new Response($handler->getStylesheet($exception), 200, array('Content-Type' => 'text/css'));
     }
     return new Response($this->twig->render('@WebProfiler/Collector/exception.css.twig'), 200, array('Content-Type' => 'text/css'));
 }
开发者ID:xingshanghe,项目名称:symfony,代码行数:23,代码来源:ExceptionController.php

示例6: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($e instanceof HttpResponseException) {
         return $e->getResponse();
     } elseif ($e instanceof ModelNotFoundException) {
         $e = new NotFoundHttpException($e->getMessage(), $e);
     } elseif ($e instanceof AuthorizationException) {
         $e = new HttpException(403, $e->getMessage());
     } elseif ($e instanceof ValidationException && $e->getResponse()) {
         return $e->getResponse();
     }
     $fe = FlattenException::create($e);
     $handler = new SymfonyExceptionHandler(env('APP_DEBUG', false));
     $decorated = $this->decorate($handler->getContent($fe), $handler->getStylesheet($fe));
     $response = new Response($decorated, $fe->getStatusCode(), $fe->getHeaders());
     $response->exception = $e;
     return $response;
 }
开发者ID:jonathanpmartins,项目名称:lumen-framework,代码行数:25,代码来源:Handler.php

示例7: convertExceptionToResponse

 /**
  * Create a Symfony response for the given exception.
  *
  * @param  \Exception  $e
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function convertExceptionToResponse(Exception $e)
 {
     $e = FlattenException::create($e);
     $handler = new SymfonyExceptionHandler(config('app.debug'));
     $decorated = $this->decorate($handler->getContent($e), $handler->getStylesheet($e));
     return SymfonyResponse::create($decorated, $e->getStatusCode(), $e->getHeaders());
 }
开发者ID:ziracmo,项目名称:Projet-transversal-2,代码行数:13,代码来源:Handler.php

示例8: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     $errorView = false;
     $errorEmail = false;
     switch (get_class($e)) {
         case "App\\Exceptions\\TorClearnet":
             $errorView = "errors.403_tor_clearnet";
             break;
         case "Swift_TransportException":
         case "PDOException":
             $errorView = "errors.500_config";
             $errorEmail = true;
             break;
         case "ErrorException":
         case "Symfony\\Component\\Debug\\Exception\\FatalThrowableError":
             $errorView = "errors.500";
             $errorEmail = true;
             break;
         case "Symfony\\Component\\HttpKernel\\Exception\\MethodNotAllowedHttpException":
             return abort(400);
         case "Predis\\Connection\\ConnectionException":
             $errorView = "errors.500_predis";
             $errorEmail = true;
             break;
         default:
             $errorView = false;
             break;
     }
     if (env('APP_DEBUG', false)) {
         $errorView = false;
     }
     $errorEmail = $errorEmail && env('MAIL_ADDR_ADMIN', false) && env('MAIL_ADMIN_SERVER_ERRORS', false);
     if ($errorEmail) {
         // This makes use of a Symfony error handler to make pretty traces.
         $SymfonyDisplayer = new SymfonyDisplayer(true);
         $FlattenException = isset($FlattenException) ? $FlattenException : FlattenException::create($e);
         $SymfonyCss = $SymfonyDisplayer->getStylesheet($FlattenException);
         $SymfonyHtml = $SymfonyDisplayer->getContent($FlattenException);
         $data = ['exception' => $e, 'error_class' => get_class($e), 'error_css' => $SymfonyCss, 'error_html' => $SymfonyHtml];
         Mail::send('emails.error', $data, function ($message) {
             $to = env('SITE_NAME', 'Infinity Next') . " Webaster";
             $subject = env('SITE_NAME', 'Infinity Next') . " Error";
             $subject .= " " . Request::url() ?: "";
             $message->to(env('MAIL_ADDR_ADMIN', false), $to);
             $message->subject($subject);
         });
     }
     if ($errorView) {
         // Duplicating logic in $errorEmail because output is completely
         // diffrent without app.debug enabled. I always want a stack trace
         // in my emails!
         $SymfonyDisplayer = new SymfonyDisplayer(config('app.debug'));
         $FlattenException = isset($FlattenException) ? $FlattenException : FlattenException::create($e);
         $SymfonyCss = $SymfonyDisplayer->getStylesheet($FlattenException);
         $SymfonyHtml = $SymfonyDisplayer->getContent($FlattenException);
         $response = response()->view($errorView, ['exception' => $e, 'error_class' => get_class($e), 'error_css' => $SymfonyCss, 'error_html' => $SymfonyHtml], 500);
         return $this->toIlluminateResponse($response, $e);
     }
     return parent::render($request, $e);
 }
开发者ID:tmrwbo,项目名称:infinity-next,代码行数:67,代码来源:Handler.php

示例9: originalConvertExceptionToResponseWithDebugEnabled

 protected function originalConvertExceptionToResponseWithDebugEnabled(Exception $exc)
 {
     // needed for emails and file logs, otherwise it will be useless
     $e = FlattenException::create($exc);
     $handler = new SymfonyExceptionHandler(true);
     $decorated = $this->decorate($handler->getContent($e), $handler->getStylesheet($e));
     return SymfonyResponse::create($decorated, $e->getStatusCode(), $e->getHeaders());
 }
开发者ID:swayok,项目名称:laravel-extended-errors,代码行数:8,代码来源:ExceptionHandler.php


注:本文中的Symfony\Component\Debug\ExceptionHandler::getStylesheet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。