Passed
Push — main ( b747fe...be0e2a )
by Siad
06:21
created

PhpCSTaskFormatterElement::getUseFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 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\Task\Optional;
22
23
use Phing\Exception\BuildException;
24
25
class PhpCSTaskFormatterElement extends \Phing\Type\DataType
26
{
27
    /**
28
     * Type of output to generate
29
     * @var string
30
     */
31
    protected $type = "";
32
33
    /**
34
     * Output to file?
35
     * @var bool
36
     */
37
    protected $useFile = true;
38
39
    /**
40
     * Output file.
41
     * @var string
42
     */
43
    protected $outfile = "";
44
45
    /**
46
     * Validate config.
47
     */
48
    public function parsingComplete()
49
    {
50
        if (empty($this->type)) {
51
            throw new BuildException("Format missing required 'type' attribute.");
52
        }
53
        if ($this->useFile && empty($this->outfile)) {
54
            throw new BuildException("Format requires 'outfile' attribute when 'useFile' is true.");
55
        }
56
    }
57
58 1
    public function setType($type)
59
    {
60 1
        $this->type = $type;
61 1
    }
62
63 1
    public function getType()
64
    {
65 1
        return $this->type;
66
    }
67
68
    public function setUseFile($useFile)
69
    {
70
        $this->useFile = $useFile;
71
    }
72
73 1
    public function getUseFile()
74
    {
75 1
        return $this->useFile;
76
    }
77
78 1
    public function setOutfile($outfile)
79
    {
80 1
        $this->outfile = $outfile;
81 1
    }
82
83 1
    public function getOutfile()
84
    {
85 1
        return $this->outfile;
86
    }
87
}
88