MakeMigration   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 2
A 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