Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Pull Request — master (#24)
by
unknown
02:02
created

ExtendPermissionCrudRequest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 90
Duplicated Lines 20 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 1
dl 18
loc 90
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getStub() 0 4 1
A getPath() 18 18 1
A getDefaultNamespace() 0 4 1
A getOptions() 0 6 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Backpack\PermissionManager\Console\Commands;
4
5
use Illuminate\Console\GeneratorCommand;
6
7
class ExtendPermissionCrudRequest extends GeneratorCommand
8
{
9
    /**
10
     * The console command name.
11
     *
12
     * @var string
13
     */
14
    protected $name = 'backpack:crud-permission-request';
15
16
    /**
17
     * The name and signature of the console command.
18
     *
19
     * @var string
20
     */
21
    protected $signature = 'backpack:crud-permission-request {name}';
22
23
    /**
24
     * The console command description.
25
     *
26
     * @var string
27
     */
28
    protected $description = 'Generate a Backpack CRUD Permission request';
29
30
    /**
31
     * The type of class being generated.
32
     *
33
     * @var string
34
     */
35
    protected $type = 'Request';
36
37
    /**
38
     * Get the stub file for the generator.
39
     *
40
     * @return string
41
     */
42
    protected function getStub()
43
    {
44
        return __DIR__.'/../stubs/crud-request-permission.stub';
45
    }
46
47
    /**
48
     * Get the destination class path.
49
     *
50
     * @param string $name
51
     *
52
     * @return string
53
     */
54 View Code Duplication
    protected function getPath($name)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
55
    {
56
        // Get relative path name
57
        $name = str_replace_first($this->laravel->getNamespace(), '', $name);
58
        $name = str_replace('\\', '/', $name);
59
60
        // Pull expected filename from path
61
        $name_array = explode('/', $name);
62
        $file = array_pop($name_array);
63
        // Replace with Extended version
64
        $name_array[] = 'Extend'.$file;
65
66
        // Implode array to string
67
        $name = implode('/', $name_array);
68
69
        // Return new path
70
        return $this->laravel['path'].'/'.$name.'CrudRequest.php';
71
    }
72
73
    /**
74
     * Get the default namespace for the class.
75
     *
76
     * @param string $rootNamespace
77
     *
78
     * @return string
79
     */
80
    protected function getDefaultNamespace($rootNamespace)
81
    {
82
        return $rootNamespace.'\Http\Requests\Permissions';
83
    }
84
85
    /**
86
     * Get the console command options.
87
     *
88
     * @return array
89
     */
90
    protected function getOptions()
91
    {
92
        return [
93
94
        ];
95
    }
96
}
97