Passed
Pull Request — master (#2)
by Thomas
03:05
created

MigrationService::call()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 9
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Webfactor\Laravel\Generators\Services;
4
5
use Webfactor\Laravel\Generators\Contracts\ServiceAbstract;
6
use Webfactor\Laravel\Generators\Contracts\ServiceInterface;
7
8
class MigrationService extends ServiceAbstract implements ServiceInterface
9
{
10
    protected $relativeToBasePath = 'database/migrations';
11
12
    public function call()
13
    {
14
        $this->command->call('make:migration:schema', [
15
            'name' => $this->getName($this->command->entity),
16
            '--model' => 0,
17
            '--schema' => $this->command->option('schema'),
18
        ]);
19
20
        $this->addLatestFileToIdeStack();
21
    }
22
23
    public function getName(string $entity): string
24
    {
25
        return 'create_' . snake_case(str_plural($entity)) . '_table';
26
    }
27
}
28