Passed
Push — next ( b32d72...12e44e )
by Bas
09:05
created

ModelMakeCommand::resolveStubPath()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 6
1
<?php
2
3
namespace LaravelFreelancerNL\Aranguent\Console;
4
5
use Illuminate\Foundation\Console\ModelMakeCommand as IlluminateModelMakeCommand;
6
7
class ModelMakeCommand extends IlluminateModelMakeCommand
8
{
9
    /**
10
     * The console command name.
11
     *
12
     * @var string
13
     */
14
    protected $name = 'aranguent:model';
15
16
    /**
17
     * Get the stub file for the generator.
18
     *
19
     * @return string
20
     */
21 1
    protected function getStub()
22
    {
23 1
        return $this->option('pivot')
24
            ? $this->resolveStubPath('/../../stubs/pivot.model.stub')
25
            : $this->resolveStubPath('/../../stubs/model.stub');
26
    }
27 1
28
    /**
29
     * Resolve the fully-qualified path to the stub.
30
     *
31
     * This method is an exact copy of the original to keep the functionality but reroute __DIR__
32
     *
33
     * @param  string  $stub
34
     * @return string
35
     */
36
    protected function resolveStubPath($stub)
37
    {
38
        return file_exists($customPath = $this->laravel->basePath(trim($stub, '/')))
39
            ? $customPath
40
            : __DIR__ . $stub;
41
    }
42
}
43