Passed
Push — master ( 3cb518...ba9ea6 )
by Thomas
40s
created

FactoryService   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 24
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A call() 0 9 1
A getName() 0 4 1
A getModelName() 0 4 1
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 FactoryService extends ServiceAbstract implements ServiceInterface
9
{
10
    protected $relativeToBasePath = 'database/factories';
11
12
    public function call()
13
    {
14
        $this->command->call('make:factory', [
15
            'name'    => $this->getName($this->command->entity),
16
            '--model' => 'Models\\' . $this->getModelName($this->command->entity),
17
        ]);
18
19
        $this->addLatestFileToIdeStack();
20
    }
21
22
    public function getName(string $entity): string
23
    {
24
        return ucfirst($entity) . 'Factory';
25
    }
26
27
    public function getModelName(string $entity): string
28
    {
29
        return ucfirst($entity);
30
    }
31
}
32