Total Complexity | 5 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
22 | class CachePoolClearTask extends AbstractSymfonyTask |
||
23 | { |
||
24 | 48 | public function getName(): string |
|
25 | { |
||
26 | 48 | return 'symfony/cache-pool-clear'; |
|
27 | } |
||
28 | |||
29 | 2 | public function getDescription(): string |
|
30 | { |
||
31 | 2 | return '[Symfony] Cache Pool Clear'; |
|
32 | } |
||
33 | |||
34 | 2 | public function execute(): bool |
|
35 | { |
||
36 | 2 | $options = $this->getOptions(); |
|
37 | |||
38 | 2 | if (!$options['pools']) { |
|
39 | 1 | throw new ErrorException('Parameter "pools" is not defined'); |
|
40 | } |
||
41 | |||
42 | 1 | $command = sprintf( |
|
43 | '%s cache:pool:clear %s --env=%s %s', |
||
44 | 1 | $options['console'], |
|
45 | 1 | $options['pools'], |
|
46 | 1 | $options['env'], |
|
47 | 1 | $options['flags'] |
|
48 | ); |
||
49 | |||
50 | /** @var Process $process */ |
||
51 | 1 | $process = $this->runtime->runCommand(trim($command)); |
|
52 | |||
53 | 1 | return $process->isSuccessful(); |
|
54 | } |
||
55 | |||
56 | 2 | protected function getSymfonyOptions(): array |
|
59 | } |
||
60 | } |
||
61 |