Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FlattenException.php

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\Exception

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal