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
 * For merging files into a single file.  In practice just returns whatever value
22
 * was set for "to".
23
 *
24
 * @author  Andreas Aderhold <andi@binarycloud.com>
25
 * @package phing.mappers
26
 */
27
class MergeMapper implements FileNameMapper
28
{
29

30
    /**
31
     * the merge
32
     */
33
    private $mergedFile;
34

35
    /**
36
     * The mapper implementation. Basically does nothing in this case.
37
     *
38
     * @param  mixed $sourceFileName The data the mapper works on
39
     * @throws BuildException
40
     * @return mixed The data after the mapper has been applied
41
     * @author Andreas Aderhold, andi@binarycloud.com
42
     */
43 1
    public function main($sourceFileName)
44
    {
45 1
        if ($this->mergedFile === null) {
46 0
            throw new BuildException("MergeMapper error, to attribute not set");
47
        }
48

49 1
        return [$this->mergedFile];
50
    }
51

52
    /**
53
     * Accessor. Sets the to property
54
     *
55
     * @param  string     To what this mapper should convert the from string
56
     * @return boolean True
57
     * @author Andreas Aderhold, andi@binarycloud.com
58
     */
59 1
    public function setTo($to)
60
    {
61 1
        $this->mergedFile = $to;
62
    }
63

64
    /**
65
     * Ignored.
66
     *
67
     * @param string $from
68
     */
69 1
    public function setFrom($from)
70
    {
71
    }
72
}

Read our documentation on viewing source code .

Loading