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


PHP Run::popHandler方法代码示例

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


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

示例1: __invoke

 /**
  * @param ServerRequestInterface $request
  * @param ResponseInterface $response
  * @param callable $next
  *
  * @return ResponseInterface
  */
 public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next)
 {
     try {
         return $next($request, $response);
     } catch (Exception $e) {
         if ($this->logger) {
             $this->logger->error($e->getMessage(), ['exception' => $e]);
         }
         $type = $this->type($request);
         $response = $response->withHeader('Content-Type', $type);
         try {
             if (method_exists($e, 'getHttpStatus')) {
                 $code = $e->getHttpStatus();
             } else {
                 $code = $e->getCode();
             }
             $response = $response->withStatus($code);
         } catch (InvalidArgumentException $_) {
             // Exception did not contain a valid code
             $response = $response->withStatus(500);
         }
         if ($e instanceof HttpException) {
             $response = $e->withResponse($response);
         }
         $handler = $this->handler($type);
         $this->whoops->pushHandler($handler);
         $body = $this->whoops->handleException($e);
         $response->getBody()->write($body);
         $this->whoops->popHandler();
         return $response;
     }
 }
开发者ID:equip,项目名称:framework,代码行数:39,代码来源:ExceptionHandler.php

示例2: setHandler

 /**
  * Set the proper Error Handler based on the Output of the page
  *
  * @param string $output
  */
 public function setHandler($output = null)
 {
     $this->_whoops->popHandler();
     if ($output == Output::JSON) {
         $this->_handler = new JsonResponseHandler();
     } else {
         if ($output == Output::XML) {
             $this->_handler = new XmlResponseHandler();
         } else {
             $this->_handler = new PlainResponseHandler();
         }
     }
     $this->_whoops->pushHandler($this->_handler);
 }
开发者ID:byjg,项目名称:restserver,代码行数:19,代码来源:ErrorHandler.php

示例3: setHandler

 /**
  * Set the proper Error Handler based on the Output of the page
  *
  * @param OutputData $output
  */
 public function setHandler($output)
 {
     $this->_whoops->popHandler();
     if ($output == OutputData::Json) {
         $this->_handler = new JsonResponseHandler();
     } else {
         if ($output == OutputData::Xml) {
             $this->_handler = new XmlResponseHandler();
         } else {
             $this->_handler = new PrettyPageHandler();
             if (!Context::getInstance()->getDevelopmentStatus()) {
                 $this->_handler->addResourcePath(\WhoopsResources\Resource::getPath());
             }
         }
     }
     $this->_whoops->pushHandler($this->_handler);
 }
开发者ID:byjg,项目名称:xmlnuke,代码行数:22,代码来源:ErrorHandler.php

示例4: __invoke

 /**
  * @param ServerRequestInterface $request
  * @param ResponseInterface $response
  * @param callable $next
  *
  * @return ResponseInterface
  */
 public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next)
 {
     try {
         return $next($request, $response);
     } catch (Exception $e) {
         $type = $this->type($request);
         $response = $response->withHeader('Content-Type', $type);
         try {
             $response = $response->withStatus($e->getCode());
         } catch (InvalidArgumentException $_) {
             // Exception did not contain a valid code
             $response = $response->withStatus(500);
         }
         if ($e instanceof HttpException) {
             $response = $e->withResponse($response);
         }
         $handler = $this->handler($type);
         $this->whoops->pushHandler($handler);
         $body = $this->whoops->handleException($e);
         $response->getBody()->write($body);
         $this->whoops->popHandler();
         return $response;
     }
 }
开发者ID:jbmadking,项目名称:scheduler-test,代码行数:31,代码来源:ExceptionHandler.php

示例5: popHandler

 /**
  * Pops the last handler
  */
 public function popHandler()
 {
     $this->errorHandler->popHandler();
 }
开发者ID:stedop,项目名称:playground-framework,代码行数:7,代码来源:WhoopsClient.php


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