Passed
Push — main ( c551fb...edb315 )
by Siad
06:32
created

FlattenMapper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 3
dl 0
loc 35
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setFrom() 0 2 1
A setTo() 0 2 1
A main() 0 5 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\Io\File;
24
25
/**
26
 * Removes any directory information from the passed path.
27
 *
28
 * @author  Andreas Aderhold <[email protected]>
29
 */
30
class FlattenMapper implements FileNameMapper
31
{
32
    /**
33
     * The mapper implementation. Returns string with source filename
34
     * but without leading directory information.
35
     *
36
     * @param string $sourceFileName The data the mapper works on
37
     *
38
     * @return array The data after the mapper has been applied
39
     */
40 1
    public function main($sourceFileName)
41
    {
42 1
        $f = new File($sourceFileName);
43
44 1
        return [$f->getName()];
45
    }
46
47
    /**
48
     * Ignored here.
49
     * {@inheritdoc}
50
     *
51
     * @param string $to
52
     */
53 1
    public function setTo($to)
54
    {
55 1
    }
56
57
    /**
58
     * Ignored here.
59
     * {@inheritdoc}
60
     *
61
     * @param string $from
62
     */
63 1
    public function setFrom($from)
64
    {
65 1
    }
66
}
67