Passed
Push — master ( fedd27...f10ad5 )
by Michiel
11:13
created

AbstractPHPLocFormatter   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 85
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 85
ccs 0
cts 30
cp 0
rs 10
c 0
b 0
f 0
wmc 8

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getOutfile() 0 3 1
A setToDir() 0 8 3
A getToDir() 0 3 1
A getUseFile() 0 3 1
A setUseFile() 0 3 1
A setOutfile() 0 3 1
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
 * @author Michiel Rook <[email protected]>
22
 * @package phing.tasks.ext.phploc
23
 */
24
abstract class AbstractPHPLocFormatter
25
{
26
    /**
27
     * @param array $count
28
     * @param bool $countTests
29
     * @return mixed
30
     */
31
    abstract public function printResult(array $count, $countTests = false);
32
33
    /**
34
     * @var bool
35
     */
36
    protected $useFile = true;
37
38
    /**
39
     * @var string
40
     */
41
    protected $toDir = ".";
42
43
    /**
44
     * @var string
45
     */
46
    protected $outfile = "";
47
48
    /**
49
     * Sets whether to store formatting results in a file
50
     *
51
     * @param $useFile
52
     */
53
    public function setUseFile($useFile)
54
    {
55
        $this->useFile = $useFile;
56
    }
57
58
    /**
59
     * Returns whether to store formatting results in a file
60
     */
61
    public function getUseFile()
62
    {
63
        return $this->useFile;
64
    }
65
66
    /**
67
     * Sets output directory
68
     *
69
     * @param string $toDir
70
     */
71
    public function setToDir($toDir)
72
    {
73
        if (!is_dir($toDir) && null !== $toDir) {
74
            $toDir = new PhingFile($toDir);
75
            $toDir->mkdirs();
76
        }
77
78
        $this->toDir = $toDir;
79
    }
80
81
    /**
82
     * Returns output directory
83
     *
84
     * @return string
85
     */
86
    public function getToDir()
87
    {
88
        return $this->toDir;
89
    }
90
91
    /**
92
     * Sets output filename
93
     *
94
     * @param string $outfile
95
     */
96
    public function setOutfile($outfile)
97
    {
98
        $this->outfile = $outfile;
99
    }
100
101
    /**
102
     * Returns output filename
103
     *
104
     * @return string
105
     */
106
    public function getOutfile()
107
    {
108
        return $this->outfile;
109
    }
110
}
111