PolicyMakeCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 25
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A replaceUserNamespace() 0 12 2
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\Foundation\Console\PolicyMakeCommand as BasePolicyMakeCommand;
10
11
class PolicyMakeCommand extends BasePolicyMakeCommand
12
{
13
    use ConfirmableTrait;
14
    use ConsoleMakeModuleCommand;
15
16
    /**
17
     * Replace the User model namespace.
18
     *
19
     * @param string $stub
20
     *
21
     * @return string
22
     */
23
    protected function replaceUserNamespace($stub): string
24
    {
25
        if (! $userModel = config('auth.providers.'.config('auth.guards.'.config('auth.defaults.guard').'.provider').'.model')) {
26
            return $stub;
27
        }
28
29
        return str_replace(
30
            $this->rootNamespace().'User',
31
            $userModel,
32
            $stub
33
        );
34
    }
35
}
36