Passed
Push — master ( 57a6ca...7ee914 )
by Aleksei
02:24
created

SchemaClearCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
eloc 8
dl 0
loc 21
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A execute() 0 4 1
A configure() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Cycle\Command\Schema;
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\Cycle\Command\CycleDependencyProxy;
12
13
class SchemaClearCommand extends Command
14
{
15
    protected static $defaultName = 'cycle/schema/clear';
16
17
    private CycleDependencyProxy $promise;
18
19
    public function __construct(CycleDependencyProxy $promise)
20
    {
21
        $this->promise = $promise;
22
        parent::__construct();
23
    }
24
25
    public function configure(): void
26
    {
27
        $this->setDescription('Clear current schema cache');
28
    }
29
30
    protected function execute(InputInterface $input, OutputInterface $output): int
31
    {
32
        $this->promise->getSchemaProvider()->clear();
33
        return ExitCode::OK;
34
    }
35
}
36