Symfony\Component\HttpKernel\Exception\FlattenException::create PHP Method

create() public static method

public static create ( Exception $exception )
$exception Exception
    static public function create(\Exception $exception)
    {
        $e = new static();
        $e->setMessage($exception->getMessage());
        $e->setCode($exception->getCode());
        $e->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
        $e->setClass(get_class($exception));
        if ($exception->getPrevious()) {
            $e->setPrevious(static::create($exception->getPrevious()));
        }
        $e->setStatusCode($exception instanceof HttpException ? $exception->getCode() : 500);

        return $e;
    }

Usage Example

 public function testException()
 {
     $message = 'THIS IS THE ERROR MESSAGE';
     $e = new \Exception($message);
     $this->assertStringMatchesFormat("%A{$message}%A", HtmlUtilities::exception($e));
     $this->assertStringMatchesFormat("%A{$message}%A", HtmlUtilities::exception(FlattenException::create($e)));
 }
All Usage Examples Of Symfony\Component\HttpKernel\Exception\FlattenException::create