Completed
Pull Request — master (#3)
by
unknown
59s
created

MakeMigration   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getStub() 0 4 1
A qualifyClass() 0 4 1
A replaceClass() 0 6 1
A getClassName() 0 6 1
1
<?php
2
3
namespace BeyondCode\LaravelPackageTools\Commands;
4
5
use Illuminate\Support\Str;
6
7
class MakeMigration extends GeneratorCommand
8
{
9
    protected $type = 'Migration';
10
11
    protected function getStub()
12
    {
13
        return __DIR__.'/stubs/migration.stub';
14
    }
15
16
    protected function qualifyClass($name)
17
    {
18
        return $this->rootNamespace().'\\..\\database\\migrations\\'.$name;
19
    }
20
21
    protected function replaceClass($stub, $name)
22
    {
23
        $stub = str_replace('CreateDummiesTable', $this->getClassName($stub, $name), $stub);
24
25
        return str_replace('dummies', $this->option('create', 'table_name'), $stub);
26
    }
27
28
    protected function getClassName($stub, $name)
0 ignored issues
show
Unused Code introduced by
The parameter $stub is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
29
    {
30
        $class = str_replace($this->getNamespace($name).'\\', '', $name);
31
32
        return ucfirst(Str::camel($class));
33
    }
34
}
35