1 | <?php |
||
19 | class ExtendNode extends Node |
||
20 | { |
||
21 | /** |
||
22 | * Node type. |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $type = 'Extend'; |
||
27 | |||
28 | /** |
||
29 | * The selector. |
||
30 | * |
||
31 | * @var SelectorNode |
||
32 | */ |
||
33 | public $selector; |
||
34 | |||
35 | /** |
||
36 | * The option (all). |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | public $option; |
||
41 | |||
42 | /** |
||
43 | * Current index. |
||
44 | * |
||
45 | * @var int |
||
46 | */ |
||
47 | public $index = 0; |
||
48 | |||
49 | /** |
||
50 | * Allow before flag. |
||
51 | * |
||
52 | * @var bool |
||
53 | */ |
||
54 | public $allowBefore = false; |
||
55 | |||
56 | /** |
||
57 | * Allow after flag. |
||
58 | * |
||
59 | * @var bool |
||
60 | */ |
||
61 | public $allowAfter = false; |
||
62 | |||
63 | /** |
||
64 | * Array of self selectors. |
||
65 | * |
||
66 | * @var array |
||
67 | */ |
||
68 | public $selfSelectors = []; |
||
69 | |||
70 | /** |
||
71 | * First extend on this path flag. |
||
72 | * |
||
73 | * @var bool |
||
74 | * |
||
75 | * @see Visitor_ExtendFinder::visitRuleset |
||
76 | */ |
||
77 | public $firstExtendOnThisSelectorPath = false; |
||
78 | |||
79 | /** |
||
80 | * The ruleset. |
||
81 | * |
||
82 | * @var RulesetNode |
||
83 | */ |
||
84 | public $ruleset; |
||
85 | |||
86 | /** |
||
87 | * @var int |
||
88 | */ |
||
89 | public static $nextId = 0; |
||
90 | |||
91 | /** |
||
92 | * @var int |
||
93 | */ |
||
94 | public $objectId = 0; |
||
95 | |||
96 | /** |
||
97 | * @var bool |
||
98 | */ |
||
99 | public $hasFoundMatches = false; |
||
100 | |||
101 | /** |
||
102 | * Constructor. |
||
103 | * |
||
104 | * @param SelectorNode $selector The selector |
||
105 | * @param string $option The option |
||
106 | * @param int $index The index |
||
107 | */ |
||
108 | public function __construct(SelectorNode $selector, $option, $index = 0) |
||
127 | |||
128 | /** |
||
129 | * @var array |
||
130 | */ |
||
131 | public $parentIds = []; |
||
132 | |||
133 | /** |
||
134 | * {@inheritdoc} |
||
135 | */ |
||
136 | public function accept(VisitorInterface $visitor) |
||
140 | |||
141 | /** |
||
142 | * Compiles the node. |
||
143 | * |
||
144 | * @param Context $context The context |
||
145 | * @param array|null $arguments Array of arguments |
||
146 | * @param bool|null $important Important flag |
||
147 | * |
||
148 | * @return ExtendNode |
||
149 | */ |
||
150 | public function compile(Context $context, $arguments = null, $important = null) |
||
154 | |||
155 | /** |
||
156 | * Finds selectors. |
||
157 | * |
||
158 | * @param array $selectors Array of ILess\ILess\Node\SelectorNode instances |
||
159 | */ |
||
160 | public function findSelfSelectors($selectors) |
||
175 | } |
||
176 |
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: