Passed
Push — master ( b5ca42...8fe651 )
by Siad
05:05
created

RunTargetTask::main()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
ccs 3
cts 4
cp 0.75
crap 2.0625
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
use Phing\Exception\BuildException;
21
use Phing\Task;
22
23
/**
24
 * Task that runs a target.
25
 *
26
 * @author  Siad Ardroumli <[email protected]>
27
 * @package phing.tasks.system
28
 */
29
class RunTargetTask extends Task
30
{
31
    /**
32
     * The target attribute
33
     *
34
     * @param string $target the name of a target to execute
35
     */
36 1
    public function setTarget($target)
37
    {
38 1
        $this->target = $target;
0 ignored issues
show
Documentation Bug introduced by
It seems like $target of type string is incompatible with the declared type Phing\Target of property $target.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
39 1
    }
40
41
    /**
42
     * execute the target
43
     *
44
     * @throws BuildException if a target is not specified
45
     */
46 1
    public function main()
47
    {
48 1
        if ($this->target == null) {
49
            throw new BuildException('target property required');
50
        }
51
52 1
        $this->getProject()->executeTarget($this->target);
53 1
    }
54
}
55