コード例 #1
0
 /**
  * Display an individual problem.
  *
  * @param SimpleXMLElement $problem structure to be displayed.
  * @param string $prettypath relative path to the file
  * @return string html to display an individual problem
  */
 public function problem_message($problem, $prettypath)
 {
     static $lastfileandline = '';
     // To detect changes of line.
     $line = $problem['line'];
     $level = $problem->getName();
     $code = '';
     if ($lastfileandline !== $prettypath . '#@#' . $line) {
         // We have moved to another line, output it.
         $code = html_writer::tag('li', html_writer::tag('div', html_writer::tag('pre', '#' . $line . ': ' . str_replace(array_keys($this->replaces), array_values($this->replaces), s(local_codechecker_get_line_of_code($line, $prettypath))))), array('class' => 'sourcecode'));
         $lastfileandline = $prettypath . '#@#' . $line;
     }
     $sourceclass = str_replace('.', '_', $problem['source']);
     $info = html_writer::tag('div', s($problem), array('class' => 'info ' . $sourceclass));
     return $code . html_writer::tag('li', $info, array('class' => 'fail ' . $level));
 }
コード例 #2
0
 public function problem_message($line, $char, $level, $problem, $prettypath)
 {
     $sourceclass = str_replace('.', '_', $problem['source']);
     $info = html_writer::tag('div', html_writer::tag('strong', $line) . ': ' . s($problem['message']), array('class' => 'info ' . $sourceclass));
     $code = html_writer::tag('pre', str_replace(array_keys($this->replaces), array_values($this->replaces), s(local_codechecker_get_line_of_code($line, $prettypath))));
     return html_writer::tag('li', $code . $info, array('class' => 'fail ' . $level));
 }