Completed
Push — master ( ba48ae...4de43c )
by Leny
01:11 queued 01:03
created

ClearWidgetCacheCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Victoire\Bundle\WidgetBundle\Command;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
/**
10
 * Clear widget redis cache.
11
 */
12
class ClearWidgetCacheCommand extends ContainerAwareCommand
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function configure()
18
    {
19
        parent::configure();
20
21
        $this
22
            ->setName('victoire:widget:cache:clear')
23
            ->setDescription('Clear the widget redis cache');
24
    }
25
26
    /**
27
     * @param InputInterface  $input
28
     * @param OutputInterface $output
29
     */
30
    protected function execute(InputInterface $input, OutputInterface $output)
31
    {
32
        $widgetCache = $this->getContainer()->get('victoire_widget.widget_cache');
33
34
        $widgetCache->clear();
35
36
        $output->writeln('Widget cache has been cleared');
37
    }
38
}
39