示例#1
0
 /**
  *	Format Code 
  *
  *	@param Array $lines - The lines of code to display
  *	@param Int $errorLine - The line of the error
  *	@param
  *	@return String - Formatted Code
  */
 private function formatCode($lines, $errorLine)
 {
     $return = "";
     //Find Minimum Tab Count At Start Of Line
     $tabRemoveCount = null;
     foreach ($lines as $line => $loc) {
         if (!empty($loc)) {
             $currentTabCount = strspn($loc, "\t");
             if ($currentTabCount < $tabRemoveCount || is_null($tabRemoveCount)) {
                 $tabRemoveCount = $currentTabCount;
             }
         }
     }
     //Format Lines
     foreach ($lines as $line => $loc) {
         $loc = substr($loc, strlen(str_repeat("\t", $tabRemoveCount)), strlen($loc));
         if ($line == $errorLine) {
             $return .= HtmlBuilder::make_r("strong", $line . "| " . $loc) . "\n";
         } else {
             $return .= $line . "| " . HtmlBuilder::make_r("em", $loc) . "\n";
         }
     }
     //RETURN PREFORAMATTED.
     return '<pre style="margin:0">' . $return . '</pre>';
 }