Passed
Push — master ( cd2210...3cb518 )
by Thomas
39s
created

MakeMigrationService::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Webfactor\Laravel\Generators\Services;
4
5
use Webfactor\Laravel\Generators\Contracts\MakeServiceAbstract;
6
use Webfactor\Laravel\Generators\Contracts\MakeServiceInterface;
7
8
class MakeMigrationService extends MakeServiceAbstract implements MakeServiceInterface
9
{
10
    public function make()
11
    {
12
        $this->command->call('make:migration:schema', [
13
            'name' => $this->getName($this->entity),
14
            '--model' => 0,
15
            '--schema' => $this->getSchema(),
16
        ]);
17
    }
18
19
    public function getName(string $entity): string
20
    {
21
        return 'create_' . snake_case(str_plural($entity)) . '_table';
22
    }
23
24
    private function getSchema()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
25
    {
26
        return $this->command->option('schema') ?? 'name:string';
27
    }
28
}
29