1 | <?php |
||
23 | abstract class AbstractCommand |
||
24 | { |
||
25 | const CONFIG_FILE = 'phpoole.yml'; |
||
26 | |||
27 | /** |
||
28 | * @var Console |
||
29 | */ |
||
30 | protected $console; |
||
31 | /** |
||
32 | * @var Route |
||
33 | */ |
||
34 | protected $route; |
||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $path; |
||
39 | /** |
||
40 | * @var PHPoole |
||
41 | */ |
||
42 | protected $phpoole; |
||
43 | /** |
||
44 | * @var Filesystem |
||
45 | */ |
||
46 | protected $fs; |
||
47 | /** |
||
48 | * @var ProgressBar |
||
49 | */ |
||
50 | protected $progressBar = null; |
||
51 | /** |
||
52 | * @var int |
||
53 | */ |
||
54 | protected $progressBarMax = 0; |
||
55 | /** |
||
56 | * @var bool |
||
57 | */ |
||
58 | protected $verbose = false; |
||
59 | /** |
||
60 | * @var bool |
||
61 | */ |
||
62 | protected $quiet = false; |
||
63 | |||
64 | /** |
||
65 | * Start command processing. |
||
66 | * |
||
67 | * @param Route $route |
||
68 | * @param Console $console |
||
69 | * |
||
70 | * @return mixed |
||
71 | */ |
||
72 | public function __invoke(Route $route, Console $console) |
||
94 | |||
95 | /** |
||
96 | * Process the command. |
||
97 | */ |
||
98 | abstract public function processCommand(); |
||
99 | |||
100 | /** |
||
101 | * @return Console |
||
102 | */ |
||
103 | public function getConsole() |
||
107 | |||
108 | /** |
||
109 | * @return Route |
||
110 | */ |
||
111 | public function getRoute() |
||
115 | |||
116 | /** |
||
117 | * @return string |
||
118 | */ |
||
119 | public function getPath() |
||
123 | |||
124 | /** |
||
125 | * @param int $start |
||
126 | * @param int $max |
||
127 | * |
||
128 | * @return ProgressBar |
||
129 | */ |
||
130 | protected function createProgressBar($start, $max) |
||
147 | |||
148 | /** |
||
149 | * @return ProgressBar |
||
150 | */ |
||
151 | protected function getProgressBar() |
||
155 | |||
156 | /** |
||
157 | * Print progress bar. |
||
158 | */ |
||
159 | protected function printProgressBar($itemsCount, $itemsMax, $message) |
||
168 | |||
169 | /** |
||
170 | * @param array $config |
||
171 | * @param array $options |
||
172 | * |
||
173 | * @return PHPoole |
||
174 | */ |
||
175 | public function getPHPoole( |
||
205 | |||
206 | /** |
||
207 | * Custom message callback function. |
||
208 | */ |
||
209 | public function messageCallback() |
||
240 | |||
241 | /** |
||
242 | * @param string $text |
||
243 | */ |
||
244 | public function wl($text) |
||
248 | |||
249 | /** |
||
250 | * @param string $text |
||
251 | */ |
||
252 | public function wlAnnonce($text) |
||
256 | |||
257 | /** |
||
258 | * @param string $text |
||
259 | */ |
||
260 | public function wlDone($text) |
||
264 | |||
265 | /** |
||
266 | * @param string $text |
||
267 | */ |
||
268 | public function wlAlert($text) |
||
272 | |||
273 | /** |
||
274 | * @param string $text |
||
275 | */ |
||
276 | public function wlError($text) |
||
280 | } |
||
281 |
For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a
@return
doc comment to communicate to implementors of these methods what they are expected to return.