public static function FlattenException::create

11 calls to FlattenException::create()
ExceptionHandler::createResponse in drupal/core/vendor/symfony/debug/Symfony/Component/Debug/ExceptionHandler.php
Creates the error Response associated with the given Exception.
ExceptionHandler::sendPhpResponse in drupal/core/vendor/symfony/debug/Symfony/Component/Debug/ExceptionHandler.php
Sends the error associated with the given Exception as a plain PHP response.
FlattenExceptionTest::testFile in drupal/core/vendor/symfony/debug/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php
@dataProvider flattenDataProvider
FlattenExceptionTest::testFlattenHttpException in drupal/core/vendor/symfony/debug/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php
@dataProvider flattenDataProvider
FlattenExceptionTest::testHeadersForHttpException in drupal/core/vendor/symfony/debug/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php

... See full list

File

drupal/core/vendor/symfony/debug/Symfony/Component/Debug/Exception/FlattenException.php, line 35

Class

FlattenException
FlattenException wraps a PHP Exception to be able to serialize it.

Namespace

Symfony\Component\Debug\Exception

Code

public static function create(\Exception $exception, $statusCode = null, array $headers = array()) {
  $e = new static();
  $e
    ->setMessage($exception
    ->getMessage());
  $e
    ->setCode($exception
    ->getCode());
  if ($exception instanceof HttpExceptionInterface) {
    $statusCode = $exception
      ->getStatusCode();
    $headers = array_merge($headers, $exception
      ->getHeaders());
  }
  if (null === $statusCode) {
    $statusCode = 500;
  }
  $e
    ->setStatusCode($statusCode);
  $e
    ->setHeaders($headers);
  $e
    ->setTraceFromException($exception);
  $e
    ->setClass(get_class($exception));
  $e
    ->setFile($exception
    ->getFile());
  $e
    ->setLine($exception
    ->getLine());
  if ($exception
    ->getPrevious()) {
    $e
      ->setPrevious(static::create($exception
      ->getPrevious()));
  }
  return $e;
}