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
 * FilterChain may contain a chained set of filter readers.
22
 *
23
 * @author  Yannick Lecaillez <yl@seasonfive.com>
24
 * @package phing.types
25
 */
26
class FilterChain extends DataType
27
{
28
    private $filterReaders = [];
29

30
    /**
31
     * @param null $project
32
     */
33 1
    public function __construct($project = null)
34
    {
35 1
        parent::__construct();
36

37 1
        if ($project) {
38 0
            $this->project = $project;
39
        }
40
    }
41

42
    /**
43
     * @return array
44
     */
45 1
    public function getFilterReaders()
46
    {
47 1
        return $this->filterReaders;
48
    }
49

50
    /**
51
     * @param ConcatFilter $o
52
     */
53 1
    public function addConcatFilter(ConcatFilter $o)
54
    {
55 1
        $this->add($o);
56
    }
57

58
    /**
59
     * @param ExpandProperties $o
60
     */
61 1
    public function addExpandProperties(ExpandProperties $o)
62
    {
63 1
        $this->add($o);
64
    }
65

66
    /**
67
     * @param TranslateGettext $o
68
     */
69 0
    public function addGettext(TranslateGettext $o)
70
    {
71 0
        $this->add($o);
72
    }
73

74
    /**
75
     * @param HeadFilter $o
76
     */
77 1
    public function addHeadFilter(HeadFilter $o)
78
    {
79 1
        $this->add($o);
80
    }
81

82
    /**
83
     * @param IconvFilter $o
84
     */
85 0
    public function addIconvFilter(IconvFilter $o)
86
    {
87 0
        $this->add($o);
88
    }
89

90
    /**
91
     * @param TailFilter $o
92
     */
93 1
    public function addTailFilter(TailFilter $o)
94
    {
95 1
        $this->add($o);
96
    }
97

98
    /**
99
     * @param LineContains $o
100
     */
101 1
    public function addLineContains(LineContains $o)
102
    {
103 1
        $this->add($o);
104
    }
105

106
    /**
107
     * @param LineContainsRegexp $o
108
     */
109 0
    public function addLineContainsRegExp(LineContainsRegexp $o)
110
    {
111 0
        $this->add($o);
112
    }
113

114
    /**
115
     * @param PrefixLines $o
116
     */
117 0
    public function addPrefixLines(PrefixLines $o)
118
    {
119 0
        $this->add($o);
120
    }
121

122
    /**
123
     * @param SuffixLines $o
124
     */
125 0
    public function addSuffixLines(SuffixLines $o)
126
    {
127 0
        $this->add($o);
128
    }
129

130
    /**
131
     * @param PrefixLines $o
132
     */
133 0
    public function addEscapeUnicode(EscapeUnicode $o)
134
    {
135 0
        $this->add($o);
136
    }
137

138
    /**
139
     * @param PhpArrayMapLines $o
140
     */
141 0
    public function addPhpArrayMapLines(PhpArrayMapLines $o)
142
    {
143 0
        $this->add($o);
144
    }
145

146
    /**
147
     * @param ReplaceTokens $o
148
     */
149 1
    public function addReplaceTokens(ReplaceTokens $o)
150
    {
151 1
        $this->add($o);
152
    }
153

154
    /**
155
     * @param ReplaceTokensWithFile $o
156
     */
157 1
    public function addReplaceTokensWithFile(ReplaceTokensWithFile $o)
158
    {
159 1
        $this->add($o);
160
    }
161

162
    /**
163
     * @param ReplaceRegexp $o
164
     */
165 1
    public function addReplaceRegexp(ReplaceRegexp $o)
166
    {
167 1
        $this->add($o);
168
    }
169

170
    /**
171
     * @param StripPhpComments $o
172
     */
173 1
    public function addStripPhpComments(StripPhpComments $o)
174
    {
175 1
        $this->add($o);
176
    }
177

178
    /**
179
     * @param StripLineBreaks $o
180
     */
181 1
    public function addStripLineBreaks(StripLineBreaks $o)
182
    {
183 1
        $this->add($o);
184
    }
185

186
    /**
187
     * @param StripLineComments $o
188
     */
189 0
    public function addStripLineComments(StripLineComments $o)
190
    {
191 0
        $this->add($o);
192
    }
193

194
    /**
195
     * @param StripWhitespace $o
196
     */
197 1
    public function addStripWhitespace(StripWhitespace $o)
198
    {
199 1
        $this->add($o);
200
    }
201

202
    /**
203
     * @param TidyFilter $o
204
     */
205 0
    public function addTidyFilter(TidyFilter $o)
206
    {
207 0
        $this->add($o);
208
    }
209

210
    /**
211
     * @param TabToSpaces $o
212
     */
213 0
    public function addTabToSpaces(TabToSpaces $o)
214
    {
215 0
        $this->add($o);
216
    }
217

218
    /**
219
     * @param XincludeFilter $o
220
     */
221 0
    public function addXincludeFilter(XincludeFilter $o)
222
    {
223 0
        $this->add($o);
224
    }
225

226
    /**
227
     * @param XsltFilter $o
228
     */
229 0
    public function addXsltFilter(XsltFilter $o)
230
    {
231 0
        $this->add($o);
232
    }
233

234
    /**
235
     * @param PhingFilterReader $o
236
     */
237 1
    public function addFilterReader(PhingFilterReader $o)
238
    {
239 1
        $o->setProject($this->project);
240 1
        $this->filterReaders[] = $o;
241
    }
242

243
    /**
244
     * @param SortFilter $o
245
     */
246 1
    public function addSortFilter(SortFilter $o)
247
    {
248 1
        $this->add($o);
249
    }
250

251
    /**
252
     * @param ClassConstants $o
253
     */
254 1
    public function addClassConstants(ClassConstants $o)
255
    {
256 1
        $this->add($o);
257
    }
258

259 1
    private function add(BaseFilterReader $o)
260
    {
261 1
        $o->setProject($this->project);
262 1
        $this->filterReaders[] = $o;
263
    }
264

265
    /*
266
     * Makes this instance in effect a reference to another FilterChain
267
     * instance.
268
     *
269
     * <p>You must not set another attribute or nest elements inside
270
     * this element if you make it a reference.</p>
271
     *
272
     * @param  $r the reference to which this instance is associated
273
     * @throws BuildException if this instance already has been configured.
274
    */
275
    /**
276
     * @param Reference $r
277
     * @throws BuildException
278
     */
279 0
    public function setRefid(Reference $r)
280
    {
281 0
        if (count($this->filterReaders) !== 0) {
282 0
            throw $this->tooManyAttributes();
283
        }
284

285
        // change this to get the objects from the other reference
286 0
        $o = $r->getReferencedObject($this->getProject());
287 0
        if ($o instanceof FilterChain) {
288 0
            $this->filterReaders = $o->getFilterReaders();
289
        } else {
290 0
            throw new BuildException($r->getRefId() . " doesn't refer to a FilterChain");
291
        }
292 0
        parent::setRefid($r);
293
    }
294
}

Read our documentation on viewing source code .

Loading