Completed
Push — master ( 4deee6...b383ba )
by Zach
05:43 queued 03:44
created

MakeMigration::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 2
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A MakeMigration::getCreator() 0 8 1
1
<?php
2
3
namespace Yarak\Commands;
4
5
use Yarak\Console\YarakCommand;
6
7
class MakeMigration extends YarakCommand
8
{
9
    /**
10
     * The command signature.
11
     *
12
     * @var string
13
     */
14
    protected $signature = 'make:migration
15
                            {name : The name of your migration, words separated by underscores.}
16
                            {--c|create : The name of the table to create.}';
17
18
    /**
19
     * The command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Create a new migration file.';
24
25
    /**
26
     * Handle the command.
27
     */
28
    protected function handle()
29
    {
30
        $creator = $this->getCreator();
31
32
        $create = is_null($create = $this->option('create')) ? false : $create;
33
34
        $creator->create($this->argument('name'), $create);
35
    }
36
37
    /**
38
     * Get a the migration creator class.
39
     *
40
     * @return Yarak\Migrations\MigrationCreator
41
     */
42
    protected function getCreator()
43
    {
44
        $migratorType = ucfirst($this->config->get('migratorType'));
45
46
        $name = "Yarak\\Migrations\\{$migratorType}\\{$migratorType}MigrationCreator";
47
48
        return new $name($this->getOutput());
49
    }
50
}
51