1 | <?php |
||
5 | abstract class Command |
||
6 | { |
||
7 | /** |
||
8 | * @var OptionsInterface |
||
9 | */ |
||
10 | private $options; |
||
11 | |||
12 | /** |
||
13 | * Execute the command using the current options. |
||
14 | * |
||
15 | * @return mixed |
||
16 | */ |
||
17 | abstract public function execute(); |
||
18 | |||
19 | /** |
||
20 | * Get the currently defined options. |
||
21 | * |
||
22 | * @return OptionsInterface |
||
23 | * |
||
24 | * @throws CommandException |
||
25 | * If no options have been added to the command. |
||
26 | */ |
||
27 | 2 | final public function options() |
|
35 | |||
36 | /** |
||
37 | * Get a copy with new options. |
||
38 | * |
||
39 | * @param OptionsInterface $options |
||
40 | * |
||
41 | * @return static |
||
42 | */ |
||
43 | 1 | final public function withOptions(OptionsInterface $options) |
|
50 | } |
||
51 |