1 | <?php |
||
2 | |||
3 | namespace SimpleDIC\Console; |
||
4 | |||
5 | use SimpleDIC\DIC; |
||
6 | use Symfony\Component\Console\Command\Command; |
||
7 | use Symfony\Component\Console\Input\InputArgument; |
||
8 | use Symfony\Component\Console\Input\InputInterface; |
||
9 | use Symfony\Component\Console\Output\OutputInterface; |
||
10 | |||
11 | class CacheDestroyCommand extends Command |
||
12 | { |
||
13 | protected function configure() |
||
14 | { |
||
15 | $this |
||
16 | ->setName('dic:cache-destroy') |
||
17 | ->setDescription('Destroy the cache created by DIC.') |
||
18 | ->setHelp('This command try to destroy cache files created by DIC and clear apcu cache.') |
||
19 | ->addArgument('cache_dir', InputArgument::OPTIONAL) |
||
20 | ; |
||
21 | } |
||
22 | |||
23 | protected function execute(InputInterface $input, OutputInterface $output) |
||
24 | { |
||
25 | $cacheDir = !empty($input->getArgument('cache_dir')) ? $input->getArgument('cache_dir') : __DIR__.'/../../_cache'; |
||
26 | |||
27 | DIC::destroyCacheDir($cacheDir); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
28 | |||
29 | $output->writeln('<fg=green>Cache was successfully cleared.</>'); |
||
30 | } |
||
31 | } |
||
32 |