@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * @param integer $index |
27 | 27 | */ |
28 | - public function __construct($selector, $option, $index){ |
|
28 | + public function __construct($selector, $option, $index){ |
|
29 | 29 | static $i = 0; |
30 | 30 | $this->selector = $selector; |
31 | 31 | $this->option = $option; |
@@ -46,18 +46,18 @@ discard block |
||
46 | 46 | $this->parent_ids = array($this->object_id); |
47 | 47 | } |
48 | 48 | |
49 | - public function accept( $visitor ){ |
|
49 | + public function accept( $visitor ){ |
|
50 | 50 | $this->selector = $visitor->visitObj( $this->selector ); |
51 | 51 | } |
52 | 52 | |
53 | - public function compile( $env ){ |
|
53 | + public function compile( $env ){ |
|
54 | 54 | Less_Parser::$has_extends = true; |
55 | 55 | $this->selector = $this->selector->compile($env); |
56 | 56 | return $this; |
57 | 57 | //return new Less_Tree_Extend( $this->selector->compile($env), $this->option, $this->index); |
58 | 58 | } |
59 | 59 | |
60 | - public function findSelfSelectors( $selectors ){ |
|
60 | + public function findSelfSelectors( $selectors ){ |
|
61 | 61 | $selfElements = array(); |
62 | 62 | |
63 | 63 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Less |
7 | 7 | * @subpackage tree |
8 | 8 | */ |
9 | -class Less_Tree_Extend extends Less_Tree{ |
|
9 | +class Less_Tree_Extend extends Less_Tree { |
|
10 | 10 | |
11 | 11 | public $selector; |
12 | 12 | public $option; |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * @param integer $index |
27 | 27 | */ |
28 | - public function __construct($selector, $option, $index){ |
|
28 | + public function __construct($selector, $option, $index) { |
|
29 | 29 | static $i = 0; |
30 | 30 | $this->selector = $selector; |
31 | 31 | $this->option = $option; |
32 | 32 | $this->index = $index; |
33 | 33 | |
34 | - switch($option){ |
|
34 | + switch ($option) { |
|
35 | 35 | case "all": |
36 | 36 | $this->allowBefore = true; |
37 | 37 | $this->allowAfter = true; |
@@ -46,29 +46,29 @@ discard block |
||
46 | 46 | $this->parent_ids = array($this->object_id); |
47 | 47 | } |
48 | 48 | |
49 | - public function accept( $visitor ){ |
|
50 | - $this->selector = $visitor->visitObj( $this->selector ); |
|
49 | + public function accept($visitor) { |
|
50 | + $this->selector = $visitor->visitObj($this->selector); |
|
51 | 51 | } |
52 | 52 | |
53 | - public function compile( $env ){ |
|
53 | + public function compile($env) { |
|
54 | 54 | Less_Parser::$has_extends = true; |
55 | 55 | $this->selector = $this->selector->compile($env); |
56 | 56 | return $this; |
57 | 57 | //return new Less_Tree_Extend( $this->selector->compile($env), $this->option, $this->index); |
58 | 58 | } |
59 | 59 | |
60 | - public function findSelfSelectors( $selectors ){ |
|
60 | + public function findSelfSelectors($selectors) { |
|
61 | 61 | $selfElements = array(); |
62 | 62 | |
63 | 63 | |
64 | - for( $i = 0, $selectors_len = count($selectors); $i < $selectors_len; $i++ ){ |
|
64 | + for ($i = 0, $selectors_len = count($selectors); $i<$selectors_len; $i++) { |
|
65 | 65 | $selectorElements = $selectors[$i]->elements; |
66 | 66 | // duplicate the logic in genCSS function inside the selector node. |
67 | 67 | // future TODO - move both logics into the selector joiner visitor |
68 | - if( $i && $selectorElements && $selectorElements[0]->combinator === "") { |
|
68 | + if ($i && $selectorElements && $selectorElements[0]->combinator==="") { |
|
69 | 69 | $selectorElements[0]->combinator = ' '; |
70 | 70 | } |
71 | - $selfElements = array_merge( $selfElements, $selectors[$i]->elements ); |
|
71 | + $selfElements = array_merge($selfElements, $selectors[$i]->elements); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | $this->selfSelectors = array(new Less_Tree_Selector($selfElements)); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Less |
7 | 7 | * @subpackage tree |
8 | 8 | */ |
9 | -class Less_Tree_Javascript extends Less_Tree{ |
|
9 | +class Less_Tree_Javascript extends Less_Tree { |
|
10 | 10 | |
11 | 11 | public $type = 'Javascript'; |
12 | 12 | public $escaped; |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | * @param boolean $index |
18 | 18 | * @param boolean $escaped |
19 | 19 | */ |
20 | - public function __construct($string, $index, $escaped){ |
|
20 | + public function __construct($string, $index, $escaped) { |
|
21 | 21 | $this->escaped = $escaped; |
22 | 22 | $this->expression = $string; |
23 | 23 | $this->index = $index; |
24 | 24 | } |
25 | 25 | |
26 | - public function compile(){ |
|
26 | + public function compile() { |
|
27 | 27 | return new Less_Tree_Anonymous('/* Sorry, can not do JavaScript evaluation in PHP... :( */'); |
28 | 28 | } |
29 | 29 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Less |
7 | 7 | * @subpackage tree |
8 | 8 | */ |
9 | -class Less_Tree_Keyword extends Less_Tree{ |
|
9 | +class Less_Tree_Keyword extends Less_Tree { |
|
10 | 10 | |
11 | 11 | public $value; |
12 | 12 | public $type = 'Keyword'; |
@@ -14,30 +14,30 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * @param string $value |
16 | 16 | */ |
17 | - public function __construct($value){ |
|
17 | + public function __construct($value) { |
|
18 | 18 | $this->value = $value; |
19 | 19 | } |
20 | 20 | |
21 | - public function compile(){ |
|
21 | + public function compile() { |
|
22 | 22 | return $this; |
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @see Less_Tree::genCSS |
27 | 27 | */ |
28 | - public function genCSS( $output ){ |
|
28 | + public function genCSS($output) { |
|
29 | 29 | |
30 | - if( $this->value === '%') { |
|
30 | + if ($this->value==='%') { |
|
31 | 31 | throw new Less_Exception_Compiler("Invalid % without number"); |
32 | 32 | } |
33 | 33 | |
34 | - $output->add( $this->value ); |
|
34 | + $output->add($this->value); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | public function compare($other) { |
38 | 38 | if ($other instanceof Less_Tree_Keyword) { |
39 | - return $other->value === $this->value ? 0 : 1; |
|
40 | - } else { |
|
39 | + return $other->value===$this->value ? 0 : 1; |
|
40 | + }else { |
|
41 | 41 | return -1; |
42 | 42 | } |
43 | 43 | } |
@@ -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,15 +28,15 @@ discard block |
||
28 | 28 | $this->rules[0]->allowImports = true; |
29 | 29 | } |
30 | 30 | |
31 | - public function accept( $visitor ){ |
|
31 | + public function accept( $visitor ){ |
|
32 | 32 | $this->features = $visitor->visitObj($this->features); |
33 | 33 | $this->rules = $visitor->visitArray($this->rules); |
34 | 34 | } |
35 | 35 | |
36 | - /** |
|
37 | - * @see Less_Tree::genCSS |
|
38 | - */ |
|
39 | - public function genCSS( $output ){ |
|
36 | + /** |
|
37 | + * @see Less_Tree::genCSS |
|
38 | + */ |
|
39 | + public function genCSS( $output ){ |
|
40 | 40 | |
41 | 41 | $output->add( '@media ', $this->currentFileInfo, $this->index ); |
42 | 42 | $this->features->genCSS( $output ); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $el = new Less_Tree_Element('','&', $this->index, $this->currentFileInfo ); |
85 | 85 | $sels = array( new Less_Tree_Selector(array($el), array(), null, $this->index, $this->currentFileInfo) ); |
86 | 86 | $sels[0]->mediaEmpty = true; |
87 | - return $sels; |
|
87 | + return $sels; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | public function markReferenced(){ |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | return $result; |
170 | 170 | } |
171 | 171 | |
172 | - public function bubbleSelectors($selectors) { |
|
172 | + public function bubbleSelectors($selectors) { |
|
173 | 173 | |
174 | 174 | if( !$selectors) return; |
175 | 175 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Less |
7 | 7 | * @subpackage tree |
8 | 8 | */ |
9 | -class Less_Tree_Media extends Less_Tree{ |
|
9 | +class Less_Tree_Media extends Less_Tree { |
|
10 | 10 | |
11 | 11 | public $features; |
12 | 12 | public $rules; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | public $isReferenced; |
16 | 16 | public $type = 'Media'; |
17 | 17 | |
18 | - public function __construct($value = array(), $features = array(), $index = null, $currentFileInfo = null ){ |
|
18 | + public function __construct($value = array(), $features = array(), $index = null, $currentFileInfo = null) { |
|
19 | 19 | |
20 | 20 | $this->index = $index; |
21 | 21 | $this->currentFileInfo = $currentFileInfo; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $this->rules[0]->allowImports = true; |
29 | 29 | } |
30 | 30 | |
31 | - public function accept( $visitor ){ |
|
31 | + public function accept($visitor) { |
|
32 | 32 | $this->features = $visitor->visitObj($this->features); |
33 | 33 | $this->rules = $visitor->visitArray($this->rules); |
34 | 34 | } |
@@ -36,27 +36,27 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * @see Less_Tree::genCSS |
38 | 38 | */ |
39 | - public function genCSS( $output ){ |
|
39 | + public function genCSS($output) { |
|
40 | 40 | |
41 | - $output->add( '@media ', $this->currentFileInfo, $this->index ); |
|
42 | - $this->features->genCSS( $output ); |
|
43 | - Less_Tree::outputRuleset( $output, $this->rules); |
|
41 | + $output->add('@media ', $this->currentFileInfo, $this->index); |
|
42 | + $this->features->genCSS($output); |
|
43 | + Less_Tree::outputRuleset($output, $this->rules); |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | |
47 | 47 | public function compile($env) { |
48 | 48 | |
49 | - $media = new Less_Tree_Media(array(), array(), $this->index, $this->currentFileInfo ); |
|
49 | + $media = new Less_Tree_Media(array(), array(), $this->index, $this->currentFileInfo); |
|
50 | 50 | |
51 | 51 | $strictMathBypass = false; |
52 | - if( Less_Parser::$options['strictMath'] === false) { |
|
52 | + if (Less_Parser::$options['strictMath']===false) { |
|
53 | 53 | $strictMathBypass = true; |
54 | 54 | Less_Parser::$options['strictMath'] = true; |
55 | 55 | } |
56 | 56 | |
57 | 57 | $media->features = $this->features->compile($env); |
58 | 58 | |
59 | - if( $strictMathBypass ){ |
|
59 | + if ($strictMathBypass) { |
|
60 | 60 | Less_Parser::$options['strictMath'] = false; |
61 | 61 | } |
62 | 62 | |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | return $this->rules[0]->find($selector, $this); |
81 | 81 | } |
82 | 82 | |
83 | - public function emptySelectors(){ |
|
84 | - $el = new Less_Tree_Element('','&', $this->index, $this->currentFileInfo ); |
|
85 | - $sels = array( new Less_Tree_Selector(array($el), array(), null, $this->index, $this->currentFileInfo) ); |
|
83 | + public function emptySelectors() { |
|
84 | + $el = new Less_Tree_Element('', '&', $this->index, $this->currentFileInfo); |
|
85 | + $sels = array(new Less_Tree_Selector(array($el), array(), null, $this->index, $this->currentFileInfo)); |
|
86 | 86 | $sels[0]->mediaEmpty = true; |
87 | 87 | return $sels; |
88 | 88 | } |
89 | 89 | |
90 | - public function markReferenced(){ |
|
90 | + public function markReferenced() { |
|
91 | 91 | $this->rules[0]->markReferenced(); |
92 | 92 | $this->isReferenced = true; |
93 | 93 | Less_Tree::ReferencedArray($this->rules[0]->rules); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | public function compileTop($env) { |
98 | 98 | $result = $this; |
99 | 99 | |
100 | - if (count($env->mediaBlocks) > 1) { |
|
100 | + if (count($env->mediaBlocks)>1) { |
|
101 | 101 | $selectors = $this->emptySelectors(); |
102 | 102 | $result = new Less_Tree_Ruleset($selectors, $env->mediaBlocks); |
103 | 103 | $result->multiMedia = true; |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | |
129 | 129 | $permuted = $this->permute($path); |
130 | 130 | $expressions = array(); |
131 | - foreach($permuted as $path){ |
|
131 | + foreach ($permuted as $path) { |
|
132 | 132 | |
133 | - for( $i=0, $len=count($path); $i < $len; $i++){ |
|
133 | + for ($i = 0, $len = count($path); $i<$len; $i++) { |
|
134 | 134 | $path[$i] = Less_Parser::is_method($path[$i], 'toCSS') ? $path[$i] : new Less_Tree_Anonymous($path[$i]); |
135 | 135 | } |
136 | 136 | |
137 | - for( $i = count($path) - 1; $i > 0; $i-- ){ |
|
137 | + for ($i = count($path)-1; $i>0; $i--) { |
|
138 | 138 | array_splice($path, $i, 0, array(new Less_Tree_Anonymous('and'))); |
139 | 139 | } |
140 | 140 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | if (!$arr) |
153 | 153 | return array(); |
154 | 154 | |
155 | - if (count($arr) == 1) |
|
155 | + if (count($arr)==1) |
|
156 | 156 | return $arr[0]; |
157 | 157 | |
158 | 158 | $result = array(); |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | |
172 | 172 | public function bubbleSelectors($selectors) { |
173 | 173 | |
174 | - if( !$selectors) return; |
|
174 | + if (!$selectors) return; |
|
175 | 175 | |
176 | - $this->rules = array(new Less_Tree_Ruleset( $selectors, array($this->rules[0]))); |
|
176 | + $this->rules = array(new Less_Tree_Ruleset($selectors, array($this->rules[0]))); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | } |
@@ -149,11 +149,13 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | public function permute($arr) { |
152 | - if (!$arr) |
|
153 | - return array(); |
|
152 | + if (!$arr) { |
|
153 | + return array(); |
|
154 | + } |
|
154 | 155 | |
155 | - if (count($arr) == 1) |
|
156 | - return $arr[0]; |
|
156 | + if (count($arr) == 1) { |
|
157 | + return $arr[0]; |
|
158 | + } |
|
157 | 159 | |
158 | 160 | $result = array(); |
159 | 161 | $rest = $this->permute(array_slice($arr, 1)); |
@@ -171,7 +173,9 @@ discard block |
||
171 | 173 | |
172 | 174 | public function bubbleSelectors($selectors) { |
173 | 175 | |
174 | - if( !$selectors) return; |
|
176 | + if( !$selectors) { |
|
177 | + return; |
|
178 | + } |
|
175 | 179 | |
176 | 180 | $this->rules = array(new Less_Tree_Ruleset( $selectors, array($this->rules[0]))); |
177 | 181 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -class Less_Tree_Mixin_Call extends Less_Tree{ |
|
4 | +class Less_Tree_Mixin_Call extends Less_Tree { |
|
5 | 5 | |
6 | 6 | public $selector; |
7 | 7 | public $arguments; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * less.js: tree.mixin.Call |
16 | 16 | * |
17 | 17 | */ |
18 | - public function __construct($elements, $args, $index, $currentFileInfo, $important = false){ |
|
18 | + public function __construct($elements, $args, $index, $currentFileInfo, $important = false) { |
|
19 | 19 | $this->selector = new Less_Tree_Selector($elements); |
20 | 20 | $this->arguments = $args; |
21 | 21 | $this->index = $index; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | //} |
30 | 30 | |
31 | 31 | |
32 | - public function compile($env){ |
|
32 | + public function compile($env) { |
|
33 | 33 | |
34 | 34 | $rules = array(); |
35 | 35 | $match = false; |
@@ -39,15 +39,15 @@ discard block |
||
39 | 39 | $conditionResult = array(); |
40 | 40 | |
41 | 41 | $args = array(); |
42 | - foreach($this->arguments as $a){ |
|
43 | - $args[] = array('name'=> $a['name'], 'value' => $a['value']->compile($env) ); |
|
42 | + foreach ($this->arguments as $a) { |
|
43 | + $args[] = array('name'=> $a['name'], 'value' => $a['value']->compile($env)); |
|
44 | 44 | } |
45 | 45 | |
46 | - foreach($env->frames as $frame){ |
|
46 | + foreach ($env->frames as $frame) { |
|
47 | 47 | |
48 | 48 | $mixins = $frame->find($this->selector); |
49 | 49 | |
50 | - if( !$mixins ){ |
|
50 | + if (!$mixins) { |
|
51 | 51 | continue; |
52 | 52 | } |
53 | 53 | |
@@ -62,31 +62,31 @@ discard block |
||
62 | 62 | // we make a final decision. |
63 | 63 | |
64 | 64 | $mixins_len = count($mixins); |
65 | - for( $m = 0; $m < $mixins_len; $m++ ){ |
|
65 | + for ($m = 0; $m<$mixins_len; $m++) { |
|
66 | 66 | $mixin = $mixins[$m]; |
67 | 67 | |
68 | - if( $this->IsRecursive( $env, $mixin ) ){ |
|
68 | + if ($this->IsRecursive($env, $mixin)) { |
|
69 | 69 | continue; |
70 | 70 | } |
71 | 71 | |
72 | - if( $mixin->matchArgs($args, $env) ){ |
|
72 | + if ($mixin->matchArgs($args, $env)) { |
|
73 | 73 | |
74 | 74 | $candidate = array('mixin' => $mixin, 'group' => $defNone); |
75 | 75 | |
76 | - if( $mixin instanceof Less_Tree_Ruleset ){ |
|
76 | + if ($mixin instanceof Less_Tree_Ruleset) { |
|
77 | 77 | |
78 | - for( $f = 0; $f < 2; $f++ ){ |
|
78 | + for ($f = 0; $f<2; $f++) { |
|
79 | 79 | Less_Tree_DefaultFunc::value($f); |
80 | - $conditionResult[$f] = $mixin->matchCondition( $args, $env); |
|
80 | + $conditionResult[$f] = $mixin->matchCondition($args, $env); |
|
81 | 81 | } |
82 | - if( $conditionResult[0] || $conditionResult[1] ){ |
|
83 | - if( $conditionResult[0] != $conditionResult[1] ){ |
|
82 | + if ($conditionResult[0] || $conditionResult[1]) { |
|
83 | + if ($conditionResult[0]!=$conditionResult[1]) { |
|
84 | 84 | $candidate['group'] = $conditionResult[1] ? $defTrue : $defFalse; |
85 | 85 | } |
86 | 86 | |
87 | 87 | $candidates[] = $candidate; |
88 | 88 | } |
89 | - }else{ |
|
89 | + }else { |
|
90 | 90 | $candidates[] = $candidate; |
91 | 91 | } |
92 | 92 | |
@@ -98,29 +98,29 @@ discard block |
||
98 | 98 | |
99 | 99 | |
100 | 100 | $count = array(0, 0, 0); |
101 | - for( $m = 0; $m < count($candidates); $m++ ){ |
|
102 | - $count[ $candidates[$m]['group'] ]++; |
|
101 | + for ($m = 0; $m<count($candidates); $m++) { |
|
102 | + $count[$candidates[$m]['group']]++; |
|
103 | 103 | } |
104 | 104 | |
105 | - if( $count[$defNone] > 0 ){ |
|
105 | + if ($count[$defNone]>0) { |
|
106 | 106 | $defaultResult = $defFalse; |
107 | - } else { |
|
107 | + }else { |
|
108 | 108 | $defaultResult = $defTrue; |
109 | - if( ($count[$defTrue] + $count[$defFalse]) > 1 ){ |
|
110 | - throw new Exception( 'Ambiguous use of `default()` found when matching for `'. $this->format($args) + '`' ); |
|
109 | + if (($count[$defTrue]+$count[$defFalse])>1) { |
|
110 | + throw new Exception('Ambiguous use of `default()` found when matching for `'.$this->format($args)+'`'); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
114 | 114 | |
115 | 115 | $candidates_length = count($candidates); |
116 | - $length_1 = ($candidates_length == 1); |
|
116 | + $length_1 = ($candidates_length==1); |
|
117 | 117 | |
118 | - for( $m = 0; $m < $candidates_length; $m++){ |
|
118 | + for ($m = 0; $m<$candidates_length; $m++) { |
|
119 | 119 | $candidate = $candidates[$m]['group']; |
120 | - if( ($candidate === $defNone) || ($candidate === $defaultResult) ){ |
|
121 | - try{ |
|
120 | + if (($candidate===$defNone) || ($candidate===$defaultResult)) { |
|
121 | + try { |
|
122 | 122 | $mixin = $candidates[$m]['mixin']; |
123 | - if( !($mixin instanceof Less_Tree_Mixin_Definition) ){ |
|
123 | + if (!($mixin instanceof Less_Tree_Mixin_Definition)) { |
|
124 | 124 | $mixin = new Less_Tree_Mixin_Definition('', array(), $mixin->rules, null, false); |
125 | 125 | $mixin->originalRuleset = $mixins[$m]->originalRuleset; |
126 | 126 | } |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
135 | - if( $match ){ |
|
136 | - if( !$this->currentFileInfo || !isset($this->currentFileInfo['reference']) || !$this->currentFileInfo['reference'] ){ |
|
135 | + if ($match) { |
|
136 | + if (!$this->currentFileInfo || !isset($this->currentFileInfo['reference']) || !$this->currentFileInfo['reference']) { |
|
137 | 137 | Less_Tree::ReferencedArray($rules); |
138 | 138 | } |
139 | 139 | |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | } |
142 | 142 | } |
143 | 143 | |
144 | - if( $isOneFound ){ |
|
145 | - throw new Less_Exception_Compiler('No matching definition was found for `'.$this->Format( $args ).'`', null, $this->index, $this->currentFileInfo); |
|
144 | + if ($isOneFound) { |
|
145 | + throw new Less_Exception_Compiler('No matching definition was found for `'.$this->Format($args).'`', null, $this->index, $this->currentFileInfo); |
|
146 | 146 | |
147 | - }else{ |
|
148 | - throw new Less_Exception_Compiler(trim($this->selector->toCSS()) . " is undefined in ".$this->currentFileInfo['filename'], null, $this->index); |
|
147 | + }else { |
|
148 | + throw new Less_Exception_Compiler(trim($this->selector->toCSS())." is undefined in ".$this->currentFileInfo['filename'], null, $this->index); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | } |
@@ -154,23 +154,23 @@ discard block |
||
154 | 154 | * Format the args for use in exception messages |
155 | 155 | * |
156 | 156 | */ |
157 | - private function Format($args){ |
|
157 | + private function Format($args) { |
|
158 | 158 | $message = array(); |
159 | - if( $args ){ |
|
160 | - foreach($args as $a){ |
|
159 | + if ($args) { |
|
160 | + foreach ($args as $a) { |
|
161 | 161 | $argValue = ''; |
162 | - if( $a['name'] ){ |
|
162 | + if ($a['name']) { |
|
163 | 163 | $argValue += $a['name']+':'; |
164 | 164 | } |
165 | - if( is_object($a['value']) ){ |
|
165 | + if (is_object($a['value'])) { |
|
166 | 166 | $argValue += $a['value']->toCSS(); |
167 | - }else{ |
|
167 | + }else { |
|
168 | 168 | $argValue += '???'; |
169 | 169 | } |
170 | 170 | $message[] = $argValue; |
171 | 171 | } |
172 | 172 | } |
173 | - return implode(', ',$message); |
|
173 | + return implode(', ', $message); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -179,16 +179,16 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @return bool |
181 | 181 | */ |
182 | - private function IsRecursive( $env, $mixin ){ |
|
182 | + private function IsRecursive($env, $mixin) { |
|
183 | 183 | |
184 | - foreach($env->frames as $recur_frame){ |
|
185 | - if( !($mixin instanceof Less_Tree_Mixin_Definition) ){ |
|
184 | + foreach ($env->frames as $recur_frame) { |
|
185 | + if (!($mixin instanceof Less_Tree_Mixin_Definition)) { |
|
186 | 186 | |
187 | - if( $mixin === $recur_frame ){ |
|
187 | + if ($mixin===$recur_frame) { |
|
188 | 188 | return true; |
189 | 189 | } |
190 | 190 | |
191 | - if( isset($recur_frame->originalRuleset) && $mixin->ruleset_id === $recur_frame->originalRuleset ){ |
|
191 | + if (isset($recur_frame->originalRuleset) && $mixin->ruleset_id===$recur_frame->originalRuleset) { |
|
192 | 192 | return true; |
193 | 193 | } |
194 | 194 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | $candidates[] = $candidate; |
88 | 88 | } |
89 | - }else{ |
|
89 | + } else{ |
|
90 | 90 | $candidates[] = $candidate; |
91 | 91 | } |
92 | 92 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | if( $isOneFound ){ |
145 | 145 | throw new Less_Exception_Compiler('No matching definition was found for `'.$this->Format( $args ).'`', null, $this->index, $this->currentFileInfo); |
146 | 146 | |
147 | - }else{ |
|
147 | + } else{ |
|
148 | 148 | throw new Less_Exception_Compiler(trim($this->selector->toCSS()) . " is undefined in ".$this->currentFileInfo['filename'], null, $this->index); |
149 | 149 | } |
150 | 150 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | } |
165 | 165 | if( is_object($a['value']) ){ |
166 | 166 | $argValue += $a['value']->toCSS(); |
167 | - }else{ |
|
167 | + } else{ |
|
168 | 168 | $argValue += '???'; |
169 | 169 | } |
170 | 170 | $message[] = $argValue; |
@@ -25,7 +25,7 @@ |
||
25 | 25 | $this->currentFileInfo = $currentFileInfo; |
26 | 26 | } |
27 | 27 | |
28 | - public function genCSS( $output ){ |
|
28 | + public function genCSS( $output ){ |
|
29 | 29 | |
30 | 30 | $output->add( |
31 | 31 | $this->name |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @package Less |
11 | 11 | * @subpackage tree |
12 | 12 | */ |
13 | -class Less_Tree_NameValue extends Less_Tree{ |
|
13 | +class Less_Tree_NameValue extends Less_Tree { |
|
14 | 14 | |
15 | 15 | public $name; |
16 | 16 | public $value; |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | public $currentFileInfo; |
19 | 19 | public $type = 'NameValue'; |
20 | 20 | |
21 | - public function __construct($name, $value = null, $index = null, $currentFileInfo = null ){ |
|
21 | + public function __construct($name, $value = null, $index = null, $currentFileInfo = null) { |
|
22 | 22 | $this->name = $name; |
23 | 23 | $this->value = $value; |
24 | 24 | $this->index = $index; |
25 | 25 | $this->currentFileInfo = $currentFileInfo; |
26 | 26 | } |
27 | 27 | |
28 | - public function genCSS( $output ){ |
|
28 | + public function genCSS($output) { |
|
29 | 29 | |
30 | 30 | $output->add( |
31 | 31 | $this->name |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | , $this->currentFileInfo, $this->index); |
36 | 36 | } |
37 | 37 | |
38 | - public function compile ($env){ |
|
38 | + public function compile($env) { |
|
39 | 39 | return $this; |
40 | 40 | } |
41 | 41 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | public $value; |
12 | 12 | public $type = 'Negative'; |
13 | 13 | |
14 | - public function __construct($node){ |
|
14 | + public function __construct($node){ |
|
15 | 15 | $this->value = $node; |
16 | 16 | } |
17 | 17 | |
@@ -19,15 +19,15 @@ discard block |
||
19 | 19 | // $this->value = $visitor->visit($this->value); |
20 | 20 | //} |
21 | 21 | |
22 | - /** |
|
23 | - * @see Less_Tree::genCSS |
|
24 | - */ |
|
25 | - public function genCSS( $output ){ |
|
22 | + /** |
|
23 | + * @see Less_Tree::genCSS |
|
24 | + */ |
|
25 | + public function genCSS( $output ){ |
|
26 | 26 | $output->add( '-' ); |
27 | 27 | $this->value->genCSS( $output ); |
28 | 28 | } |
29 | 29 | |
30 | - public function compile($env) { |
|
30 | + public function compile($env) { |
|
31 | 31 | if( Less_Environment::isMathOn() ){ |
32 | 32 | $ret = new Less_Tree_Operation('*', array( new Less_Tree_Dimension(-1), $this->value ) ); |
33 | 33 | return $ret->compile($env); |
@@ -6,12 +6,12 @@ discard block |
||
6 | 6 | * @package Less |
7 | 7 | * @subpackage tree |
8 | 8 | */ |
9 | -class Less_Tree_Negative extends Less_Tree{ |
|
9 | +class Less_Tree_Negative extends Less_Tree { |
|
10 | 10 | |
11 | 11 | public $value; |
12 | 12 | public $type = 'Negative'; |
13 | 13 | |
14 | - public function __construct($node){ |
|
14 | + public function __construct($node) { |
|
15 | 15 | $this->value = $node; |
16 | 16 | } |
17 | 17 | |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * @see Less_Tree::genCSS |
24 | 24 | */ |
25 | - public function genCSS( $output ){ |
|
26 | - $output->add( '-' ); |
|
27 | - $this->value->genCSS( $output ); |
|
25 | + public function genCSS($output) { |
|
26 | + $output->add('-'); |
|
27 | + $this->value->genCSS($output); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | public function compile($env) { |
31 | - if( Less_Environment::isMathOn() ){ |
|
32 | - $ret = new Less_Tree_Operation('*', array( new Less_Tree_Dimension(-1), $this->value ) ); |
|
31 | + if (Less_Environment::isMathOn()) { |
|
32 | + $ret = new Less_Tree_Operation('*', array(new Less_Tree_Dimension(-1), $this->value)); |
|
33 | 33 | return $ret->compile($env); |
34 | 34 | } |
35 | - return new Less_Tree_Negative( $this->value->compile($env) ); |
|
35 | + return new Less_Tree_Negative($this->value->compile($env)); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | \ No newline at end of file |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $this->isSpaced = $isSpaced; |
23 | 23 | } |
24 | 24 | |
25 | - public function accept($visitor) { |
|
25 | + public function accept($visitor) { |
|
26 | 26 | $this->operands = $visitor->visitArray($this->operands); |
27 | 27 | } |
28 | 28 | |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | - /** |
|
56 | - * @see Less_Tree::genCSS |
|
57 | - */ |
|
58 | - public function genCSS( $output ){ |
|
55 | + /** |
|
56 | + * @see Less_Tree::genCSS |
|
57 | + */ |
|
58 | + public function genCSS( $output ){ |
|
59 | 59 | $this->operands[0]->genCSS( $output ); |
60 | 60 | if( $this->isSpaced ){ |
61 | 61 | $output->add( " " ); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Less |
7 | 7 | * @subpackage tree |
8 | 8 | */ |
9 | -class Less_Tree_Operation extends Less_Tree{ |
|
9 | +class Less_Tree_Operation extends Less_Tree { |
|
10 | 10 | |
11 | 11 | public $op; |
12 | 12 | public $operands; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * @param string $op |
18 | 18 | */ |
19 | - public function __construct($op, $operands, $isSpaced = false){ |
|
19 | + public function __construct($op, $operands, $isSpaced = false) { |
|
20 | 20 | $this->op = trim($op); |
21 | 21 | $this->operands = $operands; |
22 | 22 | $this->isSpaced = $isSpaced; |
@@ -26,45 +26,45 @@ discard block |
||
26 | 26 | $this->operands = $visitor->visitArray($this->operands); |
27 | 27 | } |
28 | 28 | |
29 | - public function compile($env){ |
|
29 | + public function compile($env) { |
|
30 | 30 | $a = $this->operands[0]->compile($env); |
31 | 31 | $b = $this->operands[1]->compile($env); |
32 | 32 | |
33 | 33 | |
34 | - if( Less_Environment::isMathOn() ){ |
|
34 | + if (Less_Environment::isMathOn()) { |
|
35 | 35 | |
36 | - if( $a instanceof Less_Tree_Dimension && $b instanceof Less_Tree_Color ){ |
|
36 | + if ($a instanceof Less_Tree_Dimension && $b instanceof Less_Tree_Color) { |
|
37 | 37 | $a = $a->toColor(); |
38 | 38 | |
39 | - }elseif( $b instanceof Less_Tree_Dimension && $a instanceof Less_Tree_Color ){ |
|
39 | + }elseif ($b instanceof Less_Tree_Dimension && $a instanceof Less_Tree_Color) { |
|
40 | 40 | $b = $b->toColor(); |
41 | 41 | |
42 | 42 | } |
43 | 43 | |
44 | - if( !method_exists($a,'operate') ){ |
|
44 | + if (!method_exists($a, 'operate')) { |
|
45 | 45 | throw new Less_Exception_Compiler("Operation on an invalid type"); |
46 | 46 | } |
47 | 47 | |
48 | - return $a->operate( $this->op, $b); |
|
48 | + return $a->operate($this->op, $b); |
|
49 | 49 | } |
50 | 50 | |
51 | - return new Less_Tree_Operation($this->op, array($a, $b), $this->isSpaced ); |
|
51 | + return new Less_Tree_Operation($this->op, array($a, $b), $this->isSpaced); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | /** |
56 | 56 | * @see Less_Tree::genCSS |
57 | 57 | */ |
58 | - public function genCSS( $output ){ |
|
59 | - $this->operands[0]->genCSS( $output ); |
|
60 | - if( $this->isSpaced ){ |
|
61 | - $output->add( " " ); |
|
58 | + public function genCSS($output) { |
|
59 | + $this->operands[0]->genCSS($output); |
|
60 | + if ($this->isSpaced) { |
|
61 | + $output->add(" "); |
|
62 | 62 | } |
63 | - $output->add( $this->op ); |
|
64 | - if( $this->isSpaced ){ |
|
65 | - $output->add( ' ' ); |
|
63 | + $output->add($this->op); |
|
64 | + if ($this->isSpaced) { |
|
65 | + $output->add(' '); |
|
66 | 66 | } |
67 | - $this->operands[1]->genCSS( $output ); |
|
67 | + $this->operands[1]->genCSS($output); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | if( $a instanceof Less_Tree_Dimension && $b instanceof Less_Tree_Color ){ |
37 | 37 | $a = $a->toColor(); |
38 | 38 | |
39 | - }elseif( $b instanceof Less_Tree_Dimension && $a instanceof Less_Tree_Color ){ |
|
39 | + } elseif( $b instanceof Less_Tree_Dimension && $a instanceof Less_Tree_Color ){ |
|
40 | 40 | $b = $b->toColor(); |
41 | 41 | |
42 | 42 | } |
@@ -15,14 +15,14 @@ |
||
15 | 15 | $this->value = $value; |
16 | 16 | } |
17 | 17 | |
18 | - public function accept($visitor){ |
|
18 | + public function accept($visitor){ |
|
19 | 19 | $this->value = $visitor->visitObj($this->value); |
20 | 20 | } |
21 | 21 | |
22 | - /** |
|
23 | - * @see Less_Tree::genCSS |
|
24 | - */ |
|
25 | - public function genCSS( $output ){ |
|
22 | + /** |
|
23 | + * @see Less_Tree::genCSS |
|
24 | + */ |
|
25 | + public function genCSS( $output ){ |
|
26 | 26 | $output->add( '(' ); |
27 | 27 | $this->value->genCSS( $output ); |
28 | 28 | $output->add( ')' ); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Less |
7 | 7 | * @subpackage tree |
8 | 8 | */ |
9 | -class Less_Tree_Paren extends Less_Tree{ |
|
9 | +class Less_Tree_Paren extends Less_Tree { |
|
10 | 10 | |
11 | 11 | public $value; |
12 | 12 | public $type = 'Paren'; |
@@ -15,17 +15,17 @@ discard block |
||
15 | 15 | $this->value = $value; |
16 | 16 | } |
17 | 17 | |
18 | - public function accept($visitor){ |
|
18 | + public function accept($visitor) { |
|
19 | 19 | $this->value = $visitor->visitObj($this->value); |
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @see Less_Tree::genCSS |
24 | 24 | */ |
25 | - public function genCSS( $output ){ |
|
26 | - $output->add( '(' ); |
|
27 | - $this->value->genCSS( $output ); |
|
28 | - $output->add( ')' ); |
|
25 | + public function genCSS($output) { |
|
26 | + $output->add('('); |
|
27 | + $this->value->genCSS($output); |
|
28 | + $output->add(')'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | public function compile($env) { |