| Total Complexity | 9 |
| Total Lines | 66 |
| 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 | 21 | public function __construct(Cmd $cmd = null) { |
|
| 19 | 21 | if($cmd !== null) { |
|
| 20 | 4 | $this->cmd = $cmd; |
|
| 21 | 4 | return; |
|
| 22 | } |
||
| 23 | 21 | $this->cmd = Cmd::root(); |
|
| 24 | 21 | } |
|
| 25 | |||
| 26 | /** |
||
| 27 | * @return Cmd |
||
| 28 | */ |
||
| 29 | 5 | public function getCmd(): Cmd { |
|
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param Cmd $cmd |
||
| 35 | */ |
||
| 36 | 21 | public function setCmd(Cmd $cmd): void { |
|
| 38 | 21 | } |
|
| 39 | |||
| 40 | /** |
||
| 41 | * Run the cmd |
||
| 42 | */ |
||
| 43 | abstract public function run(): void; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Overwrite this method for extended help |
||
| 47 | */ |
||
| 48 | 3 | public function help(): void { |
|
| 49 | |||
| 50 | 3 | } |
|
| 51 | |||
| 52 | |||
| 53 | public const EOL = "\n"; |
||
| 54 | |||
| 55 | |||
| 56 | 6 | public static function eol(): void { |
|
| 58 | 6 | } |
|
| 59 | |||
| 60 | 6 | public static function echo(string $str, ?string $foreground_color = null) : void { |
|
| 75 | } |