| Conditions | 9 |
| Paths | 21 |
| Total Lines | 22 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | protected function execute(InputInterface $input, OutputInterface $output) |
||
| 22 | { |
||
| 23 | $clients = []; |
||
| 24 | foreach ($this->getContainer()->getServiceIds() as $id) { |
||
|
1 ignored issue
–
show
|
|||
| 25 | if (substr($id, 0, 9) === 'snc_redis' && $this->getContainer()->get($id) instanceof Client) { |
||
| 26 | $clients[] = $id; |
||
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | if (!empty($clients)) { |
||
| 31 | $allowed = $clients; |
||
| 32 | $clientsInput = $input->getArgument('clients'); |
||
| 33 | if (!empty($clientsInput)) { |
||
| 34 | foreach ($clientsInput as &$client) { |
||
| 35 | $client = 'snc_redis.'.$client; |
||
| 36 | } |
||
| 37 | $allowed = array_intersect($clients, $clientsInput); |
||
| 38 | } |
||
| 39 | foreach ($clients as $snc) { |
||
| 40 | if (in_array($snc, $allowed)) { |
||
| 41 | $this->getContainer()->get($snc)->flushdb(); |
||
| 42 | $output->writeln('redis database '.$snc.' flushed'); |
||
| 43 | } |
||
| 48 |