[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Expression 5 * 6 * @package Less 7 * @subpackage tree 8 */ 9 class Less_Tree_Expression extends Less_Tree{ 10 11 public $value = array(); 12 public $parens = false; 13 public $parensInOp = false; 14 public $type = 'Expression'; 15 16 public function __construct( $value, $parens = null ){ 17 $this->value = $value; 18 $this->parens = $parens; 19 } 20 21 public function accept( $visitor ){ 22 $this->value = $visitor->visitArray( $this->value ); 23 } 24 25 public function compile($env) { 26 27 $doubleParen = false; 28 29 if( $this->parens && !$this->parensInOp ){ 30 Less_Environment::$parensStack++; 31 } 32 33 $returnValue = null; 34 if( $this->value ){ 35 36 $count = count($this->value); 37 38 if( $count > 1 ){ 39 40 $ret = array(); 41 foreach($this->value as $e){ 42 $ret[] = $e->compile($env); 43 } 44 $returnValue = new Less_Tree_Expression($ret); 45 46 }else{ 47 48 if( ($this->value[0] instanceof Less_Tree_Expression) && $this->value[0]->parens && !$this->value[0]->parensInOp ){ 49 $doubleParen = true; 50 } 51 52 $returnValue = $this->value[0]->compile($env); 53 } 54 55 } else { 56 $returnValue = $this; 57 } 58 59 if( $this->parens ){ 60 if( !$this->parensInOp ){ 61 Less_Environment::$parensStack--; 62 63 }elseif( !Less_Environment::isMathOn() && !$doubleParen ){ 64 $returnValue = new Less_Tree_Paren($returnValue); 65 66 } 67 } 68 return $returnValue; 69 } 70 71 /** 72 * @see Less_Tree::genCSS 73 */ 74 public function genCSS( $output ){ 75 $val_len = count($this->value); 76 for( $i = 0; $i < $val_len; $i++ ){ 77 $this->value[$i]->genCSS( $output ); 78 if( $i + 1 < $val_len ){ 79 $output->add( ' ' ); 80 } 81 } 82 } 83 84 public function throwAwayComments() { 85 86 if( is_array($this->value) ){ 87 $new_value = array(); 88 foreach($this->value as $v){ 89 if( $v instanceof Less_Tree_Comment ){ 90 continue; 91 } 92 $new_value[] = $v; 93 } 94 $this->value = $new_value; 95 } 96 } 97 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |