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

SchemaClearCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
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