RedisClearCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 5 1
A execute() 0 11 1
1
<?php
2
3
namespace Rottenwood\KingdomBundle\Command\Console;
4
5
use Rottenwood\KingdomBundle\Redis\RedisClientInterface;
6
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
/** {@inheritDoc} */
11
class RedisClearCommand extends ContainerAwareCommand
12
{
13
14
    /** {@inheritDoc} */
15
    protected function configure()
16
    {
17
        $this->setName('kingdom:redis:clear');
18
        $this->setDescription('Очистка данных в redis');
19
    }
20
21
    /** {@inheritDoc} */
22
    protected function execute(InputInterface $input, OutputInterface $output)
23
    {
24
        /** @var \Redis $redis */
25
        $redis = $this->getContainer()->get('snc_redis.default');
26
        $redis->del(RedisClientInterface::ID_USERNAME_HASH);
27
        $redis->del(RedisClientInterface::ID_SESSION_HASH);
28
        $redis->del(RedisClientInterface::SESSION_ID_HASH);
29
        $redis->del(RedisClientInterface::ONLINE_LIST);
30
31
        $output->writeln('Данные удалены из redis');
32
    }
33
}
34