Passed
Push — main ( 01fb06...c551fb )
by Siad
06:07
created

DispatchTask   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 32
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getAction() 0 3 1
A getActionParameterName() 0 3 1
A setAction() 0 3 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\Dispatch;
22
23
use Phing\Task;
24
25
/**
26
 * Tasks extending this class may contain multiple actions.
27
 * The method that is invoked for execution depends upon the
28
 * value of the action attribute of the task.
29
 * <br>
30
 * Example:<br>
31
 * &lt;mytask action=&quot;list&quot;/&gt; will invoke the method
32
 * with the signature public function list() in mytask's class.
33
 * If the action attribute is not defined in the task or is empty,
34
 * the main() method will be called.
35
 *
36
 * @author  Siad Ardroumli <[email protected]>
37
 */
38
abstract class DispatchTask extends Task implements Dispatchable
39
{
40
    private $action;
41
42
    /**
43
     * Get the action parameter name.
44
     *
45
     * @return string the <code>String</code> "action" by default (can be overridden)
46
     */
47 1
    public function getActionParameterName()
48
    {
49 1
        return 'action';
50
    }
51
52
    /**
53
     * Set the action.
54
     *
55
     * @param string $action the method name
56
     */
57 1
    public function setAction($action)
58
    {
59 1
        $this->action = $action;
60 1
    }
61
62
    /**
63
     * Get the action.
64
     *
65
     * @return string the action
66
     */
67 1
    public function getAction()
68
    {
69 1
        return $this->action;
70
    }
71
}
72