1 | <?php |
||
22 | abstract class AbstractCommand |
||
23 | { |
||
24 | const CONFIG_FILE = 'phpoole.yml'; |
||
25 | |||
26 | /** |
||
27 | * @var Console |
||
28 | */ |
||
29 | protected $console; |
||
30 | /** |
||
31 | * @var Route |
||
32 | */ |
||
33 | protected $route; |
||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $path; |
||
38 | /** |
||
39 | * @var PHPoole |
||
40 | */ |
||
41 | protected $phpoole; |
||
42 | /** |
||
43 | * @var Filesystem |
||
44 | */ |
||
45 | protected $fs; |
||
46 | /** |
||
47 | * @var ProgressBar |
||
48 | */ |
||
49 | protected $progressBar = null; |
||
50 | /** |
||
51 | * @var int |
||
52 | */ |
||
53 | protected $pbMax = 0; |
||
54 | |||
55 | /** |
||
56 | * Start command processing. |
||
57 | * |
||
58 | * @param Route $route |
||
59 | * @param Console $console |
||
60 | * |
||
61 | * @return mixed |
||
62 | */ |
||
63 | public function __invoke(Route $route, Console $console) |
||
78 | |||
79 | /** |
||
80 | * Process the command. |
||
81 | */ |
||
82 | abstract public function processCommand(); |
||
83 | |||
84 | /** |
||
85 | * @return Console |
||
86 | */ |
||
87 | public function getConsole() |
||
91 | |||
92 | /** |
||
93 | * @return Route |
||
94 | */ |
||
95 | public function getRoute() |
||
99 | |||
100 | /** |
||
101 | * @return string |
||
102 | */ |
||
103 | public function getPath() |
||
107 | |||
108 | /** |
||
109 | * @param int $start |
||
110 | * @param int $max |
||
111 | * |
||
112 | * @return ProgressBar |
||
113 | */ |
||
114 | protected function newPB($start, $max) |
||
128 | |||
129 | /** |
||
130 | * @return ProgressBar |
||
131 | */ |
||
132 | protected function getPB() |
||
136 | |||
137 | /** |
||
138 | * @param array $options |
||
139 | * |
||
140 | * @return PHPoole |
||
141 | */ |
||
142 | public function getPHPoole(array $options = []) |
||
191 | |||
192 | /** |
||
193 | * @param string $text |
||
194 | */ |
||
195 | public function wl($text) |
||
199 | |||
200 | /** |
||
201 | * @param string $text |
||
202 | */ |
||
203 | public function wlAnnonce($text) |
||
207 | |||
208 | /** |
||
209 | * @param $text |
||
210 | */ |
||
211 | public function wlDone($text) |
||
215 | |||
216 | /** |
||
217 | * @param string $text |
||
218 | */ |
||
219 | public function wlAlert($text) |
||
223 | |||
224 | /** |
||
225 | * @param $text |
||
226 | */ |
||
227 | public function wlError($text) |
||
231 | } |
||
232 |
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.