1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /* |
||
6 | * This file is part of the Micro framework package. |
||
7 | * |
||
8 | * (c) Stanislau Komar <[email protected]> |
||
9 | * |
||
10 | * For the full copyright and license information, please view the LICENSE |
||
11 | * file that was distributed with this source code. |
||
12 | */ |
||
13 | |||
14 | namespace Micro\Plugin\Cache\Communication\Cli; |
||
15 | |||
16 | use Micro\Plugin\Cache\Facade\CacheFacadeInterface; |
||
17 | use Symfony\Component\Console\Command\Command; |
||
0 ignored issues
–
show
|
|||
18 | use Symfony\Component\Console\Input\InputArgument; |
||
19 | use Symfony\Component\Console\Input\InputInterface; |
||
20 | use Symfony\Component\Console\Output\OutputInterface; |
||
21 | use Symfony\Component\Console\Style\SymfonyStyle; |
||
22 | |||
23 | class ClearCacheCommand extends Command |
||
24 | { |
||
25 | 1 | public function __construct( |
|
26 | private readonly CacheFacadeInterface $cacheFacade |
||
27 | ) { |
||
28 | 1 | parent::__construct('cache:clear'); |
|
29 | } |
||
30 | |||
31 | 1 | public function configure(): void |
|
32 | { |
||
33 | 1 | $this |
|
34 | 1 | ->addArgument('pools', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'A list of cache pools or cache pool clearer\'s') |
|
35 | 1 | ->setHelp( |
|
36 | 1 | <<<'EOF' |
|
37 | The <info>%command.name%</info> command clears the given cache pools or cache pool clearer\'s. |
||
38 | |||
39 | %command.full_name% <cache pool or clearer 1> [...<cache pool or clearer N>] |
||
40 | 1 | EOF |
|
41 | 1 | ) |
|
42 | 1 | ->setDescription('Clear cache pools'); |
|
43 | } |
||
44 | |||
45 | 1 | public function execute(InputInterface $input, OutputInterface $output) |
|
46 | { |
||
47 | 1 | $io = new SymfonyStyle($input, $output); |
|
48 | |||
49 | 1 | foreach ($input->getArgument('pools') as $poolName) { |
|
50 | 1 | $io->comment(sprintf('Clearing cache pool: <info>%s</info>', $poolName)); |
|
51 | 1 | $pool = $this->cacheFacade->getCachePsr6($poolName); |
|
52 | 1 | $pool->clear(); |
|
53 | } |
||
54 | |||
55 | 1 | $io->success('Cache was successfully cleared.'); |
|
56 | |||
57 | 1 | return self::SUCCESS; |
|
58 | } |
||
59 | } |
||
60 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths