Example #1
0
 /**
  * Формирует проблемный участок PHP кода 
  *
  * @param array $trace
  *
  * @return null
  */
 protected function preparePhp()
 {
     $php = '';
     $i = 0;
     $block = $this->trace[0];
     if (basename($block['file']) === 'Shaper.php') {
         $block = $this->trace[1];
     }
     $this->file = $block['file'];
     $this->line = $block['line'];
     $script = file($block['file']);
     $ext = ceil($this->sizeListing / 2);
     $position = $block['line'] <= $ext ? 0 : $block['line'] - $ext;
     foreach ($script as $string) {
         ++$i;
         if ($i == $block['line']) {
             $lines[] = $this->view->wrapLine($i, 'error');
         } elseif ($i == $block['line']) {
             $lines[] = $this->view->wrapLine($i, 'trace');
         } else {
             $lines[] = $i;
         }
         $php .= $string;
     }
     $data['num'] = array_slice($lines, $position, $this->sizeListing);
     $data['total'] = $this->view->highlightString($php, $position, $this->sizeListing);
     $cnt = substr_count($data['total'], "\r") + 2;
     return $this->view->createPhp($data);
 }