1 | <?php |
||
14 | abstract class Command extends SymfonyCommand |
||
15 | { |
||
16 | protected $kernel; |
||
17 | |||
18 | /** @var InputInterface */ |
||
19 | protected $input; |
||
20 | |||
21 | /** @var SymfonyStyle */ |
||
22 | protected $output; |
||
23 | |||
24 | 1 | public function __construct(Kernel $kernel) |
|
25 | { |
||
26 | 1 | parent::__construct(); |
|
27 | |||
28 | 1 | $this->kernel = $kernel; |
|
29 | 1 | } |
|
30 | |||
31 | protected function execute(InputInterface $input, OutputInterface $output) |
||
38 | |||
39 | /** |
||
40 | * Get argument value. |
||
41 | * |
||
42 | * @param string $name |
||
43 | * |
||
44 | * @return mixed |
||
45 | * |
||
46 | * @throws \Symfony\Component\Console\Exception\InvalidArgumentException |
||
47 | */ |
||
48 | protected function getArgument(string $name) |
||
52 | |||
53 | /** |
||
54 | * Write a message. |
||
55 | * |
||
56 | * @param string $message |
||
57 | */ |
||
58 | protected function line(string $message): void |
||
62 | |||
63 | /** |
||
64 | * Display success message. |
||
65 | * |
||
66 | * @param string $message |
||
67 | */ |
||
68 | protected function success(string $message): void |
||
72 | |||
73 | /** |
||
74 | * Display info message. |
||
75 | * |
||
76 | * @param string $message |
||
77 | */ |
||
78 | protected function info(string $message): void |
||
82 | |||
83 | /** |
||
84 | * Display warning message. |
||
85 | * |
||
86 | * @param string $message |
||
87 | */ |
||
88 | protected function warning(string $message): void |
||
92 | |||
93 | /** |
||
94 | * Display error message. |
||
95 | * |
||
96 | * @param string $message |
||
97 | */ |
||
98 | protected function error(string $message): void |
||
102 | |||
103 | /** |
||
104 | * Prompt the user for input. |
||
105 | * |
||
106 | * @param string $message |
||
107 | * |
||
108 | * @return string |
||
109 | */ |
||
110 | protected function input(string $message): string |
||
114 | |||
115 | /** |
||
116 | * Display confirmation input. |
||
117 | * |
||
118 | * @param string $message |
||
119 | * |
||
120 | * @return bool |
||
121 | */ |
||
122 | protected function confirm(string $message): bool |
||
126 | |||
127 | /** |
||
128 | * Get filesystem instance. |
||
129 | * |
||
130 | * @return Filesystem |
||
131 | * |
||
132 | * @throws \Psr\Container\ContainerExceptionInterface |
||
133 | */ |
||
134 | protected function filesystem(): Filesystem |
||
138 | |||
139 | /** |
||
140 | * Handle command. |
||
141 | */ |
||
142 | abstract public function handle(): void; |
||
143 | } |
||
144 |