1 | <?php |
||
15 | trait HelpersTrait |
||
16 | { |
||
17 | /** |
||
18 | * OutputInterface is the interface implemented by all Output classes. Only exists when command |
||
19 | * are being executed. |
||
20 | * |
||
21 | * @var \Symfony\Component\Console\Output\OutputInterface |
||
22 | */ |
||
23 | protected $output = null; |
||
24 | |||
25 | /** |
||
26 | * InputInterface is the interface implemented by all input classes. Only exists when command |
||
27 | * are being executed. |
||
28 | * |
||
29 | * @var \Symfony\Component\Console\Input\InputInterface |
||
30 | */ |
||
31 | protected $input = null; |
||
32 | |||
33 | /** |
||
34 | * Writes a message to the output. |
||
35 | * |
||
36 | * @param string|array $messages The message as an array of lines or a single string |
||
37 | * @param bool $newline Whether to add a newline |
||
38 | * |
||
39 | * @throws \InvalidArgumentException When unknown output type is given |
||
40 | */ |
||
41 | protected function write($messages, bool $newline = false) |
||
45 | |||
46 | /** |
||
47 | * Writes a message to the output and adds a newline at the end. |
||
48 | * |
||
49 | * @param string|array $messages The message as an array of lines of a single string |
||
50 | * |
||
51 | * @throws \InvalidArgumentException When unknown output type is given |
||
52 | */ |
||
53 | protected function writeln($messages) |
||
57 | |||
58 | /** |
||
59 | * Input option. |
||
60 | * |
||
61 | * @param string $name |
||
62 | * |
||
63 | * @return mixed |
||
64 | */ |
||
65 | protected function option(string $name) |
||
69 | |||
70 | /** |
||
71 | * Input argument. |
||
72 | * |
||
73 | * @param string $name |
||
74 | * |
||
75 | * @return mixed |
||
76 | */ |
||
77 | protected function argument(string $name) |
||
81 | |||
82 | /** |
||
83 | * Table helper instance with configured header and pre-defined set of rows. |
||
84 | * |
||
85 | * @param array $headers |
||
86 | * @param array $rows |
||
87 | * @param string $style |
||
88 | * |
||
89 | * @return Table |
||
90 | */ |
||
91 | protected function table(array $headers, array $rows = [], string $style = 'default'): Table |
||
97 | |||
98 | /** |
||
99 | * @return \Interop\Container\ContainerInterface |
||
100 | */ |
||
101 | abstract protected function iocContainer(); |
||
102 | } |