Anonymous.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * Anonymous
  4. *
  5. * @package Less
  6. * @subpackage tree
  7. */
  8. class Less_Tree_Anonymous extends Less_Tree {
  9. public $value;
  10. public $quote;
  11. public $index;
  12. public $mapLines;
  13. public $currentFileInfo;
  14. public $type = 'Anonymous';
  15. /**
  16. * @param integer $index
  17. * @param boolean $mapLines
  18. */
  19. public function __construct( $value, $index = null, $currentFileInfo = null, $mapLines = null ) {
  20. $this->value = $value;
  21. $this->index = $index;
  22. $this->mapLines = $mapLines;
  23. $this->currentFileInfo = $currentFileInfo;
  24. }
  25. public function compile() {
  26. return new Less_Tree_Anonymous( $this->value, $this->index, $this->currentFileInfo, $this->mapLines );
  27. }
  28. public function compare( $x ) {
  29. if ( !is_object( $x ) ) {
  30. return -1;
  31. }
  32. $left = $this->toCSS();
  33. $right = $x->toCSS();
  34. if ( $left === $right ) {
  35. return 0;
  36. }
  37. return $left < $right ? -1 : 1;
  38. }
  39. /**
  40. * @see Less_Tree::genCSS
  41. */
  42. public function genCSS( $output ) {
  43. $output->add( $this->value, $this->currentFileInfo, $this->index, $this->mapLines );
  44. }
  45. public function toCSS() {
  46. return $this->value;
  47. }
  48. }