1 | <?php |
||
8 | class ProgressIndicator |
||
9 | { |
||
10 | use Timer; |
||
11 | |||
12 | /** |
||
13 | * @var \Symfony\Component\Console\Helper\ProgressBar |
||
14 | */ |
||
15 | protected $progressBar; |
||
16 | |||
17 | /** |
||
18 | * @var \Symfony\Component\Console\Output\OutputInterface |
||
19 | */ |
||
20 | protected $output; |
||
21 | |||
22 | /** |
||
23 | * @var bool |
||
24 | */ |
||
25 | protected $progressIndicatorRunning = false; |
||
26 | |||
27 | /** |
||
28 | * @var int |
||
29 | */ |
||
30 | protected $autoDisplayInterval = 0; |
||
31 | |||
32 | /** |
||
33 | * @var int |
||
34 | */ |
||
35 | protected $cachedSteps = 0; |
||
36 | |||
37 | /** |
||
38 | * @var int |
||
39 | */ |
||
40 | protected $totalSteps = 0; |
||
41 | |||
42 | /** |
||
43 | * @var bool |
||
44 | */ |
||
45 | protected $progressBarDisplayed = false; |
||
46 | |||
47 | /** |
||
48 | * @var \Robo\Contract\TaskInterface |
||
49 | */ |
||
50 | protected $owner; |
||
51 | |||
52 | /** |
||
53 | * @param \Symfony\Component\Console\Helper\ProgressBar $progressBar |
||
54 | * @param \Symfony\Component\Console\Output\OutputInterface $output |
||
55 | */ |
||
56 | public function __construct($progressBar, \Symfony\Component\Console\Output\OutputInterface $output) |
||
61 | |||
62 | /** |
||
63 | * @param int $interval |
||
64 | */ |
||
65 | public function setProgressBarAutoDisplayInterval($interval) |
||
72 | |||
73 | /** |
||
74 | * @return bool |
||
75 | */ |
||
76 | public function hideProgressIndicator() |
||
87 | |||
88 | public function showProgressIndicator() |
||
96 | |||
97 | /** |
||
98 | * @param bool $visible |
||
99 | */ |
||
100 | public function restoreProgressIndicator($visible) |
||
106 | |||
107 | /** |
||
108 | * @param int $totalSteps |
||
109 | * @param \Robo\Contract\TaskInterface $owner |
||
110 | */ |
||
111 | public function startProgressIndicator($totalSteps, $owner) |
||
125 | |||
126 | public function autoShowProgressIndicator() |
||
137 | |||
138 | /** |
||
139 | * @return bool |
||
140 | */ |
||
141 | public function inProgress() |
||
145 | |||
146 | /** |
||
147 | * @param \Robo\Contract\TaskInterface $owner |
||
148 | */ |
||
149 | public function stopProgressIndicator($owner) |
||
155 | |||
156 | protected function cleanup() |
||
168 | |||
169 | /** |
||
170 | * Erase progress indicator and ensure it never returns. Used |
||
171 | * only during error handlers or to permanently remove the progress bar. |
||
172 | */ |
||
173 | public function disableProgressIndicator() |
||
180 | |||
181 | /** |
||
182 | * @param int $steps |
||
183 | */ |
||
184 | public function advanceProgressIndicator($steps = 1) |
||
196 | |||
197 | protected function advanceProgressIndicatorCachedSteps() |
||
202 | } |
||
203 |