MergeMapper::main()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
/**
4
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
 *
16
 * This software consists of voluntary contributions made by many individuals
17
 * and is licensed under the LGPL. For more information please see
18
 * <http://phing.info>.
19
 */
20
21
namespace Phing\Mapper;
22
23
use Phing\Exception\BuildException;
24
25
/**
26
 * For merging files into a single file.  In practice just returns whatever value
27
 * was set for "to".
28
 *
29
 * @author  Andreas Aderhold <[email protected]>
30
 */
31
class MergeMapper implements FileNameMapper
32
{
33
    /**
34
     * the merge.
35
     */
36
    private $mergedFile;
37
38
    /**
39
     * The mapper implementation. Basically does nothing in this case.
40
     *
41
     * @param mixed $sourceFileName The data the mapper works on
42
     *
43
     * @throws BuildException
44
     *
45
     * @return mixed The data after the mapper has been applied
46
     *
47
     * @author Andreas Aderhold, [email protected]
48
     */
49
    public function main($sourceFileName)
50
    {
51
        if (null === $this->mergedFile) {
52
            throw new BuildException('MergeMapper error, to attribute not set');
53
        }
54
55
        return [$this->mergedFile];
56
    }
57
58
    /**
59
     * Accessor. Sets the to property.
60
     *
61
     * @param string     To what this mapper should convert the from string
0 ignored issues
show
Bug introduced by
The type Phing\Mapper\To was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
62
     * @param mixed $to
63
     *
64
     * @author Andreas Aderhold, [email protected]
65
     */
66
    public function setTo($to)
67
    {
68
        $this->mergedFile = $to;
69
    }
70
71
    /**
72
     * Ignored.
73
     *
74
     * @param string $from
75
     */
76
    public function setFrom($from)
77
    {
78
    }
79
}
80