1 | <?php |
||
22 | abstract class ModulesBaseInstallCommand extends ContainerAwareCommand |
||
23 | { |
||
24 | |||
25 | const PROMPT_INSTALLED = 1; |
||
26 | const PROMPT_NOT_INSTALLED = 0; |
||
27 | |||
28 | /** |
||
29 | * @var \Symfony\Component\Console\Input\InputInterface |
||
30 | */ |
||
31 | protected $input; |
||
32 | |||
33 | /** |
||
34 | * @var \Symfony\Component\Console\Output\OutputInterface |
||
35 | */ |
||
36 | protected $output; |
||
37 | |||
38 | /** |
||
39 | * @param \Symfony\Component\Console\Input\InputInterface $input |
||
40 | * @param \Symfony\Component\Console\Output\OutputInterface $output |
||
41 | * @return void |
||
42 | */ |
||
43 | public function execute(InputInterface $input, OutputInterface $output) |
||
48 | |||
49 | /** |
||
50 | * @param string $module |
||
51 | * @return bool |
||
52 | */ |
||
53 | protected function existsModule(string $module): bool |
||
57 | |||
58 | /** |
||
59 | * Clear cache |
||
60 | */ |
||
61 | protected function clearCache(): void |
||
65 | |||
66 | /** |
||
67 | * @param int $mode |
||
68 | * @param callable $formatter |
||
69 | * @return array |
||
70 | * @throws \LogicException |
||
71 | * @throws \Symfony\Component\Console\Exception\LogicException |
||
72 | * @throws \Symfony\Component\Console\Exception\RuntimeException |
||
73 | * @throws \Symfony\Component\Console\Exception\InvalidArgumentException |
||
74 | * @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException |
||
75 | * @throws \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException |
||
76 | */ |
||
77 | protected function promptModule( |
||
113 | |||
114 | protected function confirmAction(string $quest): bool |
||
126 | |||
127 | /** |
||
128 | * @return array|null |
||
129 | * @throws \LogicException |
||
130 | * @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException |
||
131 | * @throws \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException |
||
132 | */ |
||
133 | protected function fetchInstalledModules(): ?array |
||
139 | |||
140 | /** |
||
141 | * @var array|null |
||
142 | */ |
||
143 | private $installedModules; |
||
144 | |||
145 | /** |
||
146 | * @return array|null |
||
147 | * @throws \LogicException |
||
148 | * @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException |
||
149 | * @throws \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException |
||
150 | */ |
||
151 | protected function getInstalledModules(): ?array |
||
159 | |||
160 | /** |
||
161 | * @param string $module |
||
162 | * @return bool |
||
163 | * @throws \LogicException |
||
164 | * @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException |
||
165 | * @throws \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException |
||
166 | */ |
||
167 | protected function isModuleInstalled(string $module): bool |
||
171 | |||
172 | /** |
||
173 | * @return array |
||
174 | */ |
||
175 | protected function getModules(): array |
||
181 | |||
182 | /** |
||
183 | * @return array |
||
184 | */ |
||
185 | protected function getModulesPath(): array |
||
189 | |||
190 | /** |
||
191 | * The method finds all installed modules that depend on the desired module |
||
192 | * |
||
193 | * @param array $modules |
||
194 | * @param string $module |
||
195 | * @param int $level |
||
196 | * @throws \LogicException |
||
197 | * @throws \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException |
||
198 | * @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException |
||
199 | */ |
||
200 | protected function findInstalledDependsModules(array &$modules, string $module, int $level = 0) |
||
214 | |||
215 | /** |
||
216 | * The method finds all not installed modules depends on the desired module |
||
217 | * |
||
218 | * @param array $modules |
||
219 | * @param string $module |
||
220 | * @param int $level |
||
221 | * @throws \LogicException |
||
222 | * @throws \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException |
||
223 | * @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException |
||
224 | */ |
||
225 | protected function findNotInstalledModuleDependencies(array &$modules, string $module, int $level = 0) |
||
239 | |||
240 | /** |
||
241 | * The method finds all modules that depend on the desired module |
||
242 | * |
||
243 | * @param string $needle |
||
244 | * @return array |
||
245 | */ |
||
246 | protected function findDependsModules(string $needle): array |
||
274 | |||
275 | /** |
||
276 | * The method finds all modules depends on the desired module |
||
277 | * |
||
278 | * @param string $module |
||
279 | * @return array |
||
280 | */ |
||
281 | protected function getModuleDependencies(string $module): array |
||
301 | } |
||
302 |