Passed
Push — main ( 28d658...6dddcc )
by Michiel
06:12
created

PhpDependLoggerElement::setType()   A

Complexity

Conditions 6
Paths 6

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 42

Importance

Changes 0
Metric Value
eloc 10
c 0
b 0
f 0
dl 0
loc 14
ccs 0
cts 10
cp 0
rs 9.2222
cc 6
nc 6
nop 1
crap 42
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\Task\Ext\Analyzer\Pdepend;
22
23
use Phing\Exception\BuildException;
24
use Phing\Io\File;
25
26
/**
27
 * Logger element for the PhpDependTask.
28
 *
29
 * @package phing.tasks.ext.pdepend
30
 * @author  Benjamin Schultz <[email protected]>
31
 * @since   2.4.1
32
 */
33
class PhpDependLoggerElement
34
{
35
    /**
36
     * The type of the logger.
37
     *
38
     * @var string
39
     */
40
    protected $type = '';
41
42
    /**
43
     * Output file for logger.
44
     *
45
     * @var File
46
     */
47
    protected $outfile = null;
48
49
    /**
50
     * Sets the logger type.
51
     *
52
     * @param string $type Type of the logger
53
     *
54
     * @throws BuildException
55
     */
56
    public function setType($type)
57
    {
58
        $this->type = $type;
59
60
        switch ($this->type) {
61
            case 'jdepend-chart':
62
            case 'jdepend-xml':
63
            case 'overview-pyramid':
64
            case 'phpunit-xml':
65
            case 'summary-xml':
66
                break;
67
68
            default:
69
                throw new BuildException('Logger "' . $this->type . '" not implemented');
70
        }
71
    }
72
73
    /**
74
     * Get the logger type
75
     *
76
     * @return string
77
     */
78
    public function getType()
79
    {
80
        return $this->type;
81
    }
82
83
    /**
84
     * Sets the output file for the logger results.
85
     *
86
     * @param File $outfile The output file
87
     */
88
    public function setOutfile(File $outfile)
89
    {
90
        $this->outfile = $outfile;
91
    }
92
93
    /**
94
     * Get the output file.
95
     *
96
     * @return File
97
     */
98
    public function getOutfile()
99
    {
100
        return $this->outfile;
101
    }
102
}
103