Ejemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function renderConnector($connector)
 {
     if (strlen($connector) > 17) {
         // Something big, we should display it.
         // Most likely the parametes of a method.
         return parent::renderConnector($connector);
     }
     return '';
 }
Ejemplo n.º 2
0
 /**
  * Reads sourcecode from files, for the backtrace.
  *
  * @param string $file
  *   Path to the file you want to read.
  * @param int $highlight
  *   The line number you want to highlight
  * @param int $from
  *   The start line.
  * @param int $to
  *   The end line.
  *
  * @return string
  *   The source code.
  */
 public function readSourcecode($file, $highlight, $from, $to)
 {
     $result = '';
     if (is_readable($file)) {
         // Load content and add it to the backtrace.
         $contentArray = file($file);
         // Correct the value, in case we are exceeding the line numbers.
         if ($from < 0) {
             $from = 0;
         }
         if ($to > count($contentArray)) {
             $to = count($contentArray);
         }
         for ($currentLineNo = $from; $currentLineNo <= $to; $currentLineNo++) {
             if (isset($contentArray[$currentLineNo])) {
                 // Add it to the result.
                 $realLineNo = $currentLineNo + 1;
                 // Escape it.
                 $contentArray[$currentLineNo] = $this->encodeString($contentArray[$currentLineNo], true);
                 if ($currentLineNo === $highlight) {
                     $result .= $this->render->renderBacktraceSourceLine('highlight', $realLineNo, $contentArray[$currentLineNo]);
                 } else {
                     $result .= $this->render->renderBacktraceSourceLine('source', $realLineNo, $contentArray[$currentLineNo]);
                 }
             } else {
                 // End of the file.
                 break;
             }
         }
     }
     return $result;
 }