| 1 | <?php |
||
| 24 | abstract class AbstractCommand extends Command |
||
| 25 | { |
||
| 26 | /** |
||
| 27 | * @var int |
||
| 28 | */ |
||
| 29 | protected $statusCode = 0; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @var Runtime Current Runtime instance |
||
| 33 | */ |
||
| 34 | protected $runtime; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Set the Runtime configuration |
||
| 38 | * |
||
| 39 | * @param Runtime $runtime Runtime container |
||
| 40 | * @return AbstractCommand |
||
| 41 | */ |
||
| 42 | public function setRuntime(Runtime $runtime) |
||
| 43 | { |
||
| 44 | $this->runtime = $runtime; |
||
| 45 | |||
| 46 | return $this; |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Logs a message |
||
| 51 | * |
||
| 52 | * @param string $message |
||
| 53 | * @param string $level |
||
| 54 | */ |
||
| 55 | public function log($message, $level = LogLevel::DEBUG) |
||
| 56 | { |
||
| 57 | $this->runtime->log($message, $level); |
||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Get the Human friendly Stage name |
||
| 62 | * |
||
| 63 | * @return string |
||
| 64 | */ |
||
| 65 | protected function getStageName() |
||
| 66 | { |
||
| 67 | $utils = new Utils(); |
||
| 68 | return $utils->getStageName($this->runtime->getStage()); |
||
| 69 | } |
||
| 70 | |||
| 71 | /** |
||
| 72 | * Requires the configuration to be loaded |
||
| 73 | */ |
||
| 74 | protected function requireConfig() |
||
| 81 | } |
||
| 82 |