ORIENT/vendor/wikimedia/less.php/lib/Less/Tree/Anonymous.php

55 lines
1.0 KiB
PHP
Raw Normal View History

2021-04-08 08:08:59 +00:00
<?php
/**
2023-02-27 04:39:19 +00:00
* @private
2021-04-08 08:08:59 +00:00
*/
2023-02-27 04:39:19 +00:00
class Less_Tree_Anonymous extends Less_Tree {
2021-04-08 08:08:59 +00:00
public $value;
public $quote;
public $index;
public $mapLines;
public $currentFileInfo;
public $type = 'Anonymous';
/**
2023-02-27 04:39:19 +00:00
* @param int $index
* @param bool|null $mapLines
2021-04-08 08:08:59 +00:00
*/
2023-02-27 04:39:19 +00:00
public function __construct( $value, $index = null, $currentFileInfo = null, $mapLines = null ) {
2021-04-08 08:08:59 +00:00
$this->value = $value;
$this->index = $index;
$this->mapLines = $mapLines;
$this->currentFileInfo = $currentFileInfo;
}
2023-02-27 04:39:19 +00:00
public function compile( $env ) {
return new Less_Tree_Anonymous( $this->value, $this->index, $this->currentFileInfo, $this->mapLines );
2021-04-08 08:08:59 +00:00
}
2023-02-27 04:39:19 +00:00
public function compare( $x ) {
if ( !is_object( $x ) ) {
2021-04-08 08:08:59 +00:00
return -1;
}
$left = $this->toCSS();
$right = $x->toCSS();
2023-02-27 04:39:19 +00:00
if ( $left === $right ) {
2021-04-08 08:08:59 +00:00
return 0;
}
return $left < $right ? -1 : 1;
}
2023-02-27 04:39:19 +00:00
/**
* @see Less_Tree::genCSS
*/
public function genCSS( $output ) {
2021-04-08 08:08:59 +00:00
$output->add( $this->value, $this->currentFileInfo, $this->index, $this->mapLines );
}
2023-02-27 04:39:19 +00:00
public function toCSS() {
2021-04-08 08:08:59 +00:00
return $this->value;
}
}