Navigation | Overlay |
---|---|
t Navigate files | h Toggle hits |
y Change url to tip of branch | m Toggle misses |
b / v Jump to prev/next hit line | p Toggle partial |
z / x Jump to prev/next missed or partial line | 1..9 Toggle flags |
shift + o Open current page in GitHub | a Toggle all on |
/ or ? Show keyboard shortcuts dialog | c Toggle context lines or commits |
1 |
<?php
|
|
2 |
/**
|
|
3 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
4 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
5 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
6 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
7 |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
8 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
9 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
10 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
11 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
12 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
13 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
14 |
*
|
|
15 |
* This software consists of voluntary contributions made by many individuals
|
|
16 |
* and is licensed under the LGPL. For more information please see
|
|
17 |
* <http://phing.info>.
|
|
18 |
*/
|
|
19 |
|
|
20 |
/**
|
|
21 |
* Track the current state of the Xml parse operation.
|
|
22 |
*
|
|
23 |
* @author Bryan Davis <bpd@keynetics.com>
|
|
24 |
* @package phing.parser
|
|
25 |
*/
|
|
26 |
class PhingXMLContext |
|
27 |
{
|
|
28 |
|
|
29 |
/**
|
|
30 |
* Target that will hold all tasks/types placed outside of targets
|
|
31 |
*
|
|
32 |
* @var Target
|
|
33 |
*/
|
|
34 |
private $implicitTarget; |
|
35 |
|
|
36 |
/**
|
|
37 |
* Current target
|
|
38 |
*
|
|
39 |
* @var Target
|
|
40 |
*/
|
|
41 |
private $currentTarget = null; |
|
42 |
|
|
43 |
/**
|
|
44 |
* List of current targets
|
|
45 |
*
|
|
46 |
* @var Target[]
|
|
47 |
*/
|
|
48 |
private $currentTargets = null; |
|
49 |
|
|
50 |
/** @var string */
|
|
51 |
private $currentProjectName; |
|
52 |
|
|
53 |
/**
|
|
54 |
* Constructor
|
|
55 |
*
|
|
56 |
* @param Project $project the project to which this antxml context belongs to
|
|
57 |
*/
|
|
58 | 1 |
public function __construct(Project $project) |
59 |
{
|
|
60 | 1 |
$this->project = $project; |
61 | 1 |
$this->implicitTarget = new Target(); |
62 | 1 |
$this->implicitTarget->setName(''); |
63 | 1 |
$this->implicitTarget->setHidden(true); |
64 |
}
|
|
65 |
|
|
66 |
/**
|
|
67 |
* The project to configure.
|
|
68 |
*/
|
|
69 |
private $project; |
|
70 |
|
|
71 |
private $configurators = []; |
|
72 |
|
|
73 |
/**
|
|
74 |
* @param $cfg
|
|
75 |
*/
|
|
76 | 1 |
public function startConfigure($cfg) |
77 |
{
|
|
78 | 1 |
$this->configurators[] = $cfg; |
79 |
}
|
|
80 |
|
|
81 | 1 |
public function endConfigure() |
82 |
{
|
|
83 | 1 |
array_pop($this->configurators); |
84 |
}
|
|
85 |
|
|
86 |
/**
|
|
87 |
* @return null
|
|
88 |
*/
|
|
89 | 1 |
public function getConfigurator() |
90 |
{
|
|
91 | 1 |
$l = count($this->configurators); |
92 | 1 |
if (0 == $l) { |
93 | 1 |
return null; |
94 |
}
|
|
95 |
|
|
96 |
return $this->configurators[$l - 1]; |
|
97 |
}
|
|
98 |
|
|
99 |
/**
|
|
100 |
* Impoerted files
|
|
101 |
*/
|
|
102 |
private $importStack = []; |
|
103 |
|
|
104 |
/**
|
|
105 |
* @param $file
|
|
106 |
*/
|
|
107 | 1 |
public function addImport($file) |
108 |
{
|
|
109 | 1 |
$this->importStack[] = $file; |
110 |
}
|
|
111 |
|
|
112 |
/**
|
|
113 |
* @return array
|
|
114 |
*/
|
|
115 | 1 |
public function &getImportStack() |
116 |
{
|
|
117 | 1 |
return $this->importStack; |
118 |
}
|
|
119 |
|
|
120 |
/** Impoerted files */
|
|
121 |
private $extensionPointStack = []; |
|
122 |
|
|
123 |
/**
|
|
124 |
* @param $file
|
|
125 |
*/
|
|
126 | 1 |
public function addExtensionPoint($elem) |
127 |
{
|
|
128 | 1 |
$this->extensionPointStack[] = $elem; |
129 |
}
|
|
130 |
|
|
131 |
/**
|
|
132 |
* @return array
|
|
133 |
*/
|
|
134 | 1 |
public function &getExtensionPointStack() |
135 |
{
|
|
136 | 1 |
return $this->extensionPointStack; |
137 |
}
|
|
138 |
|
|
139 |
/**
|
|
140 |
* find out the project to which this context belongs
|
|
141 |
*
|
|
142 |
* @return project
|
|
143 |
*/
|
|
144 |
public function getProject() |
|
145 |
{
|
|
146 |
return $this->project; |
|
147 |
}
|
|
148 |
|
|
149 |
/**
|
|
150 |
* find out the current project name
|
|
151 |
* @return string current project name
|
|
152 |
*/
|
|
153 |
public function getCurrentProjectName() |
|
154 |
{
|
|
155 |
return $this->currentProjectName; |
|
156 |
}
|
|
157 |
|
|
158 |
/**
|
|
159 |
* set the name of the current project
|
|
160 |
* @param string $name name of the current project
|
|
161 |
*/
|
|
162 |
public function setCurrentProjectName(string $name) |
|
163 |
{
|
|
164 |
$this->currentProjectName = $name; |
|
165 |
}
|
|
166 |
|
|
167 |
/**
|
|
168 |
* @return Target
|
|
169 |
*/
|
|
170 | 1 |
public function getImplicitTarget() |
171 |
{
|
|
172 | 1 |
return $this->implicitTarget; |
173 |
}
|
|
174 |
|
|
175 |
/**
|
|
176 |
* @param Target $target
|
|
177 |
*/
|
|
178 | 1 |
public function setImplicitTarget(Target $target) |
179 |
{
|
|
180 | 1 |
$this->implicitTarget = $target; |
181 |
}
|
|
182 |
|
|
183 |
/**
|
|
184 |
* @return Target
|
|
185 |
*/
|
|
186 |
public function getCurrentTarget() |
|
187 |
{
|
|
188 |
return $this->currentTarget; |
|
189 |
}
|
|
190 |
|
|
191 |
/**
|
|
192 |
* @param Target $target
|
|
193 |
*/
|
|
194 |
public function setCurrentTarget(Target $target) |
|
195 |
{
|
|
196 |
$this->currentTarget = $target; |
|
197 |
}
|
|
198 |
|
|
199 |
/**
|
|
200 |
* @return Target[]
|
|
201 |
*/
|
|
202 | 1 |
public function &getCurrentTargets() |
203 |
{
|
|
204 | 1 |
return $this->currentTargets; |
205 |
}
|
|
206 |
|
|
207 |
/**
|
|
208 |
* @param Target[] $currentTargets
|
|
209 |
*/
|
|
210 | 1 |
public function setCurrentTargets(array $currentTargets) |
211 |
{
|
|
212 | 1 |
$this->currentTargets = $currentTargets; |
213 |
}
|
|
214 |
}
|
Read our documentation on viewing source code .