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
Push — master ( 2f3f3f...772594 )
by Cristian
01:40 queued 10s
created

RoleStoreCrudRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A authorize() 5 5 1
A rules() 8 8 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\app\Http\Requests;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
7 View Code Duplication
class RoleStoreCrudRequest extends FormRequest
0 ignored issues
show
Duplication introduced by
This class 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...
8
{
9
    /**
10
     * Determine if the user is authorized to make this request.
11
     *
12
     * @return bool
13
     */
14
    public function authorize()
15
    {
16
        // only allow updates if the user is logged in
17
        return backpack_auth()->check();
18
    }
19
20
    /**
21
     * Get the validation rules that apply to the request.
22
     *
23
     * @return array
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use array<string,string>.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
24
     */
25
    public function rules()
26
    {
27
        $rules = [
28
            'name' => 'required|string|max:255|unique:'.config('permission.table_names.roles', 'roles').',name',
29
        ];
30
31
        return $rules;
32
    }
33
}
34