diff options
Diffstat (limited to '')
-rw-r--r-- | lib/less.php/Output.php | 49 | ||||
-rw-r--r-- | lib/less.php/Output/Mapped.php | 122 |
2 files changed, 0 insertions, 171 deletions
diff --git a/lib/less.php/Output.php b/lib/less.php/Output.php deleted file mode 100644 index f1b2b2a..0000000 --- a/lib/less.php/Output.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php - -/** - * Parser output - * - * @package Less - * @subpackage output - */ -class Less_Output{ - - /** - * Output holder - * - * @var string - */ - protected $strs = array(); - - /** - * Adds a chunk to the stack - * - * @param string $chunk The chunk to output - * @param Less_FileInfo $fileInfo The file information - * @param integer $index The index - * @param mixed $mapLines - */ - public function add($chunk, $fileInfo = null, $index = 0, $mapLines = null){ - $this->strs[] = $chunk; - } - - /** - * Is the output empty? - * - * @return boolean - */ - public function isEmpty(){ - return count($this->strs) === 0; - } - - - /** - * Converts the output to string - * - * @return string - */ - public function toString(){ - return implode('',$this->strs); - } - -}
\ No newline at end of file diff --git a/lib/less.php/Output/Mapped.php b/lib/less.php/Output/Mapped.php deleted file mode 100644 index 9e4cc46..0000000 --- a/lib/less.php/Output/Mapped.php +++ /dev/null @@ -1,122 +0,0 @@ -<?php
-
-/**
- * Parser output with source map
- *
- * @package Less
- * @subpackage Output
- */
-class Less_Output_Mapped extends Less_Output {
-
- /**
- * The source map generator
- *
- * @var Less_SourceMap_Generator
- */
- protected $generator;
-
- /**
- * Current line
- *
- * @var integer
- */
- protected $lineNumber = 0;
-
- /**
- * Current column
- *
- * @var integer
- */
- protected $column = 0;
-
- /**
- * Array of contents map (file and its content)
- *
- * @var array
- */
- protected $contentsMap = array();
-
- /**
- * Constructor
- *
- * @param array $contentsMap Array of filename to contents map
- * @param Less_SourceMap_Generator $generator
- */
- public function __construct(array $contentsMap, $generator){
- $this->contentsMap = $contentsMap;
- $this->generator = $generator;
- }
-
- /**
- * Adds a chunk to the stack
- * The $index for less.php may be different from less.js since less.php does not chunkify inputs
- *
- * @param string $chunk
- * @param string $fileInfo
- * @param integer $index
- * @param mixed $mapLines
- */
- public function add($chunk, $fileInfo = null, $index = 0, $mapLines = null){
-
- //ignore adding empty strings
- if( $chunk === '' ){
- return;
- }
-
-
- $sourceLines = array();
- $sourceColumns = ' ';
-
-
- if( $fileInfo ){
-
- $url = $fileInfo['currentUri'];
-
- if( isset($this->contentsMap[$url]) ){
- $inputSource = substr($this->contentsMap[$url], 0, $index);
- $sourceLines = explode("\n", $inputSource);
- $sourceColumns = end($sourceLines);
- }else{
- throw new Exception('Filename '.$url.' not in contentsMap');
- }
-
- }
-
- $lines = explode("\n", $chunk);
- $columns = end($lines);
-
- if($fileInfo){
-
- if(!$mapLines){
- $this->generator->addMapping(
- $this->lineNumber + 1, // generated_line
- $this->column, // generated_column
- count($sourceLines), // original_line
- strlen($sourceColumns), // original_column
- $fileInfo
- );
- }else{
- for($i = 0, $count = count($lines); $i < $count; $i++){
- $this->generator->addMapping(
- $this->lineNumber + $i + 1, // generated_line
- $i === 0 ? $this->column : 0, // generated_column
- count($sourceLines) + $i, // original_line
- $i === 0 ? strlen($sourceColumns) : 0, // original_column
- $fileInfo
- );
- }
- }
- }
-
- if(count($lines) === 1){
- $this->column += strlen($columns);
- }else{
- $this->lineNumber += count($lines) - 1;
- $this->column = strlen($columns);
- }
-
- // add only chunk
- parent::add($chunk);
- }
-
-}
\ No newline at end of file |