tequilarapido /
consolify
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Tequilarapido\Consolify\Progress; |
||
| 4 | |||
| 5 | use Symfony\Component\Console\Helper\ProgressBar; |
||
| 6 | |||
| 7 | /** |
||
| 8 | * Interface Progress. |
||
| 9 | * |
||
| 10 | * Wrapper for symfony console original progress bar. Add a way to persist |
||
| 11 | * progress bar information in a store (ie. Redis). |
||
| 12 | */ |
||
| 13 | interface Progress |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * Set the original symfony console bar. |
||
| 17 | * |
||
| 18 | * @param ProgressBar $bar |
||
| 19 | * |
||
| 20 | * @return mixed |
||
| 21 | */ |
||
| 22 | public function setProgressBar(ProgressBar $bar); |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Set uid. Used as identifier for persisting progress in redis for instance. |
||
| 26 | * |
||
| 27 | * @param string $uid |
||
| 28 | * |
||
| 29 | * @return mixed |
||
| 30 | */ |
||
| 31 | public function setUid($uid); |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Advance progress bar. |
||
| 35 | * |
||
| 36 | * @param int $step |
||
| 37 | * |
||
| 38 | * @return mixed |
||
| 39 | */ |
||
| 40 | public function advance($step = 1); |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Starts progress bar. |
||
| 44 | * |
||
| 45 | * @param null $max |
||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
| 46 | * |
||
| 47 | * @return mixed |
||
| 48 | */ |
||
| 49 | public function start($max = null); |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Set sleep mode state. |
||
| 53 | * |
||
| 54 | * @param SleepModeState $sleepModeState |
||
| 55 | * |
||
| 56 | * @return $this |
||
| 57 | */ |
||
| 58 | public function setSleepModeState(SleepModeState $sleepModeState); |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Returns progress informations as array. |
||
| 62 | * (what will be stored in Redis for instance). |
||
| 63 | * |
||
| 64 | * @return array |
||
| 65 | */ |
||
| 66 | public function summary(); |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Return persisted progress information from store. |
||
| 70 | * |
||
| 71 | * @return |
||
| 72 | */ |
||
| 73 | public function getPersisted(); |
||
| 74 | |||
| 75 | /** |
||
| 76 | * Delete persisted progress information from store. |
||
| 77 | */ |
||
| 78 | public function deletePersisted(); |
||
| 79 | |||
| 80 | /** |
||
| 81 | * Forward calls to original progress bar. |
||
| 82 | * |
||
| 83 | * @param $name |
||
| 84 | * @param $arguments |
||
| 85 | * |
||
| 86 | * @return mixed |
||
| 87 | */ |
||
| 88 | public function __call($name, $arguments); |
||
| 89 | } |
||
| 90 |