[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/lessphp/Tree/ -> Element.php (source)

   1  <?php
   2  
   3  /**
   4   * Element
   5   *
   6   * @package Less
   7   * @subpackage tree
   8   */
   9  class Less_Tree_Element extends Less_Tree{
  10  
  11      public $combinator = '';
  12      public $value = '';
  13      public $index;
  14      public $currentFileInfo;
  15      public $type = 'Element';
  16  
  17      public $value_is_object = false;
  18  
  19  	public function __construct($combinator, $value, $index = null, $currentFileInfo = null ){
  20  
  21          $this->value = $value;
  22          $this->value_is_object = is_object($value);
  23  
  24          if( $combinator ){
  25              $this->combinator = $combinator;
  26          }
  27  
  28          $this->index = $index;
  29          $this->currentFileInfo = $currentFileInfo;
  30      }
  31  
  32      public function accept( $visitor ){
  33          if( $this->value_is_object ){ //object or string
  34              $this->value = $visitor->visitObj( $this->value );
  35          }
  36      }
  37  
  38  	public function compile($env){
  39  
  40          if( Less_Environment::$mixin_stack ){
  41              return new Less_Tree_Element($this->combinator, ($this->value_is_object ? $this->value->compile($env) : $this->value), $this->index, $this->currentFileInfo );
  42          }
  43  
  44          if( $this->value_is_object ){
  45              $this->value = $this->value->compile($env);
  46          }
  47  
  48          return $this;
  49      }
  50  
  51      /**
  52       * @see Less_Tree::genCSS
  53       */
  54  	public function genCSS( $output ){
  55          $output->add( $this->toCSS(), $this->currentFileInfo, $this->index );
  56      }
  57  
  58  	public function toCSS(){
  59  
  60          if( $this->value_is_object ){
  61              $value = $this->value->toCSS();
  62          }else{
  63              $value = $this->value;
  64          }
  65  
  66  
  67          if( $value === '' && $this->combinator && $this->combinator === '&' ){
  68              return '';
  69          }
  70  
  71  
  72          return Less_Environment::$_outputMap[$this->combinator] . $value;
  73      }
  74  
  75  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1