1 | <?php |
||
20 | abstract class AbstractCommand extends Command |
||
21 | { |
||
22 | /** |
||
23 | * @var array configuration settings for the application. |
||
24 | */ |
||
25 | protected $configuration; |
||
26 | |||
27 | /** @var StepInterface[] */ |
||
28 | protected $steps; |
||
29 | |||
30 | /** @var string */ |
||
31 | protected $message; |
||
32 | |||
33 | /** |
||
34 | * Constructor. |
||
35 | * |
||
36 | * @param Configuration $configuration current application configuration loader. |
||
37 | * @param string|null $name The name of the command; |
||
38 | * passing null means it must be set in configure() |
||
39 | * |
||
40 | */ |
||
41 | 6 | public function __construct(Configuration $configuration, $name = null) |
|
47 | |||
48 | /** |
||
49 | * Executes the current command. |
||
50 | * |
||
51 | * @param InputInterface $input An InputInterface instance |
||
52 | * @param OutputInterface $output Output of the command |
||
53 | * |
||
54 | * @return void |
||
55 | */ |
||
56 | 1 | protected function execute(InputInterface $input, OutputInterface $output) |
|
66 | |||
67 | /** |
||
68 | * Provides the previous defined message. |
||
69 | * |
||
70 | * @return string |
||
71 | * |
||
72 | * @throws \LogicException in case no message was set. |
||
73 | */ |
||
74 | 1 | public function getStartMessage() |
|
82 | |||
83 | /** |
||
84 | * Set the content of the start message. |
||
85 | * |
||
86 | * @param string $message Start message. |
||
87 | * |
||
88 | * @return $this |
||
89 | */ |
||
90 | 1 | public function setStartMessage($message) |
|
91 | { |
||
92 | 1 | $this->message = $message; |
|
93 | |||
94 | 1 | return $this; |
|
95 | 1 | } |
|
96 | |||
97 | /** |
||
98 | * Provides the defined |
||
99 | * |
||
100 | * @return StepInterface[] |
||
101 | * |
||
102 | * @throws \LogicException in case no step was set. |
||
103 | */ |
||
104 | public function getStep() |
||
112 | |||
113 | /** |
||
114 | * Adds a step to the set of steps to be executed. |
||
115 | * |
||
116 | * @param StepInterface $step Step to be executed |
||
117 | * |
||
118 | * @return $this |
||
119 | */ |
||
120 | 1 | public function addStep(StepInterface $step) |
|
126 | } |
||
127 |