本文整理汇总了PHP中Symfony\Component\HttpKernel\Exception\FlattenException::GetClass方法的典型用法代码示例。如果您正苦于以下问题:PHP FlattenException::GetClass方法的具体用法?PHP FlattenException::GetClass怎么用?PHP FlattenException::GetClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpKernel\Exception\FlattenException
的用法示例。
在下文中一共展示了FlattenException::GetClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showAction
/**
* Converts an Exception to a Response.
*
* @param Request $request The request
* @param FlattenException $exception A FlattenException instance
* @param DebugLoggerInterface $logger A DebugLoggerInterface instance
*
* @return Response
*
* @throws \InvalidArgumentException When the exception template does not exist
*/
public function showAction(Request $request, FlattenException $exception, DebugLoggerInterface $logger = null)
{
$currentContent = $this->getAndCleanOutputBuffering($request->headers->get('X-Php-Ob-Level', -1));
$code = $exception->getStatusCode();
if ($exception->GetClass() == 'UCI\\Boson\\ExcepcionesBundle\\Exception\\LocalException') {
$arrayRutaFile = explode(DIRECTORY_SEPARATOR, $exception->getFile());
$strExtraer = "";
for ($i = count($arrayRutaFile) - 1; $i >= 0; $i--) {
if (preg_match('/[a-zA-Z0-9]Bundle$/', $arrayRutaFile[$i]) == 1) {
$direccionBundle = explode($strExtraer, $exception->getFile())[0];
$direccionFileExcepciones = $direccionBundle . DIRECTORY_SEPARATOR . "Resources" . DIRECTORY_SEPARATOR . "config";
if (is_dir($direccionFileExcepciones)) {
break;
}
}
$strExtraer = DIRECTORY_SEPARATOR . $arrayRutaFile[$i] . $strExtraer;
}
$showInProd = false;
$values = $this->getArrayExcepcionesInFile($direccionFileExcepciones);
foreach ($values as $key => $excp) {
if ($key == $exception->getCode() && array_key_exists('show_in_prod', $excp)) {
$showInProd = $excp['show_in_prod'];
}
}
return new Response($this->twig->render((string) $this->findTemplate($request, $request->getRequestFormat(), $code, $this->debug), array('status_code' => $code, 'status_text' => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '', 'exception' => $exception, 'show_in_prod' => $showInProd, 'logger' => $logger, 'currentContent' => $currentContent)));
}
return new Response($this->twig->render((string) $this->findTemplate($request, $request->getRequestFormat(), $code, $this->debug), array('status_code' => $code, 'status_text' => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '', 'exception' => $exception, 'logger' => $logger, 'currentContent' => $currentContent)));
}