[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * Attribute
   5   *
   6   * @package Less
   7   * @subpackage tree
   8   */
   9  class Less_Tree_Attribute extends Less_Tree{
  10  
  11      public $key;
  12      public $op;
  13      public $value;
  14      public $type = 'Attribute';
  15  
  16      public function __construct($key, $op, $value){
  17          $this->key = $key;
  18          $this->op = $op;
  19          $this->value = $value;
  20      }
  21  
  22      public function compile($env){
  23  
  24          $key_obj = is_object($this->key);
  25          $val_obj = is_object($this->value);
  26  
  27          if( !$key_obj && !$val_obj ){
  28              return $this;
  29          }
  30  
  31          return new Less_Tree_Attribute(
  32              $key_obj ? $this->key->compile($env) : $this->key ,
  33              $this->op,
  34              $val_obj ? $this->value->compile($env) : $this->value);
  35      }
  36  
  37      /**
  38       * @see Less_Tree::genCSS
  39       */
  40      public function genCSS( $output ){
  41          $output->add( $this->toCSS() );
  42      }
  43  
  44      public function toCSS(){
  45          $value = $this->key;
  46  
  47          if( $this->op ){
  48              $value .= $this->op;
  49              $value .= (is_object($this->value) ? $this->value->toCSS() : $this->value);
  50          }
  51  
  52          return '[' . $value . ']';
  53      }
  54  }


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