Total Complexity | 8 |
Total Lines | 59 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | abstract class CmdRunner { |
||
8 | |||
9 | /** |
||
10 | * @var Cmd |
||
11 | */ |
||
12 | private $cmd; |
||
13 | |||
14 | /** |
||
15 | * CmdRunner constructor. |
||
16 | * @param Cmd $cmd |
||
17 | */ |
||
18 | 20 | public function __construct(Cmd $cmd = null) { |
|
19 | 20 | if($cmd !== null) { |
|
20 | 3 | $this->cmd = $cmd; |
|
21 | 3 | return; |
|
22 | } |
||
23 | 20 | $this->cmd = Cmd::root(); |
|
24 | 20 | } |
|
25 | |||
26 | /** |
||
27 | * @return Cmd |
||
28 | */ |
||
29 | 4 | public function getCmd(): Cmd { |
|
31 | } |
||
32 | |||
33 | /** |
||
34 | * @param Cmd $cmd |
||
35 | */ |
||
36 | 20 | public function setCmd(Cmd $cmd): void { |
|
37 | 20 | $this->cmd = $cmd; |
|
38 | 20 | } |
|
39 | |||
40 | /** |
||
41 | * Run the cmd |
||
42 | */ |
||
43 | abstract public function run(): void; |
||
44 | |||
45 | |||
46 | public const EOL = "\n"; |
||
47 | |||
48 | |||
49 | 4 | public static function eol(): void { |
|
51 | 4 | } |
|
52 | |||
53 | 4 | public static function echo(string $str, ?string $foreground_color = null) : void { |
|
66 | } |
||
67 | } |