@@ -6,43 +6,43 @@ |
||
6 | 6 | * @package Less |
7 | 7 | * @subpackage visitor |
8 | 8 | */ |
9 | -class Less_Visitor{ |
|
9 | +class Less_Visitor { |
|
10 | 10 | |
11 | 11 | protected $methods = array(); |
12 | 12 | protected $_visitFnCache = array(); |
13 | 13 | |
14 | - public function __construct(){ |
|
14 | + public function __construct() { |
|
15 | 15 | $this->_visitFnCache = get_class_methods(get_class($this)); |
16 | 16 | $this->_visitFnCache = array_flip($this->_visitFnCache); |
17 | 17 | } |
18 | 18 | |
19 | - public function visitObj( $node ){ |
|
19 | + public function visitObj($node) { |
|
20 | 20 | |
21 | 21 | $funcName = 'visit'.$node->type; |
22 | - if( isset($this->_visitFnCache[$funcName]) ){ |
|
22 | + if (isset($this->_visitFnCache[$funcName])) { |
|
23 | 23 | |
24 | 24 | $visitDeeper = true; |
25 | - $this->$funcName( $node, $visitDeeper ); |
|
25 | + $this->$funcName($node, $visitDeeper); |
|
26 | 26 | |
27 | - if( $visitDeeper ){ |
|
27 | + if ($visitDeeper) { |
|
28 | 28 | $node->accept($this); |
29 | 29 | } |
30 | 30 | |
31 | - $funcName = $funcName . "Out"; |
|
32 | - if( isset($this->_visitFnCache[$funcName]) ){ |
|
33 | - $this->$funcName( $node ); |
|
31 | + $funcName = $funcName."Out"; |
|
32 | + if (isset($this->_visitFnCache[$funcName])) { |
|
33 | + $this->$funcName($node); |
|
34 | 34 | } |
35 | 35 | |
36 | - }else{ |
|
36 | + }else { |
|
37 | 37 | $node->accept($this); |
38 | 38 | } |
39 | 39 | |
40 | 40 | return $node; |
41 | 41 | } |
42 | 42 | |
43 | - public function visitArray( $nodes ){ |
|
43 | + public function visitArray($nodes) { |
|
44 | 44 | |
45 | - array_map( array($this,'visitObj'), $nodes); |
|
45 | + array_map(array($this, 'visitObj'), $nodes); |
|
46 | 46 | return $nodes; |
47 | 47 | } |
48 | 48 | } |
@@ -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 |
@@ -21,21 +21,21 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * @param Less_Tree_Ruleset $root |
23 | 23 | */ |
24 | - public function run($root){ |
|
24 | + public function run($root){ |
|
25 | 25 | $root = $this->visitObj($root); |
26 | 26 | $root->allExtends =& $this->allExtendsStack[0]; |
27 | 27 | return $root; |
28 | 28 | } |
29 | 29 | |
30 | - public function visitRule($ruleNode, &$visitDeeper ){ |
|
30 | + public function visitRule($ruleNode, &$visitDeeper ){ |
|
31 | 31 | $visitDeeper = false; |
32 | 32 | } |
33 | 33 | |
34 | - public function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ){ |
|
34 | + public function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ){ |
|
35 | 35 | $visitDeeper = false; |
36 | 36 | } |
37 | 37 | |
38 | - public function visitRuleset($rulesetNode){ |
|
38 | + public function visitRuleset($rulesetNode){ |
|
39 | 39 | |
40 | 40 | if( $rulesetNode->root ){ |
41 | 41 | return; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $this->contexts[] = $rulesetNode->selectors; |
72 | 72 | } |
73 | 73 | |
74 | - public function allExtendsStackPush($rulesetNode, $selectorPath, $extend, &$j){ |
|
74 | + public function allExtendsStackPush($rulesetNode, $selectorPath, $extend, &$j){ |
|
75 | 75 | $this->foundExtends = true; |
76 | 76 | $extend = clone $extend; |
77 | 77 | $extend->findSelfSelectors( $selectorPath ); |
@@ -86,27 +86,27 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | |
89 | - public function visitRulesetOut( $rulesetNode ){ |
|
89 | + public function visitRulesetOut( $rulesetNode ){ |
|
90 | 90 | if( !is_object($rulesetNode) || !$rulesetNode->root ){ |
91 | 91 | array_pop($this->contexts); |
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
95 | - public function visitMedia( $mediaNode ){ |
|
95 | + public function visitMedia( $mediaNode ){ |
|
96 | 96 | $mediaNode->allExtends = array(); |
97 | 97 | $this->allExtendsStack[] =& $mediaNode->allExtends; |
98 | 98 | } |
99 | 99 | |
100 | - public function visitMediaOut(){ |
|
100 | + public function visitMediaOut(){ |
|
101 | 101 | array_pop($this->allExtendsStack); |
102 | 102 | } |
103 | 103 | |
104 | - public function visitDirective( $directiveNode ){ |
|
104 | + public function visitDirective( $directiveNode ){ |
|
105 | 105 | $directiveNode->allExtends = array(); |
106 | 106 | $this->allExtendsStack[] =& $directiveNode->allExtends; |
107 | 107 | } |
108 | 108 | |
109 | - public function visitDirectiveOut(){ |
|
109 | + public function visitDirectiveOut(){ |
|
110 | 110 | array_pop($this->allExtendsStack); |
111 | 111 | } |
112 | 112 | } |
@@ -6,13 +6,13 @@ discard block |
||
6 | 6 | * @package Less |
7 | 7 | * @subpackage visitor |
8 | 8 | */ |
9 | -class Less_Visitor_extendFinder extends Less_Visitor{ |
|
9 | +class Less_Visitor_extendFinder extends Less_Visitor { |
|
10 | 10 | |
11 | 11 | public $contexts = array(); |
12 | 12 | public $allExtendsStack; |
13 | 13 | public $foundExtends; |
14 | 14 | |
15 | - public function __construct(){ |
|
15 | + public function __construct() { |
|
16 | 16 | $this->contexts = array(); |
17 | 17 | $this->allExtendsStack = array(array()); |
18 | 18 | parent::__construct(); |
@@ -21,32 +21,32 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * @param Less_Tree_Ruleset $root |
23 | 23 | */ |
24 | - public function run($root){ |
|
24 | + public function run($root) { |
|
25 | 25 | $root = $this->visitObj($root); |
26 | - $root->allExtends =& $this->allExtendsStack[0]; |
|
26 | + $root->allExtends = & $this->allExtendsStack[0]; |
|
27 | 27 | return $root; |
28 | 28 | } |
29 | 29 | |
30 | - public function visitRule($ruleNode, &$visitDeeper ){ |
|
30 | + public function visitRule($ruleNode, &$visitDeeper) { |
|
31 | 31 | $visitDeeper = false; |
32 | 32 | } |
33 | 33 | |
34 | - public function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ){ |
|
34 | + public function visitMixinDefinition($mixinDefinitionNode, &$visitDeeper) { |
|
35 | 35 | $visitDeeper = false; |
36 | 36 | } |
37 | 37 | |
38 | - public function visitRuleset($rulesetNode){ |
|
38 | + public function visitRuleset($rulesetNode) { |
|
39 | 39 | |
40 | - if( $rulesetNode->root ){ |
|
40 | + if ($rulesetNode->root) { |
|
41 | 41 | return; |
42 | 42 | } |
43 | 43 | |
44 | 44 | $allSelectorsExtendList = array(); |
45 | 45 | |
46 | 46 | // get &:extend(.a); rules which apply to all selectors in this ruleset |
47 | - if( $rulesetNode->rules ){ |
|
48 | - foreach($rulesetNode->rules as $rule){ |
|
49 | - if( $rule instanceof Less_Tree_Extend ){ |
|
47 | + if ($rulesetNode->rules) { |
|
48 | + foreach ($rulesetNode->rules as $rule) { |
|
49 | + if ($rule instanceof Less_Tree_Extend) { |
|
50 | 50 | $allSelectorsExtendList[] = $rule; |
51 | 51 | $rulesetNode->extendOnEveryPath = true; |
52 | 52 | } |
@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | |
57 | 57 | // now find every selector and apply the extends that apply to all extends |
58 | 58 | // and the ones which apply to an individual extend |
59 | - foreach($rulesetNode->paths as $selectorPath){ |
|
59 | + foreach ($rulesetNode->paths as $selectorPath) { |
|
60 | 60 | $selector = end($selectorPath); //$selectorPath[ count($selectorPath)-1]; |
61 | 61 | |
62 | 62 | $j = 0; |
63 | - foreach($selector->extendList as $extend){ |
|
63 | + foreach ($selector->extendList as $extend) { |
|
64 | 64 | $this->allExtendsStackPush($rulesetNode, $selectorPath, $extend, $j); |
65 | 65 | } |
66 | - foreach($allSelectorsExtendList as $extend){ |
|
66 | + foreach ($allSelectorsExtendList as $extend) { |
|
67 | 67 | $this->allExtendsStackPush($rulesetNode, $selectorPath, $extend, $j); |
68 | 68 | } |
69 | 69 | } |
@@ -71,12 +71,12 @@ discard block |
||
71 | 71 | $this->contexts[] = $rulesetNode->selectors; |
72 | 72 | } |
73 | 73 | |
74 | - public function allExtendsStackPush($rulesetNode, $selectorPath, $extend, &$j){ |
|
74 | + public function allExtendsStackPush($rulesetNode, $selectorPath, $extend, &$j) { |
|
75 | 75 | $this->foundExtends = true; |
76 | 76 | $extend = clone $extend; |
77 | - $extend->findSelfSelectors( $selectorPath ); |
|
77 | + $extend->findSelfSelectors($selectorPath); |
|
78 | 78 | $extend->ruleset = $rulesetNode; |
79 | - if( $j === 0 ){ |
|
79 | + if ($j===0) { |
|
80 | 80 | $extend->firstExtendOnThisSelectorPath = true; |
81 | 81 | } |
82 | 82 | |
@@ -86,27 +86,27 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | |
89 | - public function visitRulesetOut( $rulesetNode ){ |
|
90 | - if( !is_object($rulesetNode) || !$rulesetNode->root ){ |
|
89 | + public function visitRulesetOut($rulesetNode) { |
|
90 | + if (!is_object($rulesetNode) || !$rulesetNode->root) { |
|
91 | 91 | array_pop($this->contexts); |
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
95 | - public function visitMedia( $mediaNode ){ |
|
95 | + public function visitMedia($mediaNode) { |
|
96 | 96 | $mediaNode->allExtends = array(); |
97 | - $this->allExtendsStack[] =& $mediaNode->allExtends; |
|
97 | + $this->allExtendsStack[] = & $mediaNode->allExtends; |
|
98 | 98 | } |
99 | 99 | |
100 | - public function visitMediaOut(){ |
|
100 | + public function visitMediaOut() { |
|
101 | 101 | array_pop($this->allExtendsStack); |
102 | 102 | } |
103 | 103 | |
104 | - public function visitDirective( $directiveNode ){ |
|
104 | + public function visitDirective($directiveNode) { |
|
105 | 105 | $directiveNode->allExtends = array(); |
106 | - $this->allExtendsStack[] =& $directiveNode->allExtends; |
|
106 | + $this->allExtendsStack[] = & $directiveNode->allExtends; |
|
107 | 107 | } |
108 | 108 | |
109 | - public function visitDirectiveOut(){ |
|
109 | + public function visitDirectiveOut() { |
|
110 | 110 | array_pop($this->allExtendsStack); |
111 | 111 | } |
112 | 112 | } |
@@ -17,15 +17,15 @@ discard block |
||
17 | 17 | return $this->visitObj($root); |
18 | 18 | } |
19 | 19 | |
20 | - public function visitRule( $ruleNode, &$visitDeeper ){ |
|
20 | + public function visitRule( $ruleNode, &$visitDeeper ){ |
|
21 | 21 | $visitDeeper = false; |
22 | 22 | } |
23 | 23 | |
24 | - public function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ){ |
|
24 | + public function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ){ |
|
25 | 25 | $visitDeeper = false; |
26 | 26 | } |
27 | 27 | |
28 | - public function visitRuleset( $rulesetNode ){ |
|
28 | + public function visitRuleset( $rulesetNode ){ |
|
29 | 29 | |
30 | 30 | $paths = array(); |
31 | 31 | |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | $this->contexts[] = $paths; //different from less.js. Placed after joinSelectors() so that $this->contexts will get correct $paths |
55 | 55 | } |
56 | 56 | |
57 | - public function visitRulesetOut(){ |
|
57 | + public function visitRulesetOut(){ |
|
58 | 58 | array_pop($this->contexts); |
59 | 59 | } |
60 | 60 | |
61 | - public function visitMedia($mediaNode) { |
|
61 | + public function visitMedia($mediaNode) { |
|
62 | 62 | $context = end($this->contexts); //$context = $this->contexts[ count($this->contexts) - 1]; |
63 | 63 | |
64 | 64 | if( !count($context) || (is_object($context[0]) && $context[0]->multiMedia) ){ |
@@ -6,46 +6,46 @@ discard block |
||
6 | 6 | * @package Less |
7 | 7 | * @subpackage visitor |
8 | 8 | */ |
9 | -class Less_Visitor_joinSelector extends Less_Visitor{ |
|
9 | +class Less_Visitor_joinSelector extends Less_Visitor { |
|
10 | 10 | |
11 | - public $contexts = array( array() ); |
|
11 | + public $contexts = array(array()); |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @param Less_Tree_Ruleset $root |
15 | 15 | */ |
16 | - public function run( $root ){ |
|
16 | + public function run($root) { |
|
17 | 17 | return $this->visitObj($root); |
18 | 18 | } |
19 | 19 | |
20 | - public function visitRule( $ruleNode, &$visitDeeper ){ |
|
20 | + public function visitRule($ruleNode, &$visitDeeper) { |
|
21 | 21 | $visitDeeper = false; |
22 | 22 | } |
23 | 23 | |
24 | - public function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ){ |
|
24 | + public function visitMixinDefinition($mixinDefinitionNode, &$visitDeeper) { |
|
25 | 25 | $visitDeeper = false; |
26 | 26 | } |
27 | 27 | |
28 | - public function visitRuleset( $rulesetNode ){ |
|
28 | + public function visitRuleset($rulesetNode) { |
|
29 | 29 | |
30 | 30 | $paths = array(); |
31 | 31 | |
32 | - if( !$rulesetNode->root ){ |
|
32 | + if (!$rulesetNode->root) { |
|
33 | 33 | $selectors = array(); |
34 | 34 | |
35 | - if( $rulesetNode->selectors && $rulesetNode->selectors ){ |
|
36 | - foreach($rulesetNode->selectors as $selector){ |
|
37 | - if( $selector->getIsOutput() ){ |
|
35 | + if ($rulesetNode->selectors && $rulesetNode->selectors) { |
|
36 | + foreach ($rulesetNode->selectors as $selector) { |
|
37 | + if ($selector->getIsOutput()) { |
|
38 | 38 | $selectors[] = $selector; |
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | - if( !$selectors ){ |
|
43 | + if (!$selectors) { |
|
44 | 44 | $rulesetNode->selectors = null; |
45 | 45 | $rulesetNode->rules = null; |
46 | - }else{ |
|
46 | + }else { |
|
47 | 47 | $context = end($this->contexts); //$context = $this->contexts[ count($this->contexts) - 1]; |
48 | - $paths = $rulesetNode->joinSelectors( $context, $selectors); |
|
48 | + $paths = $rulesetNode->joinSelectors($context, $selectors); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | $rulesetNode->paths = $paths; |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | $this->contexts[] = $paths; //different from less.js. Placed after joinSelectors() so that $this->contexts will get correct $paths |
55 | 55 | } |
56 | 56 | |
57 | - public function visitRulesetOut(){ |
|
57 | + public function visitRulesetOut() { |
|
58 | 58 | array_pop($this->contexts); |
59 | 59 | } |
60 | 60 | |
61 | 61 | public function visitMedia($mediaNode) { |
62 | 62 | $context = end($this->contexts); //$context = $this->contexts[ count($this->contexts) - 1]; |
63 | 63 | |
64 | - if( !count($context) || (is_object($context[0]) && $context[0]->multiMedia) ){ |
|
64 | + if (!count($context) || (is_object($context[0]) && $context[0]->multiMedia)) { |
|
65 | 65 | $mediaNode->rules[0]->root = true; |
66 | 66 | } |
67 | 67 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | if( !$selectors ){ |
44 | 44 | $rulesetNode->selectors = null; |
45 | 45 | $rulesetNode->rules = null; |
46 | - }else{ |
|
46 | + } else{ |
|
47 | 47 | $context = end($this->contexts); //$context = $this->contexts[ count($this->contexts) - 1]; |
48 | 48 | $paths = $rulesetNode->joinSelectors( $context, $selectors); |
49 | 49 | } |
@@ -6,29 +6,29 @@ discard block |
||
6 | 6 | * @package Less |
7 | 7 | * @subpackage visitor |
8 | 8 | */ |
9 | -class Less_Visitor_processExtends extends Less_Visitor{ |
|
9 | +class Less_Visitor_processExtends extends Less_Visitor { |
|
10 | 10 | |
11 | 11 | public $allExtendsStack; |
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @param Less_Tree_Ruleset $root |
15 | 15 | */ |
16 | - public function run( $root ){ |
|
16 | + public function run($root) { |
|
17 | 17 | $extendFinder = new Less_Visitor_extendFinder(); |
18 | - $extendFinder->run( $root ); |
|
19 | - if( !$extendFinder->foundExtends){ |
|
18 | + $extendFinder->run($root); |
|
19 | + if (!$extendFinder->foundExtends) { |
|
20 | 20 | return $root; |
21 | 21 | } |
22 | 22 | |
23 | - $root->allExtends = $this->doExtendChaining( $root->allExtends, $root->allExtends); |
|
23 | + $root->allExtends = $this->doExtendChaining($root->allExtends, $root->allExtends); |
|
24 | 24 | |
25 | 25 | $this->allExtendsStack = array(); |
26 | 26 | $this->allExtendsStack[] = &$root->allExtends; |
27 | 27 | |
28 | - return $this->visitObj( $root ); |
|
28 | + return $this->visitObj($root); |
|
29 | 29 | } |
30 | 30 | |
31 | - private function doExtendChaining( $extendsList, $extendsListTarget, $iterationCount = 0){ |
|
31 | + private function doExtendChaining($extendsList, $extendsListTarget, $iterationCount = 0) { |
|
32 | 32 | // |
33 | 33 | // chaining is different from normal extension.. if we extend an extend then we are not just copying, altering and pasting |
34 | 34 | // the selector we would do normally, but we are also adding an extend with the same target selector |
@@ -47,33 +47,33 @@ discard block |
||
47 | 47 | // and the second is the target. |
48 | 48 | // the seperation into two lists allows us to process a subset of chains with a bigger set, as is the |
49 | 49 | // case when processing media queries |
50 | - for( $extendIndex = 0, $extendsList_len = count($extendsList); $extendIndex < $extendsList_len; $extendIndex++ ){ |
|
51 | - for( $targetExtendIndex = 0; $targetExtendIndex < count($extendsListTarget); $targetExtendIndex++ ){ |
|
50 | + for ($extendIndex = 0, $extendsList_len = count($extendsList); $extendIndex<$extendsList_len; $extendIndex++) { |
|
51 | + for ($targetExtendIndex = 0; $targetExtendIndex<count($extendsListTarget); $targetExtendIndex++) { |
|
52 | 52 | |
53 | 53 | $extend = $extendsList[$extendIndex]; |
54 | 54 | $targetExtend = $extendsListTarget[$targetExtendIndex]; |
55 | 55 | |
56 | 56 | // look for circular references |
57 | - if( in_array($targetExtend->object_id, $extend->parent_ids,true) ){ |
|
57 | + if (in_array($targetExtend->object_id, $extend->parent_ids, true)) { |
|
58 | 58 | continue; |
59 | 59 | } |
60 | 60 | |
61 | 61 | // find a match in the target extends self selector (the bit before :extend) |
62 | - $selectorPath = array( $targetExtend->selfSelectors[0] ); |
|
63 | - $matches = $this->findMatch( $extend, $selectorPath); |
|
62 | + $selectorPath = array($targetExtend->selfSelectors[0]); |
|
63 | + $matches = $this->findMatch($extend, $selectorPath); |
|
64 | 64 | |
65 | 65 | |
66 | - if( $matches ){ |
|
66 | + if ($matches) { |
|
67 | 67 | |
68 | 68 | // we found a match, so for each self selector.. |
69 | - foreach($extend->selfSelectors as $selfSelector ){ |
|
69 | + foreach ($extend->selfSelectors as $selfSelector) { |
|
70 | 70 | |
71 | 71 | |
72 | 72 | // process the extend as usual |
73 | - $newSelector = $this->extendSelector( $matches, $selectorPath, $selfSelector); |
|
73 | + $newSelector = $this->extendSelector($matches, $selectorPath, $selfSelector); |
|
74 | 74 | |
75 | 75 | // but now we create a new extend from it |
76 | - $newExtend = new Less_Tree_Extend( $targetExtend->selector, $targetExtend->option, 0); |
|
76 | + $newExtend = new Less_Tree_Extend($targetExtend->selector, $targetExtend->option, 0); |
|
77 | 77 | $newExtend->selfSelectors = $newSelector; |
78 | 78 | |
79 | 79 | // add the extend onto the list of extends for that selector |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | $newExtend->ruleset = $targetExtend->ruleset; |
86 | 86 | |
87 | 87 | //remember its parents for circular references |
88 | - $newExtend->parent_ids = array_merge($newExtend->parent_ids,$targetExtend->parent_ids,$extend->parent_ids); |
|
88 | + $newExtend->parent_ids = array_merge($newExtend->parent_ids, $targetExtend->parent_ids, $extend->parent_ids); |
|
89 | 89 | |
90 | 90 | // only process the selector once.. if we have :extend(.a,.b) then multiple |
91 | 91 | // extends will look at the same selector path, so when extending |
92 | 92 | // we know that any others will be duplicates in terms of what is added to the css |
93 | - if( $targetExtend->firstExtendOnThisSelectorPath ){ |
|
93 | + if ($targetExtend->firstExtendOnThisSelectorPath) { |
|
94 | 94 | $newExtend->firstExtendOnThisSelectorPath = true; |
95 | 95 | $targetExtend->ruleset->paths[] = $newSelector; |
96 | 96 | } |
@@ -99,79 +99,79 @@ discard block |
||
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
102 | - if( $extendsToAdd ){ |
|
102 | + if ($extendsToAdd) { |
|
103 | 103 | // try to detect circular references to stop a stack overflow. |
104 | 104 | // may no longer be needed. $this->extendChainCount++; |
105 | - if( $iterationCount > 100) { |
|
105 | + if ($iterationCount>100) { |
|
106 | 106 | |
107 | - try{ |
|
107 | + try { |
|
108 | 108 | $selectorOne = $extendsToAdd[0]->selfSelectors[0]->toCSS(); |
109 | 109 | $selectorTwo = $extendsToAdd[0]->selector->toCSS(); |
110 | - }catch(Exception $e){ |
|
110 | + } catch (Exception $e) { |
|
111 | 111 | $selectorOne = "{unable to calculate}"; |
112 | 112 | $selectorTwo = "{unable to calculate}"; |
113 | 113 | } |
114 | 114 | |
115 | - throw new Less_Exception_Parser("extend circular reference detected. One of the circular extends is currently:"+$selectorOne+":extend(" + $selectorTwo+")"); |
|
115 | + throw new Less_Exception_Parser("extend circular reference detected. One of the circular extends is currently:"+$selectorOne+":extend(" +$selectorTwo+")"); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | // now process the new extends on the existing rules so that we can handle a extending b extending c ectending d extending e... |
119 | - $extendsToAdd = $this->doExtendChaining( $extendsToAdd, $extendsListTarget, $iterationCount+1); |
|
119 | + $extendsToAdd = $this->doExtendChaining($extendsToAdd, $extendsListTarget, $iterationCount+1); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | return array_merge($extendsList, $extendsToAdd); |
123 | 123 | } |
124 | 124 | |
125 | 125 | |
126 | - protected function visitRule( $ruleNode, &$visitDeeper ){ |
|
126 | + protected function visitRule($ruleNode, &$visitDeeper) { |
|
127 | 127 | $visitDeeper = false; |
128 | 128 | } |
129 | 129 | |
130 | - protected function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ){ |
|
130 | + protected function visitMixinDefinition($mixinDefinitionNode, &$visitDeeper) { |
|
131 | 131 | $visitDeeper = false; |
132 | 132 | } |
133 | 133 | |
134 | - protected function visitSelector( $selectorNode, &$visitDeeper ){ |
|
134 | + protected function visitSelector($selectorNode, &$visitDeeper) { |
|
135 | 135 | $visitDeeper = false; |
136 | 136 | } |
137 | 137 | |
138 | - protected function visitRuleset($rulesetNode){ |
|
138 | + protected function visitRuleset($rulesetNode) { |
|
139 | 139 | |
140 | 140 | |
141 | - if( $rulesetNode->root ){ |
|
141 | + if ($rulesetNode->root) { |
|
142 | 142 | return; |
143 | 143 | } |
144 | 144 | |
145 | - $allExtends = end($this->allExtendsStack); |
|
145 | + $allExtends = end($this->allExtendsStack); |
|
146 | 146 | $paths_len = count($rulesetNode->paths); |
147 | 147 | |
148 | 148 | // look at each selector path in the ruleset, find any extend matches and then copy, find and replace |
149 | - foreach($allExtends as $allExtend){ |
|
150 | - for($pathIndex = 0; $pathIndex < $paths_len; $pathIndex++ ){ |
|
149 | + foreach ($allExtends as $allExtend) { |
|
150 | + for ($pathIndex = 0; $pathIndex<$paths_len; $pathIndex++) { |
|
151 | 151 | |
152 | 152 | // extending extends happens initially, before the main pass |
153 | - if( isset($rulesetNode->extendOnEveryPath) && $rulesetNode->extendOnEveryPath ){ |
|
153 | + if (isset($rulesetNode->extendOnEveryPath) && $rulesetNode->extendOnEveryPath) { |
|
154 | 154 | continue; |
155 | 155 | } |
156 | 156 | |
157 | 157 | $selectorPath = $rulesetNode->paths[$pathIndex]; |
158 | 158 | |
159 | - if( end($selectorPath)->extendList ){ |
|
159 | + if (end($selectorPath)->extendList) { |
|
160 | 160 | continue; |
161 | 161 | } |
162 | 162 | |
163 | - $this->ExtendMatch( $rulesetNode, $allExtend, $selectorPath); |
|
163 | + $this->ExtendMatch($rulesetNode, $allExtend, $selectorPath); |
|
164 | 164 | |
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | 169 | |
170 | - private function ExtendMatch( $rulesetNode, $extend, $selectorPath ){ |
|
170 | + private function ExtendMatch($rulesetNode, $extend, $selectorPath) { |
|
171 | 171 | $matches = $this->findMatch($extend, $selectorPath); |
172 | 172 | |
173 | - if( $matches ){ |
|
174 | - foreach($extend->selfSelectors as $selfSelector ){ |
|
173 | + if ($matches) { |
|
174 | + foreach ($extend->selfSelectors as $selfSelector) { |
|
175 | 175 | $rulesetNode->paths[] = $this->extendSelector($matches, $selectorPath, $selfSelector); |
176 | 176 | } |
177 | 177 | } |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | |
180 | 180 | |
181 | 181 | |
182 | - private function findMatch($extend, $haystackSelectorPath ){ |
|
182 | + private function findMatch($extend, $haystackSelectorPath) { |
|
183 | 183 | |
184 | 184 | |
185 | - if( !$this->HasMatches($extend, $haystackSelectorPath) ){ |
|
185 | + if (!$this->HasMatches($extend, $haystackSelectorPath)) { |
|
186 | 186 | return false; |
187 | 187 | } |
188 | 188 | |
@@ -201,41 +201,41 @@ discard block |
||
201 | 201 | |
202 | 202 | // loop through the haystack elements |
203 | 203 | $haystack_path_len = count($haystackSelectorPath); |
204 | - for($haystackSelectorIndex = 0; $haystackSelectorIndex < $haystack_path_len; $haystackSelectorIndex++ ){ |
|
204 | + for ($haystackSelectorIndex = 0; $haystackSelectorIndex<$haystack_path_len; $haystackSelectorIndex++) { |
|
205 | 205 | $hackstackSelector = $haystackSelectorPath[$haystackSelectorIndex]; |
206 | 206 | |
207 | 207 | $haystack_elements_len = count($hackstackSelector->elements); |
208 | - for($hackstackElementIndex = 0; $hackstackElementIndex < $haystack_elements_len; $hackstackElementIndex++ ){ |
|
208 | + for ($hackstackElementIndex = 0; $hackstackElementIndex<$haystack_elements_len; $hackstackElementIndex++) { |
|
209 | 209 | |
210 | 210 | $haystackElement = $hackstackSelector->elements[$hackstackElementIndex]; |
211 | 211 | |
212 | 212 | // if we allow elements before our match we can add a potential match every time. otherwise only at the first element. |
213 | - if( $extend->allowBefore || ($haystackSelectorIndex === 0 && $hackstackElementIndex === 0) ){ |
|
213 | + if ($extend->allowBefore || ($haystackSelectorIndex===0 && $hackstackElementIndex===0)) { |
|
214 | 214 | $potentialMatches[] = array('pathIndex'=> $haystackSelectorIndex, 'index'=> $hackstackElementIndex, 'matched'=> 0, 'initialCombinator'=> $haystackElement->combinator); |
215 | 215 | $potentialMatches_len++; |
216 | 216 | } |
217 | 217 | |
218 | - for($i = 0; $i < $potentialMatches_len; $i++ ){ |
|
218 | + for ($i = 0; $i<$potentialMatches_len; $i++) { |
|
219 | 219 | |
220 | 220 | $potentialMatch = &$potentialMatches[$i]; |
221 | - $potentialMatch = $this->PotentialMatch( $potentialMatch, $needleElements, $haystackElement, $hackstackElementIndex ); |
|
221 | + $potentialMatch = $this->PotentialMatch($potentialMatch, $needleElements, $haystackElement, $hackstackElementIndex); |
|
222 | 222 | |
223 | 223 | |
224 | 224 | // if we are still valid and have finished, test whether we have elements after and whether these are allowed |
225 | - if( $potentialMatch && $potentialMatch['matched'] === $extend->selector->elements_len ){ |
|
225 | + if ($potentialMatch && $potentialMatch['matched']===$extend->selector->elements_len) { |
|
226 | 226 | $potentialMatch['finished'] = true; |
227 | 227 | |
228 | - if( !$extend->allowAfter && ($hackstackElementIndex+1 < $haystack_elements_len || $haystackSelectorIndex+1 < $haystack_path_len) ){ |
|
228 | + if (!$extend->allowAfter && ($hackstackElementIndex+1<$haystack_elements_len || $haystackSelectorIndex+1<$haystack_path_len)) { |
|
229 | 229 | $potentialMatch = null; |
230 | 230 | } |
231 | 231 | } |
232 | 232 | |
233 | 233 | // if null we remove, if not, we are still valid, so either push as a valid match or continue |
234 | - if( $potentialMatch ){ |
|
235 | - if( $potentialMatch['finished'] ){ |
|
234 | + if ($potentialMatch) { |
|
235 | + if ($potentialMatch['finished']) { |
|
236 | 236 | $potentialMatch['length'] = $extend->selector->elements_len; |
237 | 237 | $potentialMatch['endPathIndex'] = $haystackSelectorIndex; |
238 | - $potentialMatch['endPathElementIndex'] = $hackstackElementIndex + 1; // index after end of match |
|
238 | + $potentialMatch['endPathElementIndex'] = $hackstackElementIndex+1; // index after end of match |
|
239 | 239 | $potentialMatches = array(); // we don't allow matches to overlap, so start matching again |
240 | 240 | $potentialMatches_len = 0; |
241 | 241 | $matches[] = $potentialMatch; |
@@ -256,20 +256,20 @@ discard block |
||
256 | 256 | |
257 | 257 | // Before going through all the nested loops, lets check to see if a match is possible |
258 | 258 | // Reduces Bootstrap 3.1 compile time from ~6.5s to ~5.6s |
259 | - private function HasMatches($extend, $haystackSelectorPath){ |
|
259 | + private function HasMatches($extend, $haystackSelectorPath) { |
|
260 | 260 | |
261 | - if( !$extend->selector->cacheable ){ |
|
261 | + if (!$extend->selector->cacheable) { |
|
262 | 262 | return true; |
263 | 263 | } |
264 | 264 | |
265 | 265 | $first_el = $extend->selector->_oelements[0]; |
266 | 266 | |
267 | - foreach($haystackSelectorPath as $hackstackSelector){ |
|
268 | - if( !$hackstackSelector->cacheable ){ |
|
267 | + foreach ($haystackSelectorPath as $hackstackSelector) { |
|
268 | + if (!$hackstackSelector->cacheable) { |
|
269 | 269 | return true; |
270 | 270 | } |
271 | 271 | |
272 | - if( in_array($first_el, $hackstackSelector->_oelements) ){ |
|
272 | + if (in_array($first_el, $hackstackSelector->_oelements)) { |
|
273 | 273 | return true; |
274 | 274 | } |
275 | 275 | } |
@@ -281,26 +281,26 @@ discard block |
||
281 | 281 | /** |
282 | 282 | * @param integer $hackstackElementIndex |
283 | 283 | */ |
284 | - private function PotentialMatch( $potentialMatch, $needleElements, $haystackElement, $hackstackElementIndex ){ |
|
284 | + private function PotentialMatch($potentialMatch, $needleElements, $haystackElement, $hackstackElementIndex) { |
|
285 | 285 | |
286 | 286 | |
287 | - if( $potentialMatch['matched'] > 0 ){ |
|
287 | + if ($potentialMatch['matched']>0) { |
|
288 | 288 | |
289 | 289 | // selectors add " " onto the first element. When we use & it joins the selectors together, but if we don't |
290 | 290 | // then each selector in haystackSelectorPath has a space before it added in the toCSS phase. so we need to work out |
291 | 291 | // what the resulting combinator will be |
292 | 292 | $targetCombinator = $haystackElement->combinator; |
293 | - if( $targetCombinator === '' && $hackstackElementIndex === 0 ){ |
|
293 | + if ($targetCombinator==='' && $hackstackElementIndex===0) { |
|
294 | 294 | $targetCombinator = ' '; |
295 | 295 | } |
296 | 296 | |
297 | - if( $needleElements[ $potentialMatch['matched'] ]->combinator !== $targetCombinator ){ |
|
297 | + if ($needleElements[$potentialMatch['matched']]->combinator!==$targetCombinator) { |
|
298 | 298 | return null; |
299 | 299 | } |
300 | 300 | } |
301 | 301 | |
302 | 302 | // if we don't match, null our match to indicate failure |
303 | - if( !$this->isElementValuesEqual( $needleElements[$potentialMatch['matched'] ]->value, $haystackElement->value) ){ |
|
303 | + if (!$this->isElementValuesEqual($needleElements[$potentialMatch['matched']]->value, $haystackElement->value)) { |
|
304 | 304 | return null; |
305 | 305 | } |
306 | 306 | |
@@ -311,23 +311,23 @@ discard block |
||
311 | 311 | } |
312 | 312 | |
313 | 313 | |
314 | - private function isElementValuesEqual( $elementValue1, $elementValue2 ){ |
|
314 | + private function isElementValuesEqual($elementValue1, $elementValue2) { |
|
315 | 315 | |
316 | - if( $elementValue1 === $elementValue2 ){ |
|
316 | + if ($elementValue1===$elementValue2) { |
|
317 | 317 | return true; |
318 | 318 | } |
319 | 319 | |
320 | - if( is_string($elementValue1) || is_string($elementValue2) ) { |
|
320 | + if (is_string($elementValue1) || is_string($elementValue2)) { |
|
321 | 321 | return false; |
322 | 322 | } |
323 | 323 | |
324 | - if( $elementValue1 instanceof Less_Tree_Attribute ){ |
|
325 | - return $this->isAttributeValuesEqual( $elementValue1, $elementValue2 ); |
|
324 | + if ($elementValue1 instanceof Less_Tree_Attribute) { |
|
325 | + return $this->isAttributeValuesEqual($elementValue1, $elementValue2); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | $elementValue1 = $elementValue1->value; |
329 | - if( $elementValue1 instanceof Less_Tree_Selector ){ |
|
330 | - return $this->isSelectorValuesEqual( $elementValue1, $elementValue2 ); |
|
329 | + if ($elementValue1 instanceof Less_Tree_Selector) { |
|
330 | + return $this->isSelectorValuesEqual($elementValue1, $elementValue2); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | return false; |
@@ -337,22 +337,22 @@ discard block |
||
337 | 337 | /** |
338 | 338 | * @param Less_Tree_Selector $elementValue1 |
339 | 339 | */ |
340 | - private function isSelectorValuesEqual( $elementValue1, $elementValue2 ){ |
|
340 | + private function isSelectorValuesEqual($elementValue1, $elementValue2) { |
|
341 | 341 | |
342 | 342 | $elementValue2 = $elementValue2->value; |
343 | - if( !($elementValue2 instanceof Less_Tree_Selector) || $elementValue1->elements_len !== $elementValue2->elements_len ){ |
|
343 | + if (!($elementValue2 instanceof Less_Tree_Selector) || $elementValue1->elements_len!==$elementValue2->elements_len) { |
|
344 | 344 | return false; |
345 | 345 | } |
346 | 346 | |
347 | - for( $i = 0; $i < $elementValue1->elements_len; $i++ ){ |
|
347 | + for ($i = 0; $i<$elementValue1->elements_len; $i++) { |
|
348 | 348 | |
349 | - if( $elementValue1->elements[$i]->combinator !== $elementValue2->elements[$i]->combinator ){ |
|
350 | - if( $i !== 0 || ($elementValue1->elements[$i]->combinator || ' ') !== ($elementValue2->elements[$i]->combinator || ' ') ){ |
|
349 | + if ($elementValue1->elements[$i]->combinator!==$elementValue2->elements[$i]->combinator) { |
|
350 | + if ($i!==0 || ($elementValue1->elements[$i]->combinator || ' ')!==($elementValue2->elements[$i]->combinator || ' ')) { |
|
351 | 351 | return false; |
352 | 352 | } |
353 | 353 | } |
354 | 354 | |
355 | - if( !$this->isElementValuesEqual($elementValue1->elements[$i]->value, $elementValue2->elements[$i]->value) ){ |
|
355 | + if (!$this->isElementValuesEqual($elementValue1->elements[$i]->value, $elementValue2->elements[$i]->value)) { |
|
356 | 356 | return false; |
357 | 357 | } |
358 | 358 | } |
@@ -364,27 +364,27 @@ discard block |
||
364 | 364 | /** |
365 | 365 | * @param Less_Tree_Attribute $elementValue1 |
366 | 366 | */ |
367 | - private function isAttributeValuesEqual( $elementValue1, $elementValue2 ){ |
|
367 | + private function isAttributeValuesEqual($elementValue1, $elementValue2) { |
|
368 | 368 | |
369 | - if( $elementValue1->op !== $elementValue2->op || $elementValue1->key !== $elementValue2->key ){ |
|
369 | + if ($elementValue1->op!==$elementValue2->op || $elementValue1->key!==$elementValue2->key) { |
|
370 | 370 | return false; |
371 | 371 | } |
372 | 372 | |
373 | - if( !$elementValue1->value || !$elementValue2->value ){ |
|
374 | - if( $elementValue1->value || $elementValue2->value ) { |
|
373 | + if (!$elementValue1->value || !$elementValue2->value) { |
|
374 | + if ($elementValue1->value || $elementValue2->value) { |
|
375 | 375 | return false; |
376 | 376 | } |
377 | 377 | return true; |
378 | 378 | } |
379 | 379 | |
380 | - $elementValue1 = ($elementValue1->value->value ? $elementValue1->value->value : $elementValue1->value ); |
|
381 | - $elementValue2 = ($elementValue2->value->value ? $elementValue2->value->value : $elementValue2->value ); |
|
380 | + $elementValue1 = ($elementValue1->value->value ? $elementValue1->value->value : $elementValue1->value); |
|
381 | + $elementValue2 = ($elementValue2->value->value ? $elementValue2->value->value : $elementValue2->value); |
|
382 | 382 | |
383 | - return $elementValue1 === $elementValue2; |
|
383 | + return $elementValue1===$elementValue2; |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
387 | - private function extendSelector($matches, $selectorPath, $replacementSelector){ |
|
387 | + private function extendSelector($matches, $selectorPath, $replacementSelector) { |
|
388 | 388 | |
389 | 389 | //for a set of matches, replace each match with the replacement selector |
390 | 390 | |
@@ -393,11 +393,11 @@ discard block |
||
393 | 393 | $path = array(); |
394 | 394 | $selectorPath_len = count($selectorPath); |
395 | 395 | |
396 | - for($matchIndex = 0, $matches_len = count($matches); $matchIndex < $matches_len; $matchIndex++ ){ |
|
396 | + for ($matchIndex = 0, $matches_len = count($matches); $matchIndex<$matches_len; $matchIndex++) { |
|
397 | 397 | |
398 | 398 | |
399 | 399 | $match = $matches[$matchIndex]; |
400 | - $selector = $selectorPath[ $match['pathIndex'] ]; |
|
400 | + $selector = $selectorPath[$match['pathIndex']]; |
|
401 | 401 | |
402 | 402 | $firstElement = new Less_Tree_Element( |
403 | 403 | $match['initialCombinator'], |
@@ -406,63 +406,63 @@ discard block |
||
406 | 406 | $replacementSelector->elements[0]->currentFileInfo |
407 | 407 | ); |
408 | 408 | |
409 | - if( $match['pathIndex'] > $currentSelectorPathIndex && $currentSelectorPathElementIndex > 0 ){ |
|
409 | + if ($match['pathIndex']>$currentSelectorPathIndex && $currentSelectorPathElementIndex>0) { |
|
410 | 410 | $last_path = end($path); |
411 | - $last_path->elements = array_merge( $last_path->elements, array_slice( $selectorPath[$currentSelectorPathIndex]->elements, $currentSelectorPathElementIndex)); |
|
411 | + $last_path->elements = array_merge($last_path->elements, array_slice($selectorPath[$currentSelectorPathIndex]->elements, $currentSelectorPathElementIndex)); |
|
412 | 412 | $currentSelectorPathElementIndex = 0; |
413 | 413 | $currentSelectorPathIndex++; |
414 | 414 | } |
415 | 415 | |
416 | 416 | $newElements = array_merge( |
417 | - array_slice($selector->elements, $currentSelectorPathElementIndex, ($match['index'] - $currentSelectorPathElementIndex) ) // last parameter of array_slice is different than the last parameter of javascript's slice |
|
417 | + array_slice($selector->elements, $currentSelectorPathElementIndex, ($match['index']-$currentSelectorPathElementIndex)) // last parameter of array_slice is different than the last parameter of javascript's slice |
|
418 | 418 | , array($firstElement) |
419 | - , array_slice($replacementSelector->elements,1) |
|
419 | + , array_slice($replacementSelector->elements, 1) |
|
420 | 420 | ); |
421 | 421 | |
422 | - if( $currentSelectorPathIndex === $match['pathIndex'] && $matchIndex > 0 ){ |
|
422 | + if ($currentSelectorPathIndex===$match['pathIndex'] && $matchIndex>0) { |
|
423 | 423 | $last_key = count($path)-1; |
424 | - $path[$last_key]->elements = array_merge($path[$last_key]->elements,$newElements); |
|
425 | - }else{ |
|
426 | - $path = array_merge( $path, array_slice( $selectorPath, $currentSelectorPathIndex, $match['pathIndex'] )); |
|
427 | - $path[] = new Less_Tree_Selector( $newElements ); |
|
424 | + $path[$last_key]->elements = array_merge($path[$last_key]->elements, $newElements); |
|
425 | + }else { |
|
426 | + $path = array_merge($path, array_slice($selectorPath, $currentSelectorPathIndex, $match['pathIndex'])); |
|
427 | + $path[] = new Less_Tree_Selector($newElements); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | $currentSelectorPathIndex = $match['endPathIndex']; |
431 | 431 | $currentSelectorPathElementIndex = $match['endPathElementIndex']; |
432 | - if( $currentSelectorPathElementIndex >= count($selectorPath[$currentSelectorPathIndex]->elements) ){ |
|
432 | + if ($currentSelectorPathElementIndex>=count($selectorPath[$currentSelectorPathIndex]->elements)) { |
|
433 | 433 | $currentSelectorPathElementIndex = 0; |
434 | 434 | $currentSelectorPathIndex++; |
435 | 435 | } |
436 | 436 | } |
437 | 437 | |
438 | - if( $currentSelectorPathIndex < $selectorPath_len && $currentSelectorPathElementIndex > 0 ){ |
|
438 | + if ($currentSelectorPathIndex<$selectorPath_len && $currentSelectorPathElementIndex>0) { |
|
439 | 439 | $last_path = end($path); |
440 | - $last_path->elements = array_merge( $last_path->elements, array_slice($selectorPath[$currentSelectorPathIndex]->elements, $currentSelectorPathElementIndex)); |
|
440 | + $last_path->elements = array_merge($last_path->elements, array_slice($selectorPath[$currentSelectorPathIndex]->elements, $currentSelectorPathElementIndex)); |
|
441 | 441 | $currentSelectorPathIndex++; |
442 | 442 | } |
443 | 443 | |
444 | - $slice_len = $selectorPath_len - $currentSelectorPathIndex; |
|
444 | + $slice_len = $selectorPath_len-$currentSelectorPathIndex; |
|
445 | 445 | $path = array_merge($path, array_slice($selectorPath, $currentSelectorPathIndex, $slice_len)); |
446 | 446 | |
447 | 447 | return $path; |
448 | 448 | } |
449 | 449 | |
450 | 450 | |
451 | - protected function visitMedia( $mediaNode ){ |
|
452 | - $newAllExtends = array_merge( $mediaNode->allExtends, end($this->allExtendsStack) ); |
|
451 | + protected function visitMedia($mediaNode) { |
|
452 | + $newAllExtends = array_merge($mediaNode->allExtends, end($this->allExtendsStack)); |
|
453 | 453 | $this->allExtendsStack[] = $this->doExtendChaining($newAllExtends, $mediaNode->allExtends); |
454 | 454 | } |
455 | 455 | |
456 | - protected function visitMediaOut(){ |
|
457 | - array_pop( $this->allExtendsStack ); |
|
456 | + protected function visitMediaOut() { |
|
457 | + array_pop($this->allExtendsStack); |
|
458 | 458 | } |
459 | 459 | |
460 | - protected function visitDirective( $directiveNode ){ |
|
461 | - $newAllExtends = array_merge( $directiveNode->allExtends, end($this->allExtendsStack) ); |
|
460 | + protected function visitDirective($directiveNode) { |
|
461 | + $newAllExtends = array_merge($directiveNode->allExtends, end($this->allExtendsStack)); |
|
462 | 462 | $this->allExtendsStack[] = $this->doExtendChaining($newAllExtends, $directiveNode->allExtends); |
463 | 463 | } |
464 | 464 | |
465 | - protected function visitDirectiveOut(){ |
|
465 | + protected function visitDirectiveOut() { |
|
466 | 466 | array_pop($this->allExtendsStack); |
467 | 467 | } |
468 | 468 |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | try{ |
108 | 108 | $selectorOne = $extendsToAdd[0]->selfSelectors[0]->toCSS(); |
109 | 109 | $selectorTwo = $extendsToAdd[0]->selector->toCSS(); |
110 | - }catch(Exception $e){ |
|
110 | + } catch(Exception $e){ |
|
111 | 111 | $selectorOne = "{unable to calculate}"; |
112 | 112 | $selectorTwo = "{unable to calculate}"; |
113 | 113 | } |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | if( $currentSelectorPathIndex === $match['pathIndex'] && $matchIndex > 0 ){ |
423 | 423 | $last_key = count($path)-1; |
424 | 424 | $path[$last_key]->elements = array_merge($path[$last_key]->elements,$newElements); |
425 | - }else{ |
|
425 | + } else{ |
|
426 | 426 | $path = array_merge( $path, array_slice( $selectorPath, $currentSelectorPathIndex, $match['pathIndex'] )); |
427 | 427 | $path[] = new Less_Tree_Selector( $newElements ); |
428 | 428 | } |
@@ -6,43 +6,43 @@ discard block |
||
6 | 6 | * @package Less |
7 | 7 | * @subpackage visitor |
8 | 8 | */ |
9 | -class Less_VisitorReplacing extends Less_Visitor{ |
|
9 | +class Less_VisitorReplacing extends Less_Visitor { |
|
10 | 10 | |
11 | - public function visitObj( $node ){ |
|
11 | + public function visitObj($node) { |
|
12 | 12 | |
13 | 13 | $funcName = 'visit'.$node->type; |
14 | - if( isset($this->_visitFnCache[$funcName]) ){ |
|
14 | + if (isset($this->_visitFnCache[$funcName])) { |
|
15 | 15 | |
16 | 16 | $visitDeeper = true; |
17 | - $node = $this->$funcName( $node, $visitDeeper ); |
|
17 | + $node = $this->$funcName($node, $visitDeeper); |
|
18 | 18 | |
19 | - if( $node ){ |
|
20 | - if( $visitDeeper && is_object($node) ){ |
|
19 | + if ($node) { |
|
20 | + if ($visitDeeper && is_object($node)) { |
|
21 | 21 | $node->accept($this); |
22 | 22 | } |
23 | 23 | |
24 | - $funcName = $funcName . "Out"; |
|
25 | - if( isset($this->_visitFnCache[$funcName]) ){ |
|
26 | - $this->$funcName( $node ); |
|
24 | + $funcName = $funcName."Out"; |
|
25 | + if (isset($this->_visitFnCache[$funcName])) { |
|
26 | + $this->$funcName($node); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
30 | - }else{ |
|
30 | + }else { |
|
31 | 31 | $node->accept($this); |
32 | 32 | } |
33 | 33 | |
34 | 34 | return $node; |
35 | 35 | } |
36 | 36 | |
37 | - public function visitArray( $nodes ){ |
|
37 | + public function visitArray($nodes) { |
|
38 | 38 | |
39 | 39 | $newNodes = array(); |
40 | - foreach($nodes as $node){ |
|
40 | + foreach ($nodes as $node) { |
|
41 | 41 | $evald = $this->visitObj($node); |
42 | - if( $evald ){ |
|
43 | - if( is_array($evald) ){ |
|
44 | - self::flatten($evald,$newNodes); |
|
45 | - }else{ |
|
42 | + if ($evald) { |
|
43 | + if (is_array($evald)) { |
|
44 | + self::flatten($evald, $newNodes); |
|
45 | + }else { |
|
46 | 46 | $newNodes[] = $evald; |
47 | 47 | } |
48 | 48 | } |
@@ -50,18 +50,18 @@ discard block |
||
50 | 50 | return $newNodes; |
51 | 51 | } |
52 | 52 | |
53 | - public function flatten( $arr, &$out ){ |
|
53 | + public function flatten($arr, &$out) { |
|
54 | 54 | |
55 | - foreach($arr as $item){ |
|
56 | - if( !is_array($item) ){ |
|
55 | + foreach ($arr as $item) { |
|
56 | + if (!is_array($item)) { |
|
57 | 57 | $out[] = $item; |
58 | 58 | continue; |
59 | 59 | } |
60 | 60 | |
61 | - foreach($item as $nestedItem){ |
|
62 | - if( is_array($nestedItem) ){ |
|
63 | - self::flatten( $nestedItem, $out); |
|
64 | - }else{ |
|
61 | + foreach ($item as $nestedItem) { |
|
62 | + if (is_array($nestedItem)) { |
|
63 | + self::flatten($nestedItem, $out); |
|
64 | + }else { |
|
65 | 65 | $out[] = $nestedItem; |
66 | 66 | } |
67 | 67 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
30 | - }else{ |
|
30 | + } else{ |
|
31 | 31 | $node->accept($this); |
32 | 32 | } |
33 | 33 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | if( $evald ){ |
43 | 43 | if( is_array($evald) ){ |
44 | 44 | self::flatten($evald,$newNodes); |
45 | - }else{ |
|
45 | + } else{ |
|
46 | 46 | $newNodes[] = $evald; |
47 | 47 | } |
48 | 48 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | foreach($item as $nestedItem){ |
62 | 62 | if( is_array($nestedItem) ){ |
63 | 63 | self::flatten( $nestedItem, $out); |
64 | - }else{ |
|
64 | + } else{ |
|
65 | 65 | $out[] = $nestedItem; |
66 | 66 | } |
67 | 67 | } |
@@ -53,7 +53,7 @@ |
||
53 | 53 | */ |
54 | 54 | public function testNoopAction($action) { |
55 | 55 | $instance = new CoreContentController(); |
56 | - $actionMethod = $action . 'Action'; |
|
56 | + $actionMethod = $action.'Action'; |
|
57 | 57 | $result = $instance->$actionMethod(); |
58 | 58 | $this->assertNull($result); |
59 | 59 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $service->expects($this->once())->method('getDefaults')->willReturn($defaults); |
116 | 116 | $instance->injectConfigurationService($service); |
117 | 117 | $result = $this->callInaccessibleMethod($instance, 'getVariant', $row); |
118 | - $this->assertEquals(NULL === $expected ? $defaults['variant'] : $expected, $result); |
|
118 | + $this->assertEquals(NULL===$expected ? $defaults['variant'] : $expected, $result); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $service->expects($this->once())->method('getDefaults')->willReturn($defaults); |
131 | 131 | $instance->injectConfigurationService($service); |
132 | 132 | $result = $this->callInaccessibleMethod($instance, 'getVersion', $row); |
133 | - $this->assertEquals(NULL === $expected ? $defaults['version'] : $expected, $result); |
|
133 | + $this->assertEquals(NULL===$expected ? $defaults['version'] : $expected, $result); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -1,19 +1,19 @@ |
||
1 | 1 | <?php |
2 | 2 | // Register composer autoloader |
3 | -if (!file_exists(__DIR__ . '/../vendor/autoload.php')) { |
|
3 | +if (!file_exists(__DIR__.'/../vendor/autoload.php')) { |
|
4 | 4 | throw new \RuntimeException( |
5 | 5 | 'Could not find vendor/autoload.php, make sure you ran composer.' |
6 | 6 | ); |
7 | 7 | } |
8 | 8 | |
9 | 9 | /** @var Composer\Autoload\ClassLoader $autoloader */ |
10 | -$autoloader = require __DIR__ . '/../vendor/autoload.php'; |
|
11 | -$autoloader->addPsr4('FluidTYPO3\\FluidcontentCore\\Tests\\Fixtures\\', __DIR__ . '/Fixtures/'); |
|
12 | -$autoloader->addPsr4('FluidTYPO3\\FluidcontentCore\\Tests\\Unit\\', __DIR__ . '/Unit/'); |
|
13 | -$autoloader->addPsr4('TYPO3\\CMS\\Core\\', __DIR__ . '/../vendor/typo3/cms/typo3/sysext/core/Classes/'); |
|
14 | -$autoloader->addPsr4('TYPO3\\CMS\\Extbase\\', __DIR__ . '/../vendor/typo3/cms/typo3/sysext/extbase/Classes/'); |
|
15 | -$autoloader->addPsr4('TYPO3\\CMS\\Fluid\\', __DIR__ . '/../vendor/typo3/cms/typo3/sysext/fluid/Classes/'); |
|
16 | -$autoloader->addPsr4('TYPO3\\CMS\\Frontend\\', __DIR__ . '/../vendor/typo3/cms/typo3/sysext/frontend/Classes/'); |
|
10 | +$autoloader = require __DIR__.'/../vendor/autoload.php'; |
|
11 | +$autoloader->addPsr4('FluidTYPO3\\FluidcontentCore\\Tests\\Fixtures\\', __DIR__.'/Fixtures/'); |
|
12 | +$autoloader->addPsr4('FluidTYPO3\\FluidcontentCore\\Tests\\Unit\\', __DIR__.'/Unit/'); |
|
13 | +$autoloader->addPsr4('TYPO3\\CMS\\Core\\', __DIR__.'/../vendor/typo3/cms/typo3/sysext/core/Classes/'); |
|
14 | +$autoloader->addPsr4('TYPO3\\CMS\\Extbase\\', __DIR__.'/../vendor/typo3/cms/typo3/sysext/extbase/Classes/'); |
|
15 | +$autoloader->addPsr4('TYPO3\\CMS\\Fluid\\', __DIR__.'/../vendor/typo3/cms/typo3/sysext/fluid/Classes/'); |
|
16 | +$autoloader->addPsr4('TYPO3\\CMS\\Frontend\\', __DIR__.'/../vendor/typo3/cms/typo3/sysext/frontend/Classes/'); |
|
17 | 17 | |
18 | 18 | \FluidTYPO3\Development\Bootstrap::initialize(array( |
19 | 19 | 'fluid_template' => \FluidTYPO3\Development\Bootstrap::CACHE_PHP_NULL, |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$extensionPath = PATH_site . 'typo3conf/ext/moox_core/'; |
|
3 | +$extensionPath = PATH_site.'typo3conf/ext/moox_core/'; |
|
4 | 4 | return array( |
5 | - 'Less_Autoloader' => $extensionPath . 'Contrib/less.php/Autoloader.php', |
|
5 | + 'Less_Autoloader' => $extensionPath.'Contrib/less.php/Autoloader.php', |
|
6 | 6 | ); |