Symfony\Component\Debug\Exception\FlattenException::getTrace PHP Method

getTrace() public method

public getTrace ( )
    public function getTrace()
    {
        return $this->trace;
    }

Usage Example

Beispiel #1
0
 public function getTrace($previewLines = 3)
 {
     $trace = parent::getTrace();
     if (!is_array($trace)) {
         return;
     }
     $trace[1]['file'] = $this->getFile();
     $trace[1]['line'] = $this->getLine();
     if ($previewLines === false) {
         return $trace;
     }
     foreach ($trace as &$item) {
         if (!$item['file'] || !$item['line']) {
             continue;
         }
         $item['file_preview'] = [];
         $fileContents = file_get_contents($item['file']);
         $fileContents = explode("\n", $fileContents);
         $firstLine = max($item['line'] - $previewLines, 1);
         $lastLine = min($item['line'] + $previewLines, count($fileContents));
         for ($line = $firstLine; $line <= $lastLine; $line++) {
             $item['file_preview'][$line] = $fileContents[$line - 1];
         }
     }
     return $trace;
 }
All Usage Examples Of Symfony\Component\Debug\Exception\FlattenException::getTrace