Completed
Pull Request — master (#892)
by Paul
05:53
created

ClearWidgetCacheCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 8 1
A execute() 0 6 1
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
}
37