Keyword.php 688 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Keyword
  4. *
  5. * @package Less
  6. * @subpackage tree
  7. */
  8. class Less_Tree_Keyword extends Less_Tree{
  9. public $value;
  10. public $type = 'Keyword';
  11. /**
  12. * @param string $value
  13. */
  14. public function __construct($value){
  15. $this->value = $value;
  16. }
  17. public function compile(){
  18. return $this;
  19. }
  20. /**
  21. * @see Less_Tree::genCSS
  22. */
  23. public function genCSS( $output ){
  24. if( $this->value === '%') {
  25. throw new Less_Exception_Compiler("Invalid % without number");
  26. }
  27. $output->add( $this->value );
  28. }
  29. public function compare($other) {
  30. if ($other instanceof Less_Tree_Keyword) {
  31. return $other->value === $this->value ? 0 : 1;
  32. } else {
  33. return -1;
  34. }
  35. }
  36. }