| 1 |
<?php |
| 2 |
/** |
| 3 |
* @private |
| 4 |
* @see less-2.5.3.js#Comment.prototype |
| 5 |
*/ |
| 6 |
class Less_Tree_Comment extends Less_Tree implements Less_Tree_HasValueProperty { |
| 7 |
/** @var string */ |
| 8 |
public $value; |
| 9 |
/** @var bool */ |
| 10 |
public $isLineComment; |
| 11 |
/** @var bool|null */ |
| 12 |
public $isReferenced; |
| 13 |
/** @var array|null */ |
| 14 |
public $currentFileInfo; |
| 15 |
|
| 16 |
public function __construct( $value, $isLineComment, $index = null, $currentFileInfo = null ) { |
| 17 |
$this->value = $value; |
| 18 |
$this->isLineComment = (bool)$isLineComment; |
| 19 |
$this->currentFileInfo = $currentFileInfo; |
| 20 |
} |
| 21 |
|
| 22 |
public function genCSS( $output ) { |
| 23 |
// NOTE: Skip debugInfo handling (not implemented) |
| 24 |
|
| 25 |
$output->add( $this->value ); |
| 26 |
} |
| 27 |
|
| 28 |
public function isSilent() { |
| 29 |
$isReference = ( $this->currentFileInfo && isset( $this->currentFileInfo['reference'] ) && ( !isset( $this->isReferenced ) || !$this->isReferenced ) ); |
| 30 |
$isCompressed = Less_Parser::$options['compress'] && ( $this->value[2] ?? '' ) !== "!"; |
| 31 |
return $this->isLineComment || $isReference || $isCompressed; |
| 32 |
} |
| 33 |
|
| 34 |
public function markReferenced() { |
| 35 |
$this->isReferenced = true; |
| 36 |
} |
| 37 |
|
| 38 |
} |