2021-02-15 21:29:38 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Parser output
|
|
|
|
*
|
2023-07-07 22:33:10 +02:00
|
|
|
* @private
|
2021-02-15 21:29:38 +01:00
|
|
|
*/
|
|
|
|
class Less_Output {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Output holder
|
|
|
|
*
|
2023-07-07 22:33:10 +02:00
|
|
|
* @var string[]
|
2021-02-15 21:29:38 +01:00
|
|
|
*/
|
2023-07-07 22:33:10 +02:00
|
|
|
protected $strs = [];
|
2021-02-15 21:29:38 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a chunk to the stack
|
|
|
|
*
|
|
|
|
* @param string $chunk The chunk to output
|
2023-07-07 22:33:10 +02:00
|
|
|
* @param array|null $fileInfo The file information
|
|
|
|
* @param int $index The index
|
2021-02-15 21:29:38 +01:00
|
|
|
* @param mixed $mapLines
|
|
|
|
*/
|
|
|
|
public function add( $chunk, $fileInfo = null, $index = 0, $mapLines = null ) {
|
|
|
|
$this->strs[] = $chunk;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Is the output empty?
|
|
|
|
*
|
2023-07-07 22:33:10 +02:00
|
|
|
* @return bool
|
2021-02-15 21:29:38 +01:00
|
|
|
*/
|
|
|
|
public function isEmpty() {
|
|
|
|
return count( $this->strs ) === 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Converts the output to string
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function toString() {
|
|
|
|
return implode( '', $this->strs );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|