function FlattenException::createWithDataRepresentation
2 calls to FlattenException::createWithDataRepresentation()
- ExceptionDataCollector::collect in vendor/
symfony/ http-kernel/ DataCollector/ ExceptionDataCollector.php - Collects data for the given Request and Response.
- HtmlErrorRenderer::render in vendor/
symfony/ error-handler/ ErrorRenderer/ HtmlErrorRenderer.php - Renders a Throwable as a FlattenException.
File
-
vendor/
symfony/ error-handler/ Exception/ FlattenException.php, line 88
Class
- FlattenException
- FlattenException wraps a PHP Error or Exception to be able to serialize it.
Namespace
Symfony\Component\ErrorHandler\ExceptionCode
public static function createWithDataRepresentation(\Throwable $throwable, ?int $statusCode = null, array $headers = [], ?VarCloner $cloner = null) : static {
$e = static::createFromThrowable($throwable, $statusCode, $headers);
static $defaultCloner;
if (!($cloner ??= $defaultCloner)) {
$cloner = $defaultCloner = new VarCloner();
$cloner->addCasters([
\Throwable::class => function (\Throwable $e, array $a, Stub $s, bool $isNested) : array {
if (!$isNested) {
unset($a[Caster::PREFIX_PROTECTED . 'message']);
unset($a[Caster::PREFIX_PROTECTED . 'code']);
unset($a[Caster::PREFIX_PROTECTED . 'file']);
unset($a[Caster::PREFIX_PROTECTED . 'line']);
unset($a["\x00Error\x00trace"], $a["\x00Exception\x00trace"]);
unset($a["\x00Error\x00previous"], $a["\x00Exception\x00previous"]);
}
return $a;
},
]);
}
return $e->setDataRepresentation($cloner->cloneVar($throwable));
}