Completed
Push — master ( 0e1003...1276c7 )
by Abdelrahman
61:46 queued 59:06
created

FactoryMakeCommand::getPath()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 9.9332
cc 2
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Foundation\Console\Commands;
6
7
use Illuminate\Console\ConfirmableTrait;
8
use Cortex\Foundation\Traits\ConsoleMakeModuleCommand;
9
use Illuminate\Database\Console\Factories\FactoryMakeCommand as BaseFactoryMakeCommand;
10
11
class FactoryMakeCommand extends BaseFactoryMakeCommand
12
{
13
    use ConfirmableTrait;
14
    use ConsoleMakeModuleCommand;
15
16
    /**
17
     * Get the destination class path.
18
     *
19
     * @param string $name
20
     *
21
     * @throws \Exception
22
     *
23
     * @return string
24
     */
25
    protected function getPath($name): string
26
    {
27
        $name = str_replace_first($this->rootNamespace(), $this->moduleName().DIRECTORY_SEPARATOR.'database'.DIRECTORY_SEPARATOR.'factories', $name);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 149 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
28
29
        if (! $this->files->exists($path = $this->laravel['path'].DIRECTORY_SEPARATOR.$this->moduleName().DIRECTORY_SEPARATOR)) {
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 129 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
30
            throw new \Exception("Invalid path: {$path}");
31
        }
32
33
        return $this->laravel['path'].DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $name).'.php';
34
    }
35
}
36