Passed
Push — master ( 7ee914...c93d74 )
by Aleksei
03:27 queued 01:21
created

SchemaRebuildCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 7
ccs 0
cts 5
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\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 SchemaRebuildCommand extends Command
14
{
15
    protected static $defaultName = 'cycle/schema/rebuild';
16
    private CycleDependencyProxy $promise;
17
18
    public function __construct(CycleDependencyProxy $promise)
19
    {
20
        $this->promise = $promise;
21
        parent::__construct();
22
    }
23
24
    public function configure(): void
25
    {
26
        $this->setDescription('Rebuild schema');
27
    }
28
29
    protected function execute(InputInterface $input, OutputInterface $output): int
30
    {
31
        $provider = $this->promise->getSchemaProvider();
32
        $provider->clear();
33
        $provider->read();
34
35
        return ExitCode::OK;
36
    }
37
}
38