Completed
Push — develop ( df9395...08456a )
by Abdelrahman
16:28
created

PolicyMakeCommand::replaceUserNamespace()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Foundation\Console\Commands;
6
7
use Cortex\Foundation\Traits\ConsoleMakeModuleCommand;
8
use Illuminate\Foundation\Console\PolicyMakeCommand as BasePolicyMakeCommand;
9
10
class PolicyMakeCommand extends BasePolicyMakeCommand
11
{
12
    use ConsoleMakeModuleCommand;
13
14
    /**
15
     * Replace the User model namespace.
16
     *
17
     * @param  string  $stub
18
     * @return string
19
     */
20
    protected function replaceUserNamespace($stub)
21
    {
22
        if (! $userModel = config('auth.providers.'.config('auth.guards.'.config('auth.defaults.guard').'.provider').'.model')) {
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...
23
            return $stub;
24
        }
25
26
        return str_replace(
27
            $this->rootNamespace().'User',
28
            $userModel,
29
            $stub
30
        );
31
    }
32
}
33