Completed
Push — master ( 631a8c...71ef7a )
by Maxim
77:53
created

CacheCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
3
namespace WebComplete\core\utils\cache;
4
5
use Symfony\Component\Console\Command\Command;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
class CacheCommand extends Command
10
{
11
    /**
12
     * @var CacheService
13
     */
14
    private $cacheService;
15
16
    /**
17
     * @param CacheService $cacheService
18
     *
19
     * @throws \Symfony\Component\Console\Exception\LogicException
20
     */
21
    public function __construct(CacheService $cacheService)
22
    {
23
        parent::__construct(null);
24
        $this->cacheService = $cacheService;
25
    }
26
27
    /**
28
     * @throws \Symfony\Component\Console\Exception\InvalidArgumentException
29
     */
30
    protected function configure()
31
    {
32
        $this->setName('cache:clear')->setDescription('Clear all cache');
33
    }
34
35
    /**
36
     * @param InputInterface $input
37
     * @param OutputInterface $output
38
     *
39
     * @return null|int
40
     */
41
    protected function execute(InputInterface $input, OutputInterface $output)
42
    {
43
        $this->cacheService->system()->clear();
44
        $this->cacheService->user()->clear();
45
        $output->writeln('Done!');
46
        return null;
47
    }
48
}
49