MDL-54934 workshop: ensure "Current phase" is always separated
[moodle.git] / lib / lessphp / Tree.php
blob0de1b40723fcb5c5e88ed8d214aaa72f470c777a
1 <?php
3 /**
4 * Tree
6 * @package Less
7 * @subpackage tree
8 */
9 class Less_Tree{
11 public $cache_string;
13 public function toCSS(){
14 $output = new Less_Output();
15 $this->genCSS($output);
16 return $output->toString();
20 /**
21 * Generate CSS by adding it to the output object
23 * @param Less_Output $output The output
24 * @return void
26 public function genCSS($output){}
29 /**
30 * @param Less_Tree_Ruleset[] $rules
32 public static function outputRuleset( $output, $rules ){
34 $ruleCnt = count($rules);
35 Less_Environment::$tabLevel++;
38 // Compressed
39 if( Less_Parser::$options['compress'] ){
40 $output->add('{');
41 for( $i = 0; $i < $ruleCnt; $i++ ){
42 $rules[$i]->genCSS( $output );
45 $output->add( '}' );
46 Less_Environment::$tabLevel--;
47 return;
51 // Non-compressed
52 $tabSetStr = "\n".str_repeat( ' ' , Less_Environment::$tabLevel-1 );
53 $tabRuleStr = $tabSetStr.' ';
55 $output->add( " {" );
56 for($i = 0; $i < $ruleCnt; $i++ ){
57 $output->add( $tabRuleStr );
58 $rules[$i]->genCSS( $output );
60 Less_Environment::$tabLevel--;
61 $output->add( $tabSetStr.'}' );
65 public function accept($visitor){}
68 public static function ReferencedArray($rules){
69 foreach($rules as $rule){
70 if( method_exists($rule, 'markReferenced') ){
71 $rule->markReferenced();
77 /**
78 * Requires php 5.3+
80 public static function __set_state($args){
82 $class = get_called_class();
83 $obj = new $class(null,null,null,null);
84 foreach($args as $key => $val){
85 $obj->$key = $val;
87 return $obj;