|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace LesserPhp; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* lesserphp |
|
7
|
|
|
* https://www.maswaba.de/lesserphp |
|
8
|
|
|
* |
|
9
|
|
|
* LESS CSS compiler, adapted from http://lesscss.org |
|
10
|
|
|
* |
|
11
|
|
|
* Copyright 2013, Leaf Corcoran <[email protected]> |
|
12
|
|
|
* Copyright 2016, Marcus Schwarz <[email protected]> |
|
13
|
|
|
* Licensed under MIT or GPLv3, see LICENSE |
|
14
|
|
|
* @package LesserPhp |
|
15
|
|
|
*/ |
|
16
|
|
|
class NodeEnv |
|
17
|
|
|
{ |
|
18
|
|
|
public $seenNames; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @var \LesserPhp\NodeEnv |
|
22
|
|
|
*/ |
|
23
|
|
|
private $parent; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @var array |
|
27
|
|
|
*/ |
|
28
|
|
|
private $store = []; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @var \stdClass |
|
32
|
|
|
*/ |
|
33
|
|
|
private $block; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @var array|null |
|
37
|
|
|
*/ |
|
38
|
|
|
private $selectors; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @var array|null |
|
42
|
|
|
*/ |
|
43
|
|
|
private $arguments = []; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @var array |
|
47
|
|
|
*/ |
|
48
|
|
|
private $imports = []; |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @return \LesserPhp\NodeEnv |
|
52
|
|
|
*/ |
|
53
|
49 |
|
public function getParent() |
|
54
|
|
|
{ |
|
55
|
49 |
|
return $this->parent; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @param \LesserPhp\NodeEnv $parent |
|
60
|
|
|
*/ |
|
61
|
49 |
|
public function setParent($parent) |
|
62
|
|
|
{ |
|
63
|
49 |
|
$this->parent = $parent; |
|
64
|
49 |
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @return array |
|
68
|
|
|
*/ |
|
69
|
28 |
|
public function getStore() |
|
70
|
|
|
{ |
|
71
|
28 |
|
return $this->store; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @param array $store |
|
76
|
|
|
*/ |
|
77
|
49 |
|
public function setStore($store) |
|
78
|
|
|
{ |
|
79
|
49 |
|
$this->store = $store; |
|
80
|
49 |
|
} |
|
81
|
|
|
|
|
82
|
27 |
|
/** |
|
83
|
|
|
* @param string $index |
|
84
|
27 |
|
* @param $value |
|
85
|
27 |
|
*/ |
|
86
|
|
|
public function addStore($index, $value) |
|
87
|
|
|
{ |
|
88
|
|
|
$this->store[$index] = $value; |
|
89
|
|
|
} |
|
90
|
3 |
|
|
|
91
|
|
|
/** |
|
92
|
3 |
|
* @return \stdClass |
|
93
|
|
|
*/ |
|
94
|
|
|
public function getBlock() |
|
95
|
|
|
{ |
|
96
|
|
|
return $this->block; |
|
97
|
|
|
} |
|
98
|
49 |
|
|
|
99
|
|
|
/** |
|
100
|
49 |
|
* @param string $block |
|
101
|
49 |
|
*/ |
|
102
|
|
|
public function setBlock($block) |
|
103
|
|
|
{ |
|
104
|
|
|
$this->block = $block; |
|
|
|
|
|
|
105
|
|
|
} |
|
106
|
46 |
|
|
|
107
|
|
|
/** |
|
108
|
46 |
|
* @return array |
|
109
|
|
|
*/ |
|
110
|
|
|
public function getSelectors() |
|
111
|
|
|
{ |
|
112
|
|
|
return $this->selectors; |
|
113
|
|
|
} |
|
114
|
46 |
|
|
|
115
|
|
|
/** |
|
116
|
46 |
|
* @param array $selectors |
|
117
|
46 |
|
*/ |
|
118
|
|
|
public function setSelectors($selectors) |
|
119
|
|
|
{ |
|
120
|
|
|
$this->selectors = $selectors; |
|
121
|
|
|
} |
|
122
|
3 |
|
|
|
123
|
|
|
/** |
|
124
|
3 |
|
* @return mixed |
|
125
|
|
|
*/ |
|
126
|
|
|
public function getArguments() |
|
127
|
|
|
{ |
|
128
|
|
|
return $this->arguments; |
|
129
|
|
|
} |
|
130
|
16 |
|
|
|
131
|
|
|
/** |
|
132
|
16 |
|
* @param mixed $arguments |
|
133
|
16 |
|
*/ |
|
134
|
|
|
public function setArguments($arguments) |
|
135
|
|
|
{ |
|
136
|
|
|
$this->arguments = $arguments; |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
/** |
|
140
|
3 |
|
* @param null $index |
|
141
|
|
|
* |
|
142
|
3 |
|
* @return array |
|
143
|
|
|
*/ |
|
144
|
|
|
public function getImports($index = null) |
|
145
|
3 |
|
{ |
|
146
|
|
|
if ($index === null) { |
|
147
|
|
|
return $this->imports; |
|
148
|
|
|
} |
|
149
|
|
|
return $this->imports[$index]; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* @param string $index |
|
154
|
|
|
* @param $value |
|
155
|
|
|
*/ |
|
156
|
3 |
|
public function addImports($index, $value) |
|
157
|
|
|
{ |
|
158
|
3 |
|
$this->imports[$index] = $value; |
|
159
|
3 |
|
} |
|
160
|
|
|
} |
|
161
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..