FlushCache::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chinstrap\Core\Console\Commands;
6
7
use Psr\Cache\CacheItemPoolInterface;
8
use Symfony\Component\Console\Command\Command;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
final class FlushCache extends Command
13
{
14
    protected CacheItemPoolInterface $cache;
15
16
    public function __construct(CacheItemPoolInterface $cache)
17
    {
18
        parent::__construct();
19
        $this->cache = $cache;
20
    }
21
22
    protected function configure(): void
23
    {
24
        $this->setName('cache:flush')
25
                ->setDescription('Flushes the cache')
26
                ->setHelp('This command will flush the cache');
27
    }
28
29
    protected function execute(InputInterface $input, OutputInterface $output): int
30
    {
31
        $this->cache->purge();
32
        return 1;
33
    }
34
}
35