Passed
Push — master ( fa7991...10a1b7 )
by 世昌
02:08
created

RunnableTarget::getParameter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace nebula\runnable\target;
3
4
/**
5
 * 可执行命令表目标
6
 *
7
 */
8
abstract class RunnableTarget  {
9
10
    /**
11
     * Get 可执行对象
12
     *
13
     * @return  mixed
14
     */ 
15
    abstract public function getRunnableTarget();
16
    /**
17
     * 是否可执行
18
     *
19
     * @return boolean
20
     */
21
    abstract public function isVaild():bool;
22
    /**
23
     * 执行代码
24
     *
25
     * @param array $parameter
26
     * @return mixed
27
     */
28
    abstract public function invoke(array $parameter);
29
30
    /**
31
     * 执行代码
32
     *
33
     * @param mixed ...$args
34
     * @return mixed
35
     */
36
    public function run(...$args) {
37
        return $this->invoke($args);
38
    }
39
40
    /**
41
     * Get 执行参数
42
     *
43
     * @return  array
44
     */ 
45
    public function getParameter()
46
    {
47
        return $this->parameter;
48
    }
49
50
    /**
51
     * Set 执行参数
52
     *
53
     * @param  array  $parameter  执行参数
54
     *
55
     * @return  self
56
     */ 
57
    public function setParameter(array $parameter)
58
    {
59
        $this->parameter = $parameter;
0 ignored issues
show
Bug Best Practice introduced by
The property parameter does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
60
61
        return $this;
62
    }
63
64
    /**
65
     * Get 可执行命令字符串表示
66
     *
67
     * @return  string
68
     */ 
69
    public function getName()
70
    {
71
        return $this->name;
72
    }
73
74
    /**
75
     * Set 可执行命令字符串表示
76
     *
77
     * @param  string  $name  可执行命令字符串表示
78
     *
79
     * @return  self
80
     */ 
81
    public function setName(string $name)
82
    {
83
        $this->name = $name;
0 ignored issues
show
Bug Best Practice introduced by
The property name does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
84
85
        return $this;
86
    }
87
88
}