Example #1
0
 /**
  * Генерирует таблицу трассировки
  *
  * @return string
  */
 protected function prepareStack()
 {
     $i = $j = 0;
     $tpl = $this->view->getStackRow();
     $action = '';
     $stack = $rows = [];
     foreach ($this->backTrace as $block) {
         $class = str_replace('\\', DIRECTORY_SEPARATOR, $block['class']);
         $space = str_replace(DIRECTORY_SEPARATOR, '\\', dirname($class));
         $space = str_replace('.', '\\', $space);
         $location = basename($this->file);
         $data = ['space' => $space, 'location' => $location, 'file' => $block['file'], 'line' => $block['line'], 'total' => $this->prepareBlock($block, $i)];
         if (!empty($block['class'])) {
             $action = basename($class) . $block['type'];
         }
         $data['action'] = $action . $block['function'];
         $stack[] = $data;
         $i++;
     }
     if ($this->exception) {
         $stack = array_reverse($stack);
     }
     foreach ($stack as $row) {
         $row['num'] = ++$this->num;
         $rows[] = $this->view->parseTpl($tpl, $row);
     }
     $data = ['cnt' => $this->num, 'rows' => implode('', $rows)];
     return $this->view->createStack($data);
 }