@@ -8,13 +8,13 @@ discard block |
||
| 8 | 8 | * @subpackage tree |
| 9 | 9 | */ |
| 10 | 10 | class Less_Tree_Call extends Less_Tree{ |
| 11 | - public $value; |
|
| 11 | + public $value; |
|
| 12 | 12 | |
| 13 | - protected $name; |
|
| 14 | - protected $args; |
|
| 15 | - protected $index; |
|
| 16 | - protected $currentFileInfo; |
|
| 17 | - public $type = 'Call'; |
|
| 13 | + protected $name; |
|
| 14 | + protected $args; |
|
| 15 | + protected $index; |
|
| 16 | + protected $currentFileInfo; |
|
| 17 | + public $type = 'Call'; |
|
| 18 | 18 | |
| 19 | 19 | public function __construct($name, $args, $index, $currentFileInfo = null ){ |
| 20 | 20 | $this->name = $name; |
@@ -23,23 +23,23 @@ discard block |
||
| 23 | 23 | $this->currentFileInfo = $currentFileInfo; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function accept( $visitor ){ |
|
| 26 | + public function accept( $visitor ){ |
|
| 27 | 27 | $this->args = $visitor->visitArray( $this->args ); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - // |
|
| 31 | - // When evaluating a function call, |
|
| 32 | - // we either find the function in `tree.functions` [1], |
|
| 33 | - // in which case we call it, passing the evaluated arguments, |
|
| 34 | - // or we simply print it out as it appeared originally [2]. |
|
| 35 | - // |
|
| 36 | - // The *functions.js* file contains the built-in functions. |
|
| 37 | - // |
|
| 38 | - // The reason why we evaluate the arguments, is in the case where |
|
| 39 | - // we try to pass a variable to a function, like: `saturate(@color)`. |
|
| 40 | - // The function should receive the value, not the variable. |
|
| 41 | - // |
|
| 42 | - public function compile($env=null){ |
|
| 30 | + // |
|
| 31 | + // When evaluating a function call, |
|
| 32 | + // we either find the function in `tree.functions` [1], |
|
| 33 | + // in which case we call it, passing the evaluated arguments, |
|
| 34 | + // or we simply print it out as it appeared originally [2]. |
|
| 35 | + // |
|
| 36 | + // The *functions.js* file contains the built-in functions. |
|
| 37 | + // |
|
| 38 | + // The reason why we evaluate the arguments, is in the case where |
|
| 39 | + // we try to pass a variable to a function, like: `saturate(@color)`. |
|
| 40 | + // The function should receive the value, not the variable. |
|
| 41 | + // |
|
| 42 | + public function compile($env=null){ |
|
| 43 | 43 | $args = array(); |
| 44 | 44 | foreach($this->args as $a){ |
| 45 | 45 | $args[] = $a->compile($env); |
@@ -94,11 +94,11 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | return new Less_Tree_Call( $this->name, $args, $this->index, $this->currentFileInfo ); |
| 97 | - } |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - /** |
|
| 100 | - * @see Less_Tree::genCSS |
|
| 101 | - */ |
|
| 99 | + /** |
|
| 100 | + * @see Less_Tree::genCSS |
|
| 101 | + */ |
|
| 102 | 102 | public function genCSS( $output ){ |
| 103 | 103 | |
| 104 | 104 | $output->add( $this->name . '(', $this->currentFileInfo, $this->index ); |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
| 117 | - //public function toCSS(){ |
|
| 118 | - // return $this->compile()->toCSS(); |
|
| 119 | - //} |
|
| 117 | + //public function toCSS(){ |
|
| 118 | + // return $this->compile()->toCSS(); |
|
| 119 | + //} |
|
| 120 | 120 | |
| 121 | 121 | } |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * @package Less |
| 8 | 8 | * @subpackage tree |
| 9 | 9 | */ |
| 10 | -class Less_Tree_Call extends Less_Tree{ |
|
| 10 | +class Less_Tree_Call extends Less_Tree { |
|
| 11 | 11 | public $value; |
| 12 | 12 | |
| 13 | 13 | protected $name; |
@@ -16,15 +16,15 @@ discard block |
||
| 16 | 16 | protected $currentFileInfo; |
| 17 | 17 | public $type = 'Call'; |
| 18 | 18 | |
| 19 | - public function __construct($name, $args, $index, $currentFileInfo = null ){ |
|
| 19 | + public function __construct($name, $args, $index, $currentFileInfo = null) { |
|
| 20 | 20 | $this->name = $name; |
| 21 | 21 | $this->args = $args; |
| 22 | 22 | $this->index = $index; |
| 23 | 23 | $this->currentFileInfo = $currentFileInfo; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function accept( $visitor ){ |
|
| 27 | - $this->args = $visitor->visitArray( $this->args ); |
|
| 26 | + public function accept($visitor) { |
|
| 27 | + $this->args = $visitor->visitArray($this->args); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // |
@@ -39,14 +39,14 @@ discard block |
||
| 39 | 39 | // we try to pass a variable to a function, like: `saturate(@color)`. |
| 40 | 40 | // The function should receive the value, not the variable. |
| 41 | 41 | // |
| 42 | - public function compile($env=null){ |
|
| 42 | + public function compile($env = null) { |
|
| 43 | 43 | $args = array(); |
| 44 | - foreach($this->args as $a){ |
|
| 44 | + foreach ($this->args as $a) { |
|
| 45 | 45 | $args[] = $a->compile($env); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $nameLC = strtolower($this->name); |
| 49 | - switch($nameLC){ |
|
| 49 | + switch ($nameLC) { |
|
| 50 | 50 | case '%': |
| 51 | 51 | $nameLC = '_percent'; |
| 52 | 52 | break; |
@@ -65,52 +65,52 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $result = null; |
| 68 | - if( $nameLC === 'default' ){ |
|
| 68 | + if ($nameLC==='default') { |
|
| 69 | 69 | $result = Less_Tree_DefaultFunc::compile(); |
| 70 | 70 | |
| 71 | - }else{ |
|
| 71 | + }else { |
|
| 72 | 72 | |
| 73 | - if( method_exists('Less_Functions',$nameLC) ){ // 1. |
|
| 73 | + if (method_exists('Less_Functions', $nameLC)) { // 1. |
|
| 74 | 74 | try { |
| 75 | 75 | |
| 76 | 76 | $func = new Less_Functions($env, $this->currentFileInfo); |
| 77 | - $result = call_user_func_array( array($func,$nameLC),$args); |
|
| 77 | + $result = call_user_func_array(array($func, $nameLC), $args); |
|
| 78 | 78 | |
| 79 | 79 | } catch (Exception $e) { |
| 80 | - throw new Less_Exception_Compiler('error evaluating function `' . $this->name . '` '.$e->getMessage().' index: '. $this->index); |
|
| 80 | + throw new Less_Exception_Compiler('error evaluating function `'.$this->name.'` '.$e->getMessage().' index: '.$this->index); |
|
| 81 | 81 | } |
| 82 | - } elseif( isset( $env->functions[$nameLC] ) && is_callable( $env->functions[$nameLC] ) ) { |
|
| 82 | + } elseif (isset($env->functions[$nameLC]) && is_callable($env->functions[$nameLC])) { |
|
| 83 | 83 | try { |
| 84 | - $result = call_user_func_array( $env->functions[$nameLC], $args ); |
|
| 84 | + $result = call_user_func_array($env->functions[$nameLC], $args); |
|
| 85 | 85 | } catch (Exception $e) { |
| 86 | - throw new Less_Exception_Compiler('error evaluating function `' . $this->name . '` '.$e->getMessage().' index: '. $this->index); |
|
| 86 | + throw new Less_Exception_Compiler('error evaluating function `'.$this->name.'` '.$e->getMessage().' index: '.$this->index); |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - if( $result !== null ){ |
|
| 91 | + if ($result!==null) { |
|
| 92 | 92 | return $result; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | |
| 96 | - return new Less_Tree_Call( $this->name, $args, $this->index, $this->currentFileInfo ); |
|
| 96 | + return new Less_Tree_Call($this->name, $args, $this->index, $this->currentFileInfo); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * @see Less_Tree::genCSS |
| 101 | 101 | */ |
| 102 | - public function genCSS( $output ){ |
|
| 102 | + public function genCSS($output) { |
|
| 103 | 103 | |
| 104 | - $output->add( $this->name . '(', $this->currentFileInfo, $this->index ); |
|
| 104 | + $output->add($this->name.'(', $this->currentFileInfo, $this->index); |
|
| 105 | 105 | $args_len = count($this->args); |
| 106 | - for($i = 0; $i < $args_len; $i++ ){ |
|
| 107 | - $this->args[$i]->genCSS( $output ); |
|
| 108 | - if( $i + 1 < $args_len ){ |
|
| 109 | - $output->add( ', ' ); |
|
| 106 | + for ($i = 0; $i<$args_len; $i++) { |
|
| 107 | + $this->args[$i]->genCSS($output); |
|
| 108 | + if ($i+1<$args_len) { |
|
| 109 | + $output->add(', '); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - $output->add( ')' ); |
|
| 113 | + $output->add(')'); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | $this->$funcName( $node ); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - }else{ |
|
| 36 | + } else{ |
|
| 37 | 37 | $node->accept($this); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | //Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript |
| 151 | - public function toHSV() { |
|
| 151 | + public function toHSV() { |
|
| 152 | 152 | $r = $this->rgb[0] / 255; |
| 153 | 153 | $g = $this->rgb[1] / 255; |
| 154 | 154 | $b = $this->rgb[2] / 255; |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $x->alpha === $this->alpha) ? 0 : -1; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - public function toHex( $v ){ |
|
| 199 | + public function toHex( $v ){ |
|
| 200 | 200 | |
| 201 | 201 | $ret = '#'; |
| 202 | 202 | foreach($v as $c){ |
@@ -6,15 +6,15 @@ discard block |
||
| 6 | 6 | * @package Less |
| 7 | 7 | * @subpackage tree |
| 8 | 8 | */ |
| 9 | -class Less_Tree_Color extends Less_Tree{ |
|
| 9 | +class Less_Tree_Color extends Less_Tree { |
|
| 10 | 10 | public $rgb; |
| 11 | 11 | public $alpha; |
| 12 | 12 | public $isTransparentKeyword; |
| 13 | 13 | public $type = 'Color'; |
| 14 | 14 | |
| 15 | - public function __construct($rgb, $a = 1, $isTransparentKeyword = null ){ |
|
| 15 | + public function __construct($rgb, $a = 1, $isTransparentKeyword = null) { |
|
| 16 | 16 | |
| 17 | - if( $isTransparentKeyword ){ |
|
| 17 | + if ($isTransparentKeyword) { |
|
| 18 | 18 | $this->rgb = $rgb; |
| 19 | 19 | $this->alpha = $a; |
| 20 | 20 | $this->isTransparentKeyword = true; |
@@ -22,46 +22,46 @@ discard block |
||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | $this->rgb = array(); |
| 25 | - if( is_array($rgb) ){ |
|
| 25 | + if (is_array($rgb)) { |
|
| 26 | 26 | $this->rgb = $rgb; |
| 27 | - }else if( strlen($rgb) == 6 ){ |
|
| 28 | - foreach(str_split($rgb, 2) as $c){ |
|
| 27 | + }else if (strlen($rgb)==6) { |
|
| 28 | + foreach (str_split($rgb, 2) as $c) { |
|
| 29 | 29 | $this->rgb[] = hexdec($c); |
| 30 | 30 | } |
| 31 | - }else{ |
|
| 32 | - foreach(str_split($rgb, 1) as $c){ |
|
| 31 | + }else { |
|
| 32 | + foreach (str_split($rgb, 1) as $c) { |
|
| 33 | 33 | $this->rgb[] = hexdec($c.$c); |
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | $this->alpha = is_numeric($a) ? $a : 1; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - public function compile(){ |
|
| 39 | + public function compile() { |
|
| 40 | 40 | return $this; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function luma(){ |
|
| 43 | + public function luma() { |
|
| 44 | 44 | $r = $this->rgb[0] / 255; |
| 45 | 45 | $g = $this->rgb[1] / 255; |
| 46 | 46 | $b = $this->rgb[2] / 255; |
| 47 | 47 | |
| 48 | - $r = ($r <= 0.03928) ? $r / 12.92 : pow((($r + 0.055) / 1.055), 2.4); |
|
| 49 | - $g = ($g <= 0.03928) ? $g / 12.92 : pow((($g + 0.055) / 1.055), 2.4); |
|
| 50 | - $b = ($b <= 0.03928) ? $b / 12.92 : pow((($b + 0.055) / 1.055), 2.4); |
|
| 48 | + $r = ($r<=0.03928) ? $r / 12.92 : pow((($r+0.055) / 1.055), 2.4); |
|
| 49 | + $g = ($g<=0.03928) ? $g / 12.92 : pow((($g+0.055) / 1.055), 2.4); |
|
| 50 | + $b = ($b<=0.03928) ? $b / 12.92 : pow((($b+0.055) / 1.055), 2.4); |
|
| 51 | 51 | |
| 52 | - return 0.2126 * $r + 0.7152 * $g + 0.0722 * $b; |
|
| 52 | + return 0.2126 * $r+0.7152 * $g+0.0722 * $b; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * @see Less_Tree::genCSS |
| 57 | 57 | */ |
| 58 | - public function genCSS( $output ){ |
|
| 59 | - $output->add( $this->toCSS() ); |
|
| 58 | + public function genCSS($output) { |
|
| 59 | + $output->add($this->toCSS()); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public function toCSS( $doNotCompress = false ){ |
|
| 62 | + public function toCSS($doNotCompress = false) { |
|
| 63 | 63 | $compress = Less_Parser::$options['compress'] && !$doNotCompress; |
| 64 | - $alpha = Less_Functions::fround( $this->alpha ); |
|
| 64 | + $alpha = Less_Functions::fround($this->alpha); |
|
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | // |
@@ -70,28 +70,28 @@ discard block |
||
| 70 | 70 | // which has better compatibility with older browsers. |
| 71 | 71 | // Values are capped between `0` and `255`, rounded and zero-padded. |
| 72 | 72 | // |
| 73 | - if( $alpha < 1 ){ |
|
| 74 | - if( $alpha === 0 && isset($this->isTransparentKeyword) && $this->isTransparentKeyword ){ |
|
| 73 | + if ($alpha<1) { |
|
| 74 | + if ($alpha===0 && isset($this->isTransparentKeyword) && $this->isTransparentKeyword) { |
|
| 75 | 75 | return 'transparent'; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | $values = array(); |
| 79 | - foreach($this->rgb as $c){ |
|
| 80 | - $values[] = Less_Functions::clamp( round($c), 255); |
|
| 79 | + foreach ($this->rgb as $c) { |
|
| 80 | + $values[] = Less_Functions::clamp(round($c), 255); |
|
| 81 | 81 | } |
| 82 | 82 | $values[] = $alpha; |
| 83 | 83 | |
| 84 | 84 | $glue = ($compress ? ',' : ', '); |
| 85 | - return "rgba(" . implode($glue, $values) . ")"; |
|
| 86 | - }else{ |
|
| 85 | + return "rgba(".implode($glue, $values).")"; |
|
| 86 | + }else { |
|
| 87 | 87 | |
| 88 | 88 | $color = $this->toRGB(); |
| 89 | 89 | |
| 90 | - if( $compress ){ |
|
| 90 | + if ($compress) { |
|
| 91 | 91 | |
| 92 | 92 | // Convert color to short format |
| 93 | - if( $color[1] === $color[2] && $color[3] === $color[4] && $color[5] === $color[6]) { |
|
| 94 | - $color = '#'.$color[1] . $color[3] . $color[5]; |
|
| 93 | + if ($color[1]===$color[2] && $color[3]===$color[4] && $color[5]===$color[6]) { |
|
| 94 | + $color = '#'.$color[1].$color[3].$color[5]; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
@@ -109,20 +109,20 @@ discard block |
||
| 109 | 109 | /** |
| 110 | 110 | * @param string $op |
| 111 | 111 | */ |
| 112 | - public function operate( $op, $other) { |
|
| 112 | + public function operate($op, $other) { |
|
| 113 | 113 | $rgb = array(); |
| 114 | - $alpha = $this->alpha * (1 - $other->alpha) + $other->alpha; |
|
| 115 | - for ($c = 0; $c < 3; $c++) { |
|
| 116 | - $rgb[$c] = Less_Functions::operate( $op, $this->rgb[$c], $other->rgb[$c]); |
|
| 114 | + $alpha = $this->alpha * (1-$other->alpha)+$other->alpha; |
|
| 115 | + for ($c = 0; $c<3; $c++) { |
|
| 116 | + $rgb[$c] = Less_Functions::operate($op, $this->rgb[$c], $other->rgb[$c]); |
|
| 117 | 117 | } |
| 118 | 118 | return new Less_Tree_Color($rgb, $alpha); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - public function toRGB(){ |
|
| 121 | + public function toRGB() { |
|
| 122 | 122 | return $this->toHex($this->rgb); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - public function toHSL(){ |
|
| 125 | + public function toHSL() { |
|
| 126 | 126 | $r = $this->rgb[0] / 255; |
| 127 | 127 | $g = $this->rgb[1] / 255; |
| 128 | 128 | $b = $this->rgb[2] / 255; |
@@ -130,21 +130,21 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | $max = max($r, $g, $b); |
| 132 | 132 | $min = min($r, $g, $b); |
| 133 | - $l = ($max + $min) / 2; |
|
| 134 | - $d = $max - $min; |
|
| 133 | + $l = ($max+$min) / 2; |
|
| 134 | + $d = $max-$min; |
|
| 135 | 135 | |
| 136 | 136 | $h = $s = 0; |
| 137 | - if( $max !== $min ){ |
|
| 138 | - $s = $l > 0.5 ? $d / (2 - $max - $min) : $d / ($max + $min); |
|
| 137 | + if ($max!==$min) { |
|
| 138 | + $s = $l>0.5 ? $d / (2-$max-$min) : $d / ($max+$min); |
|
| 139 | 139 | |
| 140 | 140 | switch ($max) { |
| 141 | - case $r: $h = ($g - $b) / $d + ($g < $b ? 6 : 0); break; |
|
| 142 | - case $g: $h = ($b - $r) / $d + 2; break; |
|
| 143 | - case $b: $h = ($r - $g) / $d + 4; break; |
|
| 141 | + case $r: $h = ($g-$b) / $d+($g<$b ? 6 : 0); break; |
|
| 142 | + case $g: $h = ($b-$r) / $d+2; break; |
|
| 143 | + case $b: $h = ($r-$g) / $d+4; break; |
|
| 144 | 144 | } |
| 145 | 145 | $h /= 6; |
| 146 | 146 | } |
| 147 | - return array('h' => $h * 360, 's' => $s, 'l' => $l, 'a' => $a ); |
|
| 147 | + return array('h' => $h * 360, 's' => $s, 'l' => $l, 'a' => $a); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | //Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript |
@@ -159,49 +159,49 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | $v = $max; |
| 161 | 161 | |
| 162 | - $d = $max - $min; |
|
| 163 | - if ($max === 0) { |
|
| 162 | + $d = $max-$min; |
|
| 163 | + if ($max===0) { |
|
| 164 | 164 | $s = 0; |
| 165 | - } else { |
|
| 165 | + }else { |
|
| 166 | 166 | $s = $d / $max; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | $h = 0; |
| 170 | - if( $max !== $min ){ |
|
| 171 | - switch($max){ |
|
| 172 | - case $r: $h = ($g - $b) / $d + ($g < $b ? 6 : 0); break; |
|
| 173 | - case $g: $h = ($b - $r) / $d + 2; break; |
|
| 174 | - case $b: $h = ($r - $g) / $d + 4; break; |
|
| 170 | + if ($max!==$min) { |
|
| 171 | + switch ($max) { |
|
| 172 | + case $r: $h = ($g-$b) / $d+($g<$b ? 6 : 0); break; |
|
| 173 | + case $g: $h = ($b-$r) / $d+2; break; |
|
| 174 | + case $b: $h = ($r-$g) / $d+4; break; |
|
| 175 | 175 | } |
| 176 | 176 | $h /= 6; |
| 177 | 177 | } |
| 178 | - return array('h'=> $h * 360, 's'=> $s, 'v'=> $v, 'a' => $a ); |
|
| 178 | + return array('h'=> $h * 360, 's'=> $s, 'v'=> $v, 'a' => $a); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - public function toARGB(){ |
|
| 182 | - $argb = array_merge( (array) Less_Parser::round($this->alpha * 255), $this->rgb); |
|
| 183 | - return $this->toHex( $argb ); |
|
| 181 | + public function toARGB() { |
|
| 182 | + $argb = array_merge((array)Less_Parser::round($this->alpha * 255), $this->rgb); |
|
| 183 | + return $this->toHex($argb); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - public function compare($x){ |
|
| 186 | + public function compare($x) { |
|
| 187 | 187 | |
| 188 | - if( !property_exists( $x, 'rgb' ) ){ |
|
| 188 | + if (!property_exists($x, 'rgb')) { |
|
| 189 | 189 | return -1; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | |
| 193 | - return ($x->rgb[0] === $this->rgb[0] && |
|
| 194 | - $x->rgb[1] === $this->rgb[1] && |
|
| 195 | - $x->rgb[2] === $this->rgb[2] && |
|
| 196 | - $x->alpha === $this->alpha) ? 0 : -1; |
|
| 193 | + return ($x->rgb[0]===$this->rgb[0] && |
|
| 194 | + $x->rgb[1]===$this->rgb[1] && |
|
| 195 | + $x->rgb[2]===$this->rgb[2] && |
|
| 196 | + $x->alpha===$this->alpha) ? 0 : -1; |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - public function toHex( $v ){ |
|
| 199 | + public function toHex($v) { |
|
| 200 | 200 | |
| 201 | 201 | $ret = '#'; |
| 202 | - foreach($v as $c){ |
|
| 203 | - $c = Less_Functions::clamp( Less_Parser::round($c), 255); |
|
| 204 | - if( $c < 16 ){ |
|
| 202 | + foreach ($v as $c) { |
|
| 203 | + $c = Less_Functions::clamp(Less_Parser::round($c), 255); |
|
| 204 | + if ($c<16) { |
|
| 205 | 205 | $ret .= '0'; |
| 206 | 206 | } |
| 207 | 207 | $ret .= dechex($c); |
@@ -214,16 +214,16 @@ discard block |
||
| 214 | 214 | /** |
| 215 | 215 | * @param string $keyword |
| 216 | 216 | */ |
| 217 | - public static function fromKeyword( $keyword ){ |
|
| 217 | + public static function fromKeyword($keyword) { |
|
| 218 | 218 | $keyword = strtolower($keyword); |
| 219 | 219 | |
| 220 | - if( Less_Colors::hasOwnProperty($keyword) ){ |
|
| 220 | + if (Less_Colors::hasOwnProperty($keyword)) { |
|
| 221 | 221 | // detect named color |
| 222 | 222 | return new Less_Tree_Color(substr(Less_Colors::color($keyword), 1)); |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - if( $keyword === 'transparent' ){ |
|
| 226 | - return new Less_Tree_Color( array(0, 0, 0), 0, true); |
|
| 225 | + if ($keyword==='transparent') { |
|
| 226 | + return new Less_Tree_Color(array(0, 0, 0), 0, true); |
|
| 227 | 227 | } |
| 228 | 228 | } |
| 229 | 229 | |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | $this->rgb = array(); |
| 25 | 25 | if( is_array($rgb) ){ |
| 26 | 26 | $this->rgb = $rgb; |
| 27 | - }else if( strlen($rgb) == 6 ){ |
|
| 27 | + } else if( strlen($rgb) == 6 ){ |
|
| 28 | 28 | foreach(str_split($rgb, 2) as $c){ |
| 29 | 29 | $this->rgb[] = hexdec($c); |
| 30 | 30 | } |
| 31 | - }else{ |
|
| 31 | + } else{ |
|
| 32 | 32 | foreach(str_split($rgb, 1) as $c){ |
| 33 | 33 | $this->rgb[] = hexdec($c.$c); |
| 34 | 34 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | $glue = ($compress ? ',' : ', '); |
| 85 | 85 | return "rgba(" . implode($glue, $values) . ")"; |
| 86 | - }else{ |
|
| 86 | + } else{ |
|
| 87 | 87 | |
| 88 | 88 | $color = $this->toRGB(); |
| 89 | 89 | |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @package Less |
| 7 | 7 | * @subpackage tree |
| 8 | 8 | */ |
| 9 | -class Less_Tree_Comment extends Less_Tree{ |
|
| 9 | +class Less_Tree_Comment extends Less_Tree { |
|
| 10 | 10 | |
| 11 | 11 | public $value; |
| 12 | 12 | public $silent; |
@@ -14,37 +14,37 @@ discard block |
||
| 14 | 14 | public $currentFileInfo; |
| 15 | 15 | public $type = 'Comment'; |
| 16 | 16 | |
| 17 | - public function __construct($value, $silent, $index = null, $currentFileInfo = null ){ |
|
| 17 | + public function __construct($value, $silent, $index = null, $currentFileInfo = null) { |
|
| 18 | 18 | $this->value = $value; |
| 19 | - $this->silent = !! $silent; |
|
| 19 | + $this->silent = !!$silent; |
|
| 20 | 20 | $this->currentFileInfo = $currentFileInfo; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * @see Less_Tree::genCSS |
| 25 | 25 | */ |
| 26 | - public function genCSS( $output ){ |
|
| 26 | + public function genCSS($output) { |
|
| 27 | 27 | //if( $this->debugInfo ){ |
| 28 | 28 | //$output->add( tree.debugInfo($env, $this), $this->currentFileInfo, $this->index); |
| 29 | 29 | //} |
| 30 | - $output->add( trim($this->value) );//TODO shouldn't need to trim, we shouldn't grab the \n |
|
| 30 | + $output->add(trim($this->value)); //TODO shouldn't need to trim, we shouldn't grab the \n |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function toCSS(){ |
|
| 33 | + public function toCSS() { |
|
| 34 | 34 | return Less_Parser::$options['compress'] ? '' : $this->value; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function isSilent(){ |
|
| 38 | - $isReference = ($this->currentFileInfo && isset($this->currentFileInfo['reference']) && (!isset($this->isReferenced) || !$this->isReferenced) ); |
|
| 37 | + public function isSilent() { |
|
| 38 | + $isReference = ($this->currentFileInfo && isset($this->currentFileInfo['reference']) && (!isset($this->isReferenced) || !$this->isReferenced)); |
|
| 39 | 39 | $isCompressed = Less_Parser::$options['compress'] && !preg_match('/^\/\*!/', $this->value); |
| 40 | 40 | return $this->silent || $isReference || $isCompressed; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function compile(){ |
|
| 43 | + public function compile() { |
|
| 44 | 44 | return $this; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function markReferenced(){ |
|
| 47 | + public function markReferenced() { |
|
| 48 | 48 | $this->isReferenced = true; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -15,9 +15,9 @@ |
||
| 15 | 15 | $this->value = $value; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @see Less_Tree::genCSS |
|
| 20 | - */ |
|
| 18 | + /** |
|
| 19 | + * @see Less_Tree::genCSS |
|
| 20 | + */ |
|
| 21 | 21 | public function genCSS( $output ){ |
| 22 | 22 | $output->add( $this->value ); |
| 23 | 23 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | $this->rvalue = $visitor->visitObj( $this->rvalue ); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function compile($env) { |
|
| 31 | + public function compile($env) { |
|
| 32 | 32 | $a = $this->lvalue->compile($env); |
| 33 | 33 | $b = $this->rvalue->compile($env); |
| 34 | 34 | |
@@ -67,6 +67,6 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | return $this->negate ? !$result : $result; |
| 70 | - } |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | 72 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @package Less |
| 7 | 7 | * @subpackage tree |
| 8 | 8 | */ |
| 9 | -class Less_Tree_Condition extends Less_Tree{ |
|
| 9 | +class Less_Tree_Condition extends Less_Tree { |
|
| 10 | 10 | |
| 11 | 11 | public $op; |
| 12 | 12 | public $lvalue; |
@@ -23,16 +23,16 @@ discard block |
||
| 23 | 23 | $this->negate = $negate; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function accept($visitor){ |
|
| 27 | - $this->lvalue = $visitor->visitObj( $this->lvalue ); |
|
| 28 | - $this->rvalue = $visitor->visitObj( $this->rvalue ); |
|
| 26 | + public function accept($visitor) { |
|
| 27 | + $this->lvalue = $visitor->visitObj($this->lvalue); |
|
| 28 | + $this->rvalue = $visitor->visitObj($this->rvalue); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function compile($env) { |
| 32 | 32 | $a = $this->lvalue->compile($env); |
| 33 | 33 | $b = $this->rvalue->compile($env); |
| 34 | 34 | |
| 35 | - switch( $this->op ){ |
|
| 35 | + switch ($this->op) { |
|
| 36 | 36 | case 'and': |
| 37 | 37 | $result = $a && $b; |
| 38 | 38 | break; |
@@ -42,25 +42,25 @@ discard block |
||
| 42 | 42 | break; |
| 43 | 43 | |
| 44 | 44 | default: |
| 45 | - if( Less_Parser::is_method($a, 'compare') ){ |
|
| 45 | + if (Less_Parser::is_method($a, 'compare')) { |
|
| 46 | 46 | $result = $a->compare($b); |
| 47 | - }elseif( Less_Parser::is_method($b, 'compare') ){ |
|
| 47 | + }elseif (Less_Parser::is_method($b, 'compare')) { |
|
| 48 | 48 | $result = $b->compare($a); |
| 49 | - }else{ |
|
| 49 | + }else { |
|
| 50 | 50 | throw new Less_Exception_Compiler('Unable to perform comparison', null, $this->index); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | switch ($result) { |
| 54 | 54 | case -1: |
| 55 | - $result = $this->op === '<' || $this->op === '=<' || $this->op === '<='; |
|
| 55 | + $result = $this->op==='<' || $this->op==='=<' || $this->op==='<='; |
|
| 56 | 56 | break; |
| 57 | 57 | |
| 58 | 58 | case 0: |
| 59 | - $result = $this->op === '=' || $this->op === '>=' || $this->op === '=<' || $this->op === '<='; |
|
| 59 | + $result = $this->op==='=' || $this->op==='>=' || $this->op==='=<' || $this->op==='<='; |
|
| 60 | 60 | break; |
| 61 | 61 | |
| 62 | 62 | case 1: |
| 63 | - $result = $this->op === '>' || $this->op === '>='; |
|
| 63 | + $result = $this->op==='>' || $this->op==='>='; |
|
| 64 | 64 | break; |
| 65 | 65 | } |
| 66 | 66 | break; |
@@ -44,9 +44,9 @@ |
||
| 44 | 44 | default: |
| 45 | 45 | if( Less_Parser::is_method($a, 'compare') ){ |
| 46 | 46 | $result = $a->compare($b); |
| 47 | - }elseif( Less_Parser::is_method($b, 'compare') ){ |
|
| 47 | + } elseif( Less_Parser::is_method($b, 'compare') ){ |
|
| 48 | 48 | $result = $b->compare($a); |
| 49 | - }else{ |
|
| 49 | + } else{ |
|
| 50 | 50 | throw new Less_Exception_Compiler('Unable to perform comparison', null, $this->index); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | static $error_; |
| 12 | 12 | static $value_; |
| 13 | 13 | |
| 14 | - public static function compile(){ |
|
| 14 | + public static function compile(){ |
|
| 15 | 15 | if( self::$error_ ){ |
| 16 | 16 | throw new Exception(self::$error_); |
| 17 | 17 | } |
@@ -20,15 +20,15 @@ discard block |
||
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public static function value( $v ){ |
|
| 23 | + public static function value( $v ){ |
|
| 24 | 24 | self::$value_ = $v; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public static function error( $e ){ |
|
| 27 | + public static function error( $e ){ |
|
| 28 | 28 | self::$error_ = $e; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public static function reset(){ |
|
| 31 | + public static function reset(){ |
|
| 32 | 32 | self::$value_ = self::$error_ = null; |
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | \ No newline at end of file |
@@ -6,29 +6,29 @@ |
||
| 6 | 6 | * @package Less |
| 7 | 7 | * @subpackage tree |
| 8 | 8 | */ |
| 9 | -class Less_Tree_DefaultFunc{ |
|
| 9 | +class Less_Tree_DefaultFunc { |
|
| 10 | 10 | |
| 11 | 11 | static $error_; |
| 12 | 12 | static $value_; |
| 13 | 13 | |
| 14 | - public static function compile(){ |
|
| 15 | - if( self::$error_ ){ |
|
| 14 | + public static function compile() { |
|
| 15 | + if (self::$error_) { |
|
| 16 | 16 | throw new Exception(self::$error_); |
| 17 | 17 | } |
| 18 | - if( self::$value_ !== null ){ |
|
| 18 | + if (self::$value_!==null) { |
|
| 19 | 19 | return self::$value_ ? new Less_Tree_Keyword('true') : new Less_Tree_Keyword('false'); |
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public static function value( $v ){ |
|
| 23 | + public static function value($v) { |
|
| 24 | 24 | self::$value_ = $v; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public static function error( $e ){ |
|
| 27 | + public static function error($e) { |
|
| 28 | 28 | self::$error_ = $e; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public static function reset(){ |
|
| 31 | + public static function reset() { |
|
| 32 | 32 | self::$value_ = self::$error_ = null; |
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | \ No newline at end of file |
@@ -12,16 +12,16 @@ discard block |
||
| 12 | 12 | public $frames; |
| 13 | 13 | public $type = 'DetachedRuleset'; |
| 14 | 14 | |
| 15 | - public function __construct( $ruleset, $frames = null ){ |
|
| 15 | + public function __construct( $ruleset, $frames = null ){ |
|
| 16 | 16 | $this->ruleset = $ruleset; |
| 17 | 17 | $this->frames = $frames; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - public function accept($visitor) { |
|
| 20 | + public function accept($visitor) { |
|
| 21 | 21 | $this->ruleset = $visitor->visitObj($this->ruleset); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function compile($env){ |
|
| 24 | + public function compile($env){ |
|
| 25 | 25 | if( $this->frames ){ |
| 26 | 26 | $frames = $this->frames; |
| 27 | 27 | }else{ |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | return new Less_Tree_DetachedRuleset($this->ruleset, $frames); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function callEval($env) { |
|
| 33 | + public function callEval($env) { |
|
| 34 | 34 | if( $this->frames ){ |
| 35 | 35 | return $this->ruleset->compile( $env->copyEvalEnv( array_merge($this->frames,$env->frames) ) ); |
| 36 | 36 | } |
@@ -6,13 +6,13 @@ discard block |
||
| 6 | 6 | * @package Less |
| 7 | 7 | * @subpackage tree |
| 8 | 8 | */ |
| 9 | -class Less_Tree_DetachedRuleset extends Less_Tree{ |
|
| 9 | +class Less_Tree_DetachedRuleset extends Less_Tree { |
|
| 10 | 10 | |
| 11 | 11 | public $ruleset; |
| 12 | 12 | public $frames; |
| 13 | 13 | public $type = 'DetachedRuleset'; |
| 14 | 14 | |
| 15 | - public function __construct( $ruleset, $frames = null ){ |
|
| 15 | + public function __construct($ruleset, $frames = null) { |
|
| 16 | 16 | $this->ruleset = $ruleset; |
| 17 | 17 | $this->frames = $frames; |
| 18 | 18 | } |
@@ -21,20 +21,20 @@ discard block |
||
| 21 | 21 | $this->ruleset = $visitor->visitObj($this->ruleset); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function compile($env){ |
|
| 25 | - if( $this->frames ){ |
|
| 24 | + public function compile($env) { |
|
| 25 | + if ($this->frames) { |
|
| 26 | 26 | $frames = $this->frames; |
| 27 | - }else{ |
|
| 27 | + }else { |
|
| 28 | 28 | $frames = $env->frames; |
| 29 | 29 | } |
| 30 | 30 | return new Less_Tree_DetachedRuleset($this->ruleset, $frames); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function callEval($env) { |
| 34 | - if( $this->frames ){ |
|
| 35 | - return $this->ruleset->compile( $env->copyEvalEnv( array_merge($this->frames,$env->frames) ) ); |
|
| 34 | + if ($this->frames) { |
|
| 35 | + return $this->ruleset->compile($env->copyEvalEnv(array_merge($this->frames, $env->frames))); |
|
| 36 | 36 | } |
| 37 | - return $this->ruleset->compile( $env ); |
|
| 37 | + return $this->ruleset->compile($env); |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | $this->$funcName( $node ); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - }else{ |
|
| 36 | + } else{ |
|
| 37 | 37 | $node->accept($this); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | public $unit; |
| 13 | 13 | public $type = 'Dimension'; |
| 14 | 14 | |
| 15 | - public function __construct($value, $unit = null){ |
|
| 16 | - $this->value = floatval($value); |
|
| 15 | + public function __construct($value, $unit = null){ |
|
| 16 | + $this->value = floatval($value); |
|
| 17 | 17 | |
| 18 | 18 | if( $unit && ($unit instanceof Less_Tree_Unit) ){ |
| 19 | 19 | $this->unit = $unit; |
@@ -22,23 +22,23 @@ discard block |
||
| 22 | 22 | }else{ |
| 23 | 23 | $this->unit = new Less_Tree_Unit( ); |
| 24 | 24 | } |
| 25 | - } |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - public function accept( $visitor ){ |
|
| 27 | + public function accept( $visitor ){ |
|
| 28 | 28 | $this->unit = $visitor->visitObj( $this->unit ); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function compile(){ |
|
| 32 | - return $this; |
|
| 33 | - } |
|
| 31 | + public function compile(){ |
|
| 32 | + return $this; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - public function toColor() { |
|
| 36 | - return new Less_Tree_Color(array($this->value, $this->value, $this->value)); |
|
| 37 | - } |
|
| 35 | + public function toColor() { |
|
| 36 | + return new Less_Tree_Color(array($this->value, $this->value, $this->value)); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @see Less_Tree::genCSS |
|
| 41 | - */ |
|
| 39 | + /** |
|
| 40 | + * @see Less_Tree::genCSS |
|
| 41 | + */ |
|
| 42 | 42 | public function genCSS( $output ){ |
| 43 | 43 | |
| 44 | 44 | if( Less_Parser::$options['strictUnits'] && !$this->unit->isSingular() ){ |
@@ -71,18 +71,18 @@ discard block |
||
| 71 | 71 | $this->unit->genCSS( $output ); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public function __toString(){ |
|
| 75 | - return $this->toCSS(); |
|
| 76 | - } |
|
| 74 | + public function __toString(){ |
|
| 75 | + return $this->toCSS(); |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - // In an operation between two Dimensions, |
|
| 79 | - // we default to the first Dimension's unit, |
|
| 80 | - // so `1px + 2em` will yield `3px`. |
|
| 78 | + // In an operation between two Dimensions, |
|
| 79 | + // we default to the first Dimension's unit, |
|
| 80 | + // so `1px + 2em` will yield `3px`. |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * @param string $op |
|
| 84 | - */ |
|
| 85 | - public function operate( $op, $other){ |
|
| 82 | + /** |
|
| 83 | + * @param string $op |
|
| 84 | + */ |
|
| 85 | + public function operate( $op, $other){ |
|
| 86 | 86 | |
| 87 | 87 | $value = Less_Functions::operate( $op, $this->value, $other->value); |
| 88 | 88 | $unit = clone $this->unit; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $unit->cancel(); |
| 118 | 118 | } |
| 119 | 119 | return new Less_Tree_Dimension( $value, $unit); |
| 120 | - } |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | 122 | public function compare($other) { |
| 123 | 123 | if ($other instanceof Less_Tree_Dimension) { |
@@ -147,11 +147,11 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - public function unify() { |
|
| 150 | + public function unify() { |
|
| 151 | 151 | return $this->convertTo(array('length'=> 'px', 'duration'=> 's', 'angle' => 'rad' )); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - public function convertTo($conversions) { |
|
| 154 | + public function convertTo($conversions) { |
|
| 155 | 155 | $value = $this->value; |
| 156 | 156 | $unit = clone $this->unit; |
| 157 | 157 | |
@@ -197,5 +197,5 @@ discard block |
||
| 197 | 197 | $unit->cancel(); |
| 198 | 198 | |
| 199 | 199 | return new Less_Tree_Dimension( $value, $unit); |
| 200 | - } |
|
| 200 | + } |
|
| 201 | 201 | } |
@@ -6,29 +6,29 @@ discard block |
||
| 6 | 6 | * @package Less |
| 7 | 7 | * @subpackage tree |
| 8 | 8 | */ |
| 9 | -class Less_Tree_Dimension extends Less_Tree{ |
|
| 9 | +class Less_Tree_Dimension extends Less_Tree { |
|
| 10 | 10 | |
| 11 | 11 | public $value; |
| 12 | 12 | public $unit; |
| 13 | 13 | public $type = 'Dimension'; |
| 14 | 14 | |
| 15 | - public function __construct($value, $unit = null){ |
|
| 15 | + public function __construct($value, $unit = null) { |
|
| 16 | 16 | $this->value = floatval($value); |
| 17 | 17 | |
| 18 | - if( $unit && ($unit instanceof Less_Tree_Unit) ){ |
|
| 18 | + if ($unit && ($unit instanceof Less_Tree_Unit)) { |
|
| 19 | 19 | $this->unit = $unit; |
| 20 | - }elseif( $unit ){ |
|
| 21 | - $this->unit = new Less_Tree_Unit( array($unit) ); |
|
| 22 | - }else{ |
|
| 20 | + }elseif ($unit) { |
|
| 21 | + $this->unit = new Less_Tree_Unit(array($unit)); |
|
| 22 | + }else { |
|
| 23 | 23 | $this->unit = new Less_Tree_Unit( ); |
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function accept( $visitor ){ |
|
| 28 | - $this->unit = $visitor->visitObj( $this->unit ); |
|
| 27 | + public function accept($visitor) { |
|
| 28 | + $this->unit = $visitor->visitObj($this->unit); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function compile(){ |
|
| 31 | + public function compile() { |
|
| 32 | 32 | return $this; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -39,39 +39,39 @@ discard block |
||
| 39 | 39 | /** |
| 40 | 40 | * @see Less_Tree::genCSS |
| 41 | 41 | */ |
| 42 | - public function genCSS( $output ){ |
|
| 42 | + public function genCSS($output) { |
|
| 43 | 43 | |
| 44 | - if( Less_Parser::$options['strictUnits'] && !$this->unit->isSingular() ){ |
|
| 44 | + if (Less_Parser::$options['strictUnits'] && !$this->unit->isSingular()) { |
|
| 45 | 45 | throw new Less_Exception_Compiler("Multiple units in dimension. Correct the units or use the unit function. Bad unit: ".$this->unit->toString()); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - $value = Less_Functions::fround( $this->value ); |
|
| 48 | + $value = Less_Functions::fround($this->value); |
|
| 49 | 49 | $strValue = (string)$value; |
| 50 | 50 | |
| 51 | - if( $value !== 0 && $value < 0.000001 && $value > -0.000001 ){ |
|
| 51 | + if ($value!==0 && $value<0.000001 && $value>-0.000001) { |
|
| 52 | 52 | // would be output 1e-6 etc. |
| 53 | - $strValue = number_format($strValue,10); |
|
| 54 | - $strValue = preg_replace('/\.?0+$/','', $strValue); |
|
| 53 | + $strValue = number_format($strValue, 10); |
|
| 54 | + $strValue = preg_replace('/\.?0+$/', '', $strValue); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - if( Less_Parser::$options['compress'] ){ |
|
| 57 | + if (Less_Parser::$options['compress']) { |
|
| 58 | 58 | // Zero values doesn't need a unit |
| 59 | - if( $value === 0 && $this->unit->isLength() ){ |
|
| 60 | - $output->add( $strValue ); |
|
| 59 | + if ($value===0 && $this->unit->isLength()) { |
|
| 60 | + $output->add($strValue); |
|
| 61 | 61 | return $strValue; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // Float values doesn't need a leading zero |
| 65 | - if( $value > 0 && $value < 1 && $strValue[0] === '0' ){ |
|
| 66 | - $strValue = substr($strValue,1); |
|
| 65 | + if ($value>0 && $value<1 && $strValue[0]==='0') { |
|
| 66 | + $strValue = substr($strValue, 1); |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - $output->add( $strValue ); |
|
| 71 | - $this->unit->genCSS( $output ); |
|
| 70 | + $output->add($strValue); |
|
| 71 | + $this->unit->genCSS($output); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public function __toString(){ |
|
| 74 | + public function __toString() { |
|
| 75 | 75 | return $this->toCSS(); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -82,97 +82,97 @@ discard block |
||
| 82 | 82 | /** |
| 83 | 83 | * @param string $op |
| 84 | 84 | */ |
| 85 | - public function operate( $op, $other){ |
|
| 85 | + public function operate($op, $other) { |
|
| 86 | 86 | |
| 87 | - $value = Less_Functions::operate( $op, $this->value, $other->value); |
|
| 87 | + $value = Less_Functions::operate($op, $this->value, $other->value); |
|
| 88 | 88 | $unit = clone $this->unit; |
| 89 | 89 | |
| 90 | - if( $op === '+' || $op === '-' ){ |
|
| 90 | + if ($op==='+' || $op==='-') { |
|
| 91 | 91 | |
| 92 | - if( !$unit->numerator && !$unit->denominator ){ |
|
| 92 | + if (!$unit->numerator && !$unit->denominator) { |
|
| 93 | 93 | $unit->numerator = $other->unit->numerator; |
| 94 | 94 | $unit->denominator = $other->unit->denominator; |
| 95 | - }elseif( !$other->unit->numerator && !$other->unit->denominator ){ |
|
| 95 | + }elseif (!$other->unit->numerator && !$other->unit->denominator) { |
|
| 96 | 96 | // do nothing |
| 97 | - }else{ |
|
| 98 | - $other = $other->convertTo( $this->unit->usedUnits()); |
|
| 97 | + }else { |
|
| 98 | + $other = $other->convertTo($this->unit->usedUnits()); |
|
| 99 | 99 | |
| 100 | - if( Less_Parser::$options['strictUnits'] && $other->unit->toString() !== $unit->toCSS() ){ |
|
| 101 | - throw new Less_Exception_Compiler("Incompatible units. Change the units or use the unit function. Bad units: '".$unit->toString() . "' and ".$other->unit->toString()+"'."); |
|
| 100 | + if (Less_Parser::$options['strictUnits'] && $other->unit->toString()!==$unit->toCSS()) { |
|
| 101 | + throw new Less_Exception_Compiler("Incompatible units. Change the units or use the unit function. Bad units: '".$unit->toString()."' and ".$other->unit->toString()+"'."); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - $value = Less_Functions::operate( $op, $this->value, $other->value); |
|
| 104 | + $value = Less_Functions::operate($op, $this->value, $other->value); |
|
| 105 | 105 | } |
| 106 | - }elseif( $op === '*' ){ |
|
| 106 | + }elseif ($op==='*') { |
|
| 107 | 107 | $unit->numerator = array_merge($unit->numerator, $other->unit->numerator); |
| 108 | 108 | $unit->denominator = array_merge($unit->denominator, $other->unit->denominator); |
| 109 | 109 | sort($unit->numerator); |
| 110 | 110 | sort($unit->denominator); |
| 111 | 111 | $unit->cancel(); |
| 112 | - }elseif( $op === '/' ){ |
|
| 112 | + }elseif ($op==='/') { |
|
| 113 | 113 | $unit->numerator = array_merge($unit->numerator, $other->unit->denominator); |
| 114 | 114 | $unit->denominator = array_merge($unit->denominator, $other->unit->numerator); |
| 115 | 115 | sort($unit->numerator); |
| 116 | 116 | sort($unit->denominator); |
| 117 | 117 | $unit->cancel(); |
| 118 | 118 | } |
| 119 | - return new Less_Tree_Dimension( $value, $unit); |
|
| 119 | + return new Less_Tree_Dimension($value, $unit); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | public function compare($other) { |
| 123 | 123 | if ($other instanceof Less_Tree_Dimension) { |
| 124 | 124 | |
| 125 | - if( $this->unit->isEmpty() || $other->unit->isEmpty() ){ |
|
| 125 | + if ($this->unit->isEmpty() || $other->unit->isEmpty()) { |
|
| 126 | 126 | $a = $this; |
| 127 | 127 | $b = $other; |
| 128 | - } else { |
|
| 128 | + }else { |
|
| 129 | 129 | $a = $this->unify(); |
| 130 | 130 | $b = $other->unify(); |
| 131 | - if( $a->unit->compare($b->unit) !== 0 ){ |
|
| 131 | + if ($a->unit->compare($b->unit)!==0) { |
|
| 132 | 132 | return -1; |
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | $aValue = $a->value; |
| 136 | 136 | $bValue = $b->value; |
| 137 | 137 | |
| 138 | - if ($bValue > $aValue) { |
|
| 138 | + if ($bValue>$aValue) { |
|
| 139 | 139 | return -1; |
| 140 | - } elseif ($bValue < $aValue) { |
|
| 140 | + } elseif ($bValue<$aValue) { |
|
| 141 | 141 | return 1; |
| 142 | - } else { |
|
| 142 | + }else { |
|
| 143 | 143 | return 0; |
| 144 | 144 | } |
| 145 | - } else { |
|
| 145 | + }else { |
|
| 146 | 146 | return -1; |
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | public function unify() { |
| 151 | - return $this->convertTo(array('length'=> 'px', 'duration'=> 's', 'angle' => 'rad' )); |
|
| 151 | + return $this->convertTo(array('length'=> 'px', 'duration'=> 's', 'angle' => 'rad')); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | public function convertTo($conversions) { |
| 155 | 155 | $value = $this->value; |
| 156 | 156 | $unit = clone $this->unit; |
| 157 | 157 | |
| 158 | - if( is_string($conversions) ){ |
|
| 158 | + if (is_string($conversions)) { |
|
| 159 | 159 | $derivedConversions = array(); |
| 160 | - foreach( Less_Tree_UnitConversions::$groups as $i ){ |
|
| 161 | - if( isset(Less_Tree_UnitConversions::${$i}[$conversions]) ){ |
|
| 162 | - $derivedConversions = array( $i => $conversions); |
|
| 160 | + foreach (Less_Tree_UnitConversions::$groups as $i) { |
|
| 161 | + if (isset(Less_Tree_UnitConversions::${$i}[$conversions])) { |
|
| 162 | + $derivedConversions = array($i => $conversions); |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | $conversions = $derivedConversions; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
| 169 | - foreach($conversions as $groupName => $targetUnit){ |
|
| 169 | + foreach ($conversions as $groupName => $targetUnit) { |
|
| 170 | 170 | $group = Less_Tree_UnitConversions::${$groupName}; |
| 171 | 171 | |
| 172 | 172 | //numerator |
| 173 | - foreach($unit->numerator as $i => $atomicUnit){ |
|
| 173 | + foreach ($unit->numerator as $i => $atomicUnit) { |
|
| 174 | 174 | $atomicUnit = $unit->numerator[$i]; |
| 175 | - if( !isset($group[$atomicUnit]) ){ |
|
| 175 | + if (!isset($group[$atomicUnit])) { |
|
| 176 | 176 | continue; |
| 177 | 177 | } |
| 178 | 178 | |
@@ -182,9 +182,9 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | //denominator |
| 185 | - foreach($unit->denominator as $i => $atomicUnit){ |
|
| 185 | + foreach ($unit->denominator as $i => $atomicUnit) { |
|
| 186 | 186 | $atomicUnit = $unit->denominator[$i]; |
| 187 | - if( !isset($group[$atomicUnit]) ){ |
|
| 187 | + if (!isset($group[$atomicUnit])) { |
|
| 188 | 188 | continue; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -196,6 +196,6 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | $unit->cancel(); |
| 198 | 198 | |
| 199 | - return new Less_Tree_Dimension( $value, $unit); |
|
| 199 | + return new Less_Tree_Dimension($value, $unit); |
|
| 200 | 200 | } |
| 201 | 201 | } |
@@ -17,9 +17,9 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | if( $unit && ($unit instanceof Less_Tree_Unit) ){ |
| 19 | 19 | $this->unit = $unit; |
| 20 | - }elseif( $unit ){ |
|
| 20 | + } elseif( $unit ){ |
|
| 21 | 21 | $this->unit = new Less_Tree_Unit( array($unit) ); |
| 22 | - }else{ |
|
| 22 | + } else{ |
|
| 23 | 23 | $this->unit = new Less_Tree_Unit( ); |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | if( !$unit->numerator && !$unit->denominator ){ |
| 93 | 93 | $unit->numerator = $other->unit->numerator; |
| 94 | 94 | $unit->denominator = $other->unit->denominator; |
| 95 | - }elseif( !$other->unit->numerator && !$other->unit->denominator ){ |
|
| 95 | + } elseif( !$other->unit->numerator && !$other->unit->denominator ){ |
|
| 96 | 96 | // do nothing |
| 97 | - }else{ |
|
| 97 | + } else{ |
|
| 98 | 98 | $other = $other->convertTo( $this->unit->usedUnits()); |
| 99 | 99 | |
| 100 | 100 | if( Less_Parser::$options['strictUnits'] && $other->unit->toString() !== $unit->toCSS() ){ |
@@ -103,13 +103,13 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | $value = Less_Functions::operate( $op, $this->value, $other->value); |
| 105 | 105 | } |
| 106 | - }elseif( $op === '*' ){ |
|
| 106 | + } elseif( $op === '*' ){ |
|
| 107 | 107 | $unit->numerator = array_merge($unit->numerator, $other->unit->numerator); |
| 108 | 108 | $unit->denominator = array_merge($unit->denominator, $other->unit->denominator); |
| 109 | 109 | sort($unit->numerator); |
| 110 | 110 | sort($unit->denominator); |
| 111 | 111 | $unit->cancel(); |
| 112 | - }elseif( $op === '/' ){ |
|
| 112 | + } elseif( $op === '/' ){ |
|
| 113 | 113 | $unit->numerator = array_merge($unit->numerator, $other->unit->denominator); |
| 114 | 114 | $unit->denominator = array_merge($unit->denominator, $other->unit->numerator); |
| 115 | 115 | sort($unit->numerator); |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @package Less |
| 7 | 7 | * @subpackage tree |
| 8 | 8 | */ |
| 9 | -class Less_Tree_Directive extends Less_Tree{ |
|
| 9 | +class Less_Tree_Directive extends Less_Tree { |
|
| 10 | 10 | |
| 11 | 11 | public $name; |
| 12 | 12 | public $value; |
@@ -17,10 +17,10 @@ discard block |
||
| 17 | 17 | public $debugInfo; |
| 18 | 18 | public $type = 'Directive'; |
| 19 | 19 | |
| 20 | - public function __construct($name, $value = null, $rules, $index = null, $currentFileInfo = null, $debugInfo = null ){ |
|
| 20 | + public function __construct($name, $value = null, $rules, $index = null, $currentFileInfo = null, $debugInfo = null) { |
|
| 21 | 21 | $this->name = $name; |
| 22 | 22 | $this->value = $value; |
| 23 | - if( $rules ){ |
|
| 23 | + if ($rules) { |
|
| 24 | 24 | $this->rules = $rules; |
| 25 | 25 | $this->rules->allowImports = true; |
| 26 | 26 | } |
@@ -31,12 +31,12 @@ discard block |
||
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 34 | - public function accept( $visitor ){ |
|
| 35 | - if( $this->rules ){ |
|
| 36 | - $this->rules = $visitor->visitObj( $this->rules ); |
|
| 34 | + public function accept($visitor) { |
|
| 35 | + if ($this->rules) { |
|
| 36 | + $this->rules = $visitor->visitObj($this->rules); |
|
| 37 | 37 | } |
| 38 | - if( $this->value ){ |
|
| 39 | - $this->value = $visitor->visitObj( $this->value ); |
|
| 38 | + if ($this->value) { |
|
| 39 | + $this->value = $visitor->visitObj($this->value); |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
@@ -44,55 +44,55 @@ discard block |
||
| 44 | 44 | /** |
| 45 | 45 | * @see Less_Tree::genCSS |
| 46 | 46 | */ |
| 47 | - public function genCSS( $output ){ |
|
| 47 | + public function genCSS($output) { |
|
| 48 | 48 | $value = $this->value; |
| 49 | 49 | $rules = $this->rules; |
| 50 | - $output->add( $this->name, $this->currentFileInfo, $this->index ); |
|
| 51 | - if( $this->value ){ |
|
| 50 | + $output->add($this->name, $this->currentFileInfo, $this->index); |
|
| 51 | + if ($this->value) { |
|
| 52 | 52 | $output->add(' '); |
| 53 | 53 | $this->value->genCSS($output); |
| 54 | 54 | } |
| 55 | - if( $this->rules ){ |
|
| 56 | - Less_Tree::outputRuleset( $output, array($this->rules)); |
|
| 57 | - } else { |
|
| 55 | + if ($this->rules) { |
|
| 56 | + Less_Tree::outputRuleset($output, array($this->rules)); |
|
| 57 | + }else { |
|
| 58 | 58 | $output->add(';'); |
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public function compile($env){ |
|
| 62 | + public function compile($env) { |
|
| 63 | 63 | |
| 64 | 64 | $value = $this->value; |
| 65 | 65 | $rules = $this->rules; |
| 66 | - if( $value ){ |
|
| 66 | + if ($value) { |
|
| 67 | 67 | $value = $value->compile($env); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if( $rules ){ |
|
| 70 | + if ($rules) { |
|
| 71 | 71 | $rules = $rules->compile($env); |
| 72 | 72 | $rules->root = true; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - return new Less_Tree_Directive( $this->name, $value, $rules, $this->index, $this->currentFileInfo, $this->debugInfo ); |
|
| 75 | + return new Less_Tree_Directive($this->name, $value, $rules, $this->index, $this->currentFileInfo, $this->debugInfo); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | |
| 79 | - public function variable($name){ |
|
| 80 | - if( $this->rules ){ |
|
| 79 | + public function variable($name) { |
|
| 80 | + if ($this->rules) { |
|
| 81 | 81 | return $this->rules->variable($name); |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - public function find($selector){ |
|
| 86 | - if( $this->rules ){ |
|
| 85 | + public function find($selector) { |
|
| 86 | + if ($this->rules) { |
|
| 87 | 87 | return $this->rules->find($selector, $this); |
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | //rulesets: function () { if (this.rules) return tree.Ruleset.prototype.rulesets.apply(this.rules); }, |
| 92 | 92 | |
| 93 | - public function markReferenced(){ |
|
| 93 | + public function markReferenced() { |
|
| 94 | 94 | $this->isReferenced = true; |
| 95 | - if( $this->rules ){ |
|
| 95 | + if ($this->rules) { |
|
| 96 | 96 | Less_Tree::ReferencedArray($this->rules->rules); |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -20,14 +20,14 @@ |
||
| 20 | 20 | $this->isEvald = $isEvald; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function accept( $visitor ){ |
|
| 23 | + public function accept( $visitor ){ |
|
| 24 | 24 | $this->value = $visitor->visitObj($this->value); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @see Less_Tree::genCSS |
|
| 29 | - */ |
|
| 30 | - public function genCSS( $output ){ |
|
| 27 | + /** |
|
| 28 | + * @see Less_Tree::genCSS |
|
| 29 | + */ |
|
| 30 | + public function genCSS( $output ){ |
|
| 31 | 31 | $output->add( 'url(' ); |
| 32 | 32 | $this->value->genCSS( $output ); |
| 33 | 33 | $output->add( ')' ); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $this->currentFileInfo = $currentFileInfo; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function accept( $visitor ){ |
|
| 32 | + public function accept( $visitor ){ |
|
| 33 | 33 | if( $this->value_is_object ){ //object or string |
| 34 | 34 | $this->value = $visitor->visitObj( $this->value ); |
| 35 | 35 | } |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | return $this; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @see Less_Tree::genCSS |
|
| 53 | - */ |
|
| 51 | + /** |
|
| 52 | + * @see Less_Tree::genCSS |
|
| 53 | + */ |
|
| 54 | 54 | public function genCSS( $output ){ |
| 55 | 55 | $output->add( $this->toCSS(), $this->currentFileInfo, $this->index ); |
| 56 | 56 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @package Less |
| 7 | 7 | * @subpackage tree |
| 8 | 8 | */ |
| 9 | -class Less_Tree_Element extends Less_Tree{ |
|
| 9 | +class Less_Tree_Element extends Less_Tree { |
|
| 10 | 10 | |
| 11 | 11 | public $combinator = ''; |
| 12 | 12 | public $value = ''; |
@@ -16,12 +16,12 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | public $value_is_object = false; |
| 18 | 18 | |
| 19 | - public function __construct($combinator, $value, $index = null, $currentFileInfo = null ){ |
|
| 19 | + public function __construct($combinator, $value, $index = null, $currentFileInfo = null) { |
|
| 20 | 20 | |
| 21 | 21 | $this->value = $value; |
| 22 | 22 | $this->value_is_object = is_object($value); |
| 23 | 23 | |
| 24 | - if( $combinator ){ |
|
| 24 | + if ($combinator) { |
|
| 25 | 25 | $this->combinator = $combinator; |
| 26 | 26 | } |
| 27 | 27 | |
@@ -29,19 +29,19 @@ discard block |
||
| 29 | 29 | $this->currentFileInfo = $currentFileInfo; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function accept( $visitor ){ |
|
| 33 | - if( $this->value_is_object ){ //object or string |
|
| 34 | - $this->value = $visitor->visitObj( $this->value ); |
|
| 32 | + public function accept($visitor) { |
|
| 33 | + if ($this->value_is_object) { //object or string |
|
| 34 | + $this->value = $visitor->visitObj($this->value); |
|
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function compile($env){ |
|
| 38 | + public function compile($env) { |
|
| 39 | 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 ); |
|
| 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 | 42 | } |
| 43 | 43 | |
| 44 | - if( $this->value_is_object ){ |
|
| 44 | + if ($this->value_is_object) { |
|
| 45 | 45 | $this->value = $this->value->compile($env); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -51,25 +51,25 @@ discard block |
||
| 51 | 51 | /** |
| 52 | 52 | * @see Less_Tree::genCSS |
| 53 | 53 | */ |
| 54 | - public function genCSS( $output ){ |
|
| 55 | - $output->add( $this->toCSS(), $this->currentFileInfo, $this->index ); |
|
| 54 | + public function genCSS($output) { |
|
| 55 | + $output->add($this->toCSS(), $this->currentFileInfo, $this->index); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - public function toCSS(){ |
|
| 58 | + public function toCSS() { |
|
| 59 | 59 | |
| 60 | - if( $this->value_is_object ){ |
|
| 60 | + if ($this->value_is_object) { |
|
| 61 | 61 | $value = $this->value->toCSS(); |
| 62 | - }else{ |
|
| 62 | + }else { |
|
| 63 | 63 | $value = $this->value; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
| 67 | - if( $value === '' && $this->combinator && $this->combinator === '&' ){ |
|
| 67 | + if ($value==='' && $this->combinator && $this->combinator==='&') { |
|
| 68 | 68 | return ''; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
| 72 | - return Less_Environment::$_outputMap[$this->combinator] . $value; |
|
| 72 | + return Less_Environment::$_outputMap[$this->combinator].$value; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | $this->$funcName( $node ); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - }else{ |
|
| 36 | + } else{ |
|
| 37 | 37 | $node->accept($this); |
| 38 | 38 | } |
| 39 | 39 | |