Passed
Pull Request — master (#40)
by
unknown
10:19
created

SchemaClearCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Yiisoft\Yii\Cycle\Command\Common;
4
5
use Symfony\Component\Console\Command\Command;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
use Yiisoft\Yii\Console\ExitCode;
9
use Yiisoft\Yii\Cycle\Command\CycleDependencyProxy;
10
11
class SchemaClearCommand extends Command
12
{
13
    protected static $defaultName = 'cycle/schema/clear';
14
15
    private CycleDependencyProxy $promise;
16
17
    public function __construct(CycleDependencyProxy $promise)
18
    {
19
        $this->promise = $promise;
20
        parent::__construct();
21
    }
22
23
    public function configure(): void
24
    {
25
        $this->setDescription('Clear current schema');
26
    }
27
28
    protected function execute(InputInterface $input, OutputInterface $output): int
29
    {
30
        $this->promise->getSchemaManager()->clear();
31
        $output->writeln('Schema cleared.');
32
        return ExitCode::OK;
33
    }
34
}
35