Passed
Pull Request — development (#671)
by Nick
06:47
created

ClearWebCacheCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 2
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
/***************************************************************************
3
 * for license information see LICENSE.md
4
 ***************************************************************************/
5
6
namespace Oc\Command;
7
8
use OcLegacy\Cache\WebCache;
9
use Symfony\Component\Console\Exception\InvalidArgumentException;
10
use Symfony\Component\Console\Input\InputInterface;
11
use Symfony\Component\Console\Output\OutputInterface;
12
13
/**
14
 * Class ClearWebCacheCommand
15
 *
16
 * @package Oc\Command
17
 */
18
class ClearWebCacheCommand extends AbstractCommand
19
{
20
    const COMMAND_NAME = 'cache:clear-web-cache';
21
22
    /**
23
     * Configures the command.
24
     *
25
     * @return void
26
     *
27
     * @throws InvalidArgumentException
28
     */
29
    protected function configure()
30
    {
31
        parent::configure();
32
33
        $this
34
            ->setName(self::COMMAND_NAME)
35
            ->setDescription('clear legacy web caches');
36
    }
37
38
    /**
39
     * Executes the command.
40
     *
41
     * @param InputInterface $input
42
     * @param OutputInterface $output
43
     *
44
     * @return int|null
45
     */
46
    protected function execute(InputInterface $input, OutputInterface $output)
47
    {
48
        $output->writeln('Delete cached files');
49
50
        $webCache = new WebCache();
51
        $webCache->clearCache();
52
53
        return self::CODE_SUCCESS;
54
    }
55
}
56