[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * Tree
   5   *
   6   * @package Less
   7   * @subpackage tree
   8   */
   9  class Less_Tree{
  10  
  11      public $cache_string;
  12  
  13  	public function toCSS(){
  14          $output = new Less_Output();
  15          $this->genCSS($output);
  16          return $output->toString();
  17      }
  18  
  19  
  20      /**
  21       * Generate CSS by adding it to the output object
  22       *
  23       * @param Less_Output $output The output
  24       * @return void
  25       */
  26      public function genCSS($output){}
  27  
  28  
  29      /**
  30       * @param Less_Tree_Ruleset[] $rules
  31       */
  32  	public static function outputRuleset( $output, $rules ){
  33  
  34          $ruleCnt = count($rules);
  35          Less_Environment::$tabLevel++;
  36  
  37  
  38          // Compressed
  39          if( Less_Parser::$options['compress'] ){
  40              $output->add('{');
  41              for( $i = 0; $i < $ruleCnt; $i++ ){
  42                  $rules[$i]->genCSS( $output );
  43              }
  44  
  45              $output->add( '}' );
  46              Less_Environment::$tabLevel--;
  47              return;
  48          }
  49  
  50  
  51          // Non-compressed
  52          $tabSetStr = "\n".str_repeat( Less_Parser::$options['indentation'] , Less_Environment::$tabLevel-1 );
  53          $tabRuleStr = $tabSetStr.Less_Parser::$options['indentation'];
  54  
  55          $output->add( " {" );
  56          for($i = 0; $i < $ruleCnt; $i++ ){
  57              $output->add( $tabRuleStr );
  58              $rules[$i]->genCSS( $output );
  59          }
  60          Less_Environment::$tabLevel--;
  61          $output->add( $tabSetStr.'}' );
  62  
  63      }
  64  
  65  	public function accept($visitor){}
  66  
  67  
  68  	public static function ReferencedArray($rules){
  69          foreach($rules as $rule){
  70              if( method_exists($rule, 'markReferenced') ){
  71                  $rule->markReferenced();
  72              }
  73          }
  74      }
  75  
  76  
  77      /**
  78       * Requires php 5.3+
  79       */
  80  	public static function __set_state($args){
  81  
  82          $class = get_called_class();
  83          $obj = new $class(null,null,null,null);
  84          foreach($args as $key => $val){
  85              $obj->$key = $val;
  86          }
  87          return $obj;
  88      }
  89  
  90  }


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