Exemplo n.º 1
0
 /**
  * Returns the debug information
  *
  * @param integer $index The index
  * @param string $input The input
  * @param ILess_Environment $env The environment
  * @return ILess_DebugInfo
  */
 protected function getDebugInfo($index, $input, ILess_Environment $env)
 {
     list($lineNumber) = ILess_Util::getLocation($input, $index);
     return new ILess_DebugInfo($env->currentFileInfo->filename, $lineNumber);
 }
Exemplo n.º 2
0
 /**
  * Returns the current line and column
  *
  * @param ILess_FileInfo|ILess_ImportedFile|string $currentFile The file
  * @param integer $index Current position index
  * @param boolean $excerpt Include the string excerpt?
  * @return array
  */
 protected function getLocation($currentFile, $index, $column = null, $excerpt = true)
 {
     $line = $column = $excerptContent = null;
     if ($index !== null && $currentFile) {
         $content = null;
         if ($currentFile instanceof ILess_FileInfo && $currentFile->importedFile) {
             $content = $currentFile->importedFile->getContent();
         } elseif (is_string($currentFile) && ILess_Util::isPathAbsolute($currentFile) && is_readable($currentFile)) {
             $content = file_get_contents($currentFile);
         }
         if ($content) {
             list($line, $column, $excerptContent) = ILess_Util::getLocation($content, $index, $column, $excerpt);
         }
     }
     return array($line, $column, $excerptContent);
 }