SchemaRebuildCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 19
ccs 8
cts 8
cp 1
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 7 1
A __construct() 0 4 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
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