DebugResetCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
c 0
b 0
f 0
dl 0
loc 25
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A configure() 0 4 1
A execute() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Command;
6
7
use Symfony\Component\Console\Attribute\AsCommand;
8
use Symfony\Component\Console\Command\Command;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Output\OutputInterface;
11
use Yiisoft\Yii\Console\ExitCode;
12
use Yiisoft\Yii\Debug\Debugger;
13
use Yiisoft\Yii\Debug\Storage\StorageInterface;
14
15
#[AsCommand(
16
    name: 'debug:reset',
17
    description: 'Clear debug data',
18
)]
19
final class DebugResetCommand extends Command
20
{
21
    public function __construct(
22
        private readonly StorageInterface $storage,
23
        private readonly Debugger $debugger,
24
    ) {
25
        parent::__construct();
26
    }
27
28
    protected function configure(): void
29
    {
30
        $this
31
            ->setHelp('This command clears debug storage data');
32
    }
33
34
    protected function execute(InputInterface $input, OutputInterface $output): int
35
    {
36
        $this->debugger->stop();
37
        $this->storage->clear();
38
39
        return ExitCode::OK;
40
    }
41
}
42