function FlattenException::setTrace
Return value
$this
1 call to FlattenException::setTrace()
- FlattenException::setTraceFromThrowable in vendor/
symfony/ error-handler/ Exception/ FlattenException.php
File
-
vendor/
symfony/ error-handler/ Exception/ FlattenException.php, line 304
Class
- FlattenException
- FlattenException wraps a PHP Error or Exception to be able to serialize it.
Namespace
Symfony\Component\ErrorHandler\ExceptionCode
public function setTrace(array $trace, ?string $file, ?int $line) : static {
$this->trace = [];
$this->trace[] = [
'namespace' => '',
'short_class' => '',
'class' => '',
'type' => '',
'function' => '',
'file' => $file,
'line' => $line,
'args' => [],
];
foreach ($trace as $entry) {
$class = '';
$namespace = '';
if (isset($entry['class'])) {
$parts = explode('\\', $entry['class']);
$class = array_pop($parts);
$namespace = implode('\\', $parts);
}
$this->trace[] = [
'namespace' => $namespace,
'short_class' => $class,
'class' => $entry['class'] ?? '',
'type' => $entry['type'] ?? '',
'function' => $entry['function'] ?? null,
'file' => $entry['file'] ?? null,
'line' => $entry['line'] ?? null,
'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : [],
];
}
return $this;
}