MigrateRefresh   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 10 2
1
<?php
2
3
namespace Yarak\Commands;
4
5
use Yarak\Console\YarakCommand;
6
use Yarak\DB\Seeders\SeedRunner;
7
8
class MigrateRefresh extends YarakCommand
9
{
10
    /**
11
     * The command signature.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'migrate:refresh
16
                            {--s|seed : Seed the database after refreshing.}
17
                            {--c|class=DatabaseSeeder : The name of the seeder class to run.}';
18
19
    /**
20
     * The command description.
21
     *
22
     * @var string
23
     */
24
    protected $description = 'Refresh the database.';
25
26
    /**
27
     * Handle the command.
28
     */
29
    protected function handle()
30
    {
31
        $this->getMigrator($this->getOutput())->refresh();
32
33
        if ($this->option('seed')) {
34
            $seedRunner = new SeedRunner($this->getOutput());
35
36
            $seedRunner->run($this->option('class'));
0 ignored issues
show
Bug introduced by
It seems like $this->option('class') targeting Artisanize\Command::option() can also be of type array; however, Yarak\DB\Seeders\SeedRunner::run() does only seem to accept string, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
37
        }
38
    }
39
}
40