/**
  * Get a geshi object for this source. This function is for internal use.
  * @return GeSHI! The geshi object associated with the source.
  */
 protected function getGeSHI()
 {
     if (!isset($this->geshi)) {
         // truncante long lines and limit the number of lines
         $text = "";
         $linesTruncated = array();
         $lines = explode("\n", $this->plainSourceCode);
         $nbOfLines = count($lines);
         $n = 0;
         while ($n < $nbOfLines && $n < MAX_NB_OF_LINES) {
             $line = $lines[$n];
             if (strlen($line) > MAX_LINE_LENGTH) {
                 $msg = "line #" . ($n + 1) . " has been truncated to " . MAX_LINE_LENGTH . " characters (out of " . strlen($line) . " characters)\n";
                 $lines[$n] = substr($lines[$n], 0, MAX_LINE_LENGTH) . "... TRUNCATED";
                 trigger_error($msg);
             }
             $text .= $line . "\n";
             $n++;
         }
         if (count($linesTruncated)) {
             $text = "WARNING: Some long lines have been truncated." . "The file might not display correcly\n" . $text;
         }
         $text = implode("\n", $lines);
         if ($nbOfLines > MAX_NB_OF_LINES) {
             $msg = "\nFILE truncated to " . MAX_NB_OF_LINES . " lines (out of " . $nbOfLines . " lines)\n";
             $text .= $msg;
             trigger_error($msg);
         }
         $geshi = new GeSHi();
         $geshi->set_source($text);
         $geshi->set_language($this->geshiLanguage);
         $geshi->set_overall_id($this->sourceId);
         $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
         $geshi->enable_classes();
         $geshi->enable_ids(true);
         $this->geshi = $geshi;
     }
     return $this->geshi;
 }