| 1 | <?php namespace Lanin\Laravel\SetupWizard\Commands\Steps; |
||
| 5 | abstract class AbstractStep |
||
| 6 | { |
||
| 7 | const REPEATS = 3; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * @var int |
||
| 11 | */ |
||
| 12 | protected $repeats = 1; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var Command |
||
| 16 | */ |
||
| 17 | protected $command; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Create a new Step. |
||
| 21 | * |
||
| 22 | * @param Command $command |
||
| 23 | */ |
||
| 24 | 78 | public function __construct(Command $command) |
|
| 28 | |||
| 29 | /** |
||
| 30 | * Run step. |
||
| 31 | * |
||
| 32 | * @param bool $pretend |
||
| 33 | * @return mixed |
||
| 34 | */ |
||
| 35 | 15 | public function run($pretend = false) |
|
| 57 | |||
| 58 | /** |
||
| 59 | * Repeat step. |
||
| 60 | * |
||
| 61 | * @return bool |
||
| 62 | */ |
||
| 63 | 9 | public function repeat() |
|
| 79 | |||
| 80 | /** |
||
| 81 | * Transform associative array to use in command->table() method. |
||
| 82 | * |
||
| 83 | * @param array $array |
||
| 84 | * @return array |
||
| 85 | */ |
||
| 86 | 6 | protected function arrayToTable(array $array) |
|
| 92 | |||
| 93 | /** |
||
| 94 | * Return command prompt text. |
||
| 95 | * |
||
| 96 | * @return string |
||
| 97 | */ |
||
| 98 | abstract public function prompt(); |
||
| 99 | |||
| 100 | /** |
||
| 101 | * Prepare step data. |
||
| 102 | * |
||
| 103 | * @return mixed |
||
| 104 | */ |
||
| 105 | abstract public function prepare(); |
||
| 106 | |||
| 107 | /** |
||
| 108 | * Preview results. |
||
| 109 | * |
||
| 110 | * @param mixed $results |
||
| 111 | * @return void |
||
| 112 | */ |
||
| 113 | abstract public function preview($results); |
||
| 114 | |||
| 115 | /** |
||
| 116 | * Finish step. |
||
| 117 | * |
||
| 118 | * @param mixed $results |
||
| 119 | * @return bool |
||
| 120 | */ |
||
| 121 | abstract public function finish($results); |
||
| 122 | } |
||
| 123 |