1 | <?php |
||
37 | abstract class AbstractCommand extends Command |
||
38 | { |
||
39 | /** |
||
40 | * Input object |
||
41 | * |
||
42 | * @var \Symfony\Component\Console\Input\InputInterface |
||
43 | */ |
||
44 | protected $input; |
||
45 | |||
46 | /** |
||
47 | * Output object |
||
48 | * |
||
49 | * @var \Symfony\Component\Console\Output\OutputInterface |
||
50 | */ |
||
51 | protected $output; |
||
52 | |||
53 | /** |
||
54 | * Cached request object with desired secure flag |
||
55 | * |
||
56 | * @var \MageScan\Request |
||
57 | */ |
||
58 | protected $request; |
||
59 | |||
60 | /** |
||
61 | * Configure command |
||
62 | * |
||
63 | * @return void |
||
64 | */ |
||
65 | protected function configure() |
||
87 | |||
88 | /** |
||
89 | * Initialize command |
||
90 | * |
||
91 | * @param InputInterface $input |
||
92 | * @param OutputInterface $output |
||
93 | * |
||
94 | * @return void |
||
95 | */ |
||
96 | protected function initialize(InputInterface $input, OutputInterface $output) |
||
108 | |||
109 | /** |
||
110 | * Output information in the correct format |
||
111 | * |
||
112 | * @param string $title |
||
113 | * @param array|string $messages |
||
114 | * |
||
115 | * @return void |
||
116 | */ |
||
117 | protected function out($title, $messages = []) |
||
128 | |||
129 | /** |
||
130 | * Output in default format |
||
131 | * |
||
132 | * @param string $title |
||
133 | * @param array|string $messages |
||
134 | * |
||
135 | * @return void |
||
136 | */ |
||
137 | protected function outputFormatDefault($title, $messages) |
||
157 | |||
158 | /** |
||
159 | * Output in json format |
||
160 | * |
||
161 | * @param string $title |
||
162 | * @param array|string $messages |
||
163 | * |
||
164 | * @return void |
||
165 | */ |
||
166 | protected function outputFormatJson($title, $messages) |
||
197 | |||
198 | /** |
||
199 | * Write a header block |
||
200 | * |
||
201 | * @param string $text |
||
202 | * @param string $style |
||
203 | * |
||
204 | * @return void |
||
205 | */ |
||
206 | protected function writeHeader($text, $style = 'bg=blue;fg=white') |
||
215 | } |
||
216 |