Passed
Pull Request — master (#91)
by Rustam
02:42
created

ClearCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Command;
6
7
use Symfony\Component\Console\Command\Command;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
use Yiisoft\Yii\Console\ExitCode;
11
use Yiisoft\Yii\Debug\Storage\StorageInterface;
12
13
class ClearCommand extends Command
14
{
15
    private StorageInterface $storage;
16
17
    protected static $defaultName = 'debug/reset';
18
19
    public function __construct(StorageInterface $storage)
20
    {
21
        $this->storage = $storage;
22
        parent::__construct();
23
    }
24
25
    protected function configure(): void
26
    {
27
        $this
28
            ->setDescription('Clear debug data')
29
            ->setHelp('This command clears debug storage data');
30
    }
31
32
    protected function execute(InputInterface $input, OutputInterface $output): int
33
    {
34
        $this->storage->clear();
35
36
        return ExitCode::OK;
37
    }
38
}
39