Passed
Push — master ( 376d34...7bf0e1 )
by Alexander
04:51 queued 02:18
created

DebugResetCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
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\Debugger;
12
use Yiisoft\Yii\Debug\Storage\StorageInterface;
13
14
final class DebugResetCommand extends Command
15
{
16
    public const COMMAND_NAME = 'debug:reset';
17
    protected static $defaultName = self::COMMAND_NAME;
18
19
    public function __construct(
20
        private StorageInterface $storage,
21
        private Debugger $debugger,
22
    ) {
23
        parent::__construct();
24
    }
25
26
    protected function configure(): void
27
    {
28
        $this
29
            ->setDescription('Clear debug data')
30
            ->setHelp('This command clears debug storage data');
31
    }
32
33
    protected function execute(InputInterface $input, OutputInterface $output): int
34
    {
35
        $this->debugger->stop();
36
        $this->storage->clear();
37
38
        return ExitCode::OK;
39
    }
40
}
41