Passed
Push — master ( a5cb85...5e6469 )
by Alexander
11:41 queued 08:50
created

SchemaRebuildCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 2
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 1
rs 10
c 1
b 0
f 0
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
final class SchemaRebuildCommand extends Command
14
{
15
    protected static $defaultName = 'cycle/schema/rebuild';
16
    protected static $defaultDescription = 'Rebuilds the database schema';
17
    private CycleDependencyProxy $promise;
18
19 1
    public function __construct(CycleDependencyProxy $promise)
20
    {
21 1
        $this->promise = $promise;
22 1
        parent::__construct();
23
    }
24
25 1
    protected function execute(InputInterface $input, OutputInterface $output): int
26
    {
27 1
        $provider = $this->promise->getSchemaProvider();
28 1
        $provider->clear();
29 1
        $provider->read();
30
31 1
        return ExitCode::OK;
32
    }
33
}
34