GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — develop ( 012a1d...8e69cd )
by Toby
06:20
created

UserIsNotLoggedIntoRole   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 28
ccs 8
cts 8
cp 1
rs 10
c 1
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A message() 0 3 1
A __construct() 0 3 1
A passes() 0 4 2
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace BristolSU\Module\AssignRoles\Rules;
4
5
use BristolSU\Support\Authentication\Contracts\Authentication;
6
use Illuminate\Contracts\Validation\Rule;
7
8
class UserIsNotLoggedIntoRole implements Rule
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class UserIsNotLoggedIntoRole
Loading history...
9
{
10
11
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
12
     * @var Authentication
13
     */
14
    private $authentication;
0 ignored issues
show
Coding Style introduced by
Private member variable "authentication" must be prefixed with an underscore
Loading history...
15
16 6
    public function __construct(Authentication $authentication)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
17
    {
18 6
        $this->authentication = $authentication;
19 6
    }
20
21
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
Parameter $attribute should have a doc-comment as per coding-style.
Loading history...
Coding Style introduced by
Parameter $value should have a doc-comment as per coding-style.
Loading history...
22
     * @inheritDoc
23
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
24 1
    public function passes($attribute, $value)
25
    {
26 1
        return $this->authentication->getRole() === null || 
27 1
            $this->authentication->getRole()->id() !== (int) $value;
28
    }
29
30
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
31
     * @inheritDoc
32
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
33 1
    public function message()
34
    {
35 1
        return 'You cannot unassign a role you are logged in as';
36
    }
37
}