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.

RoleObserverCascadeDelete::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 2
crap 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace BristolSU\ControlDB\Observers;
4
5
use BristolSU\ControlDB\Contracts\Models\Role;
6
use BristolSU\ControlDB\Contracts\Repositories\Pivots\Tags\RoleRoleTag;
7
use BristolSU\ControlDB\Contracts\Repositories\Pivots\UserRole;
8
9
class RoleObserverCascadeDelete
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class RoleObserverCascadeDelete
Loading history...
10
{
11
12
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
13
     * @var UserRole
14
     */
15
    private $userRole;
0 ignored issues
show
Coding Style introduced by
Private member variable "userRole" must be prefixed with an underscore
Loading history...
16
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
17
     * @var RoleRoleTag
18
     */
19
    private $roleRoleTag;
0 ignored issues
show
Coding Style introduced by
Private member variable "roleRoleTag" must be prefixed with an underscore
Loading history...
20
21 8
    public function __construct(UserRole $userRole, RoleRoleTag $roleRoleTag)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
22
    {
23 8
        $this->userRole = $userRole;
24 8
        $this->roleRoleTag = $roleRoleTag;
25 8
    }
26
27 1
    public function delete(Role $role)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function delete()
Loading history...
28
    {
29 1
        $this->removeUsers($role);
30 1
        $this->removeTags($role);
31 1
    }
32
33 1
    private function removeUsers(Role $role)
0 ignored issues
show
Coding Style introduced by
Private method name "RoleObserverCascadeDelete::removeUsers" must be prefixed with an underscore
Loading history...
Coding Style introduced by
Missing doc comment for function removeUsers()
Loading history...
34
    {
35 1
        foreach($this->userRole->getUsersThroughRole($role) as $user) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
36
            $this->userRole->removeUserFromRole($user, $role);
37
        }
38 1
    }
39
40 1
    private function removeTags(Role $role)
0 ignored issues
show
Coding Style introduced by
Private method name "RoleObserverCascadeDelete::removeTags" must be prefixed with an underscore
Loading history...
Coding Style introduced by
Missing doc comment for function removeTags()
Loading history...
41
    {
42 1
        foreach($this->roleRoleTag->getTagsThroughRole($role) as $tag) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
43
            $this->roleRoleTag->removeTagFromRole($tag, $role);
44
        }
45 1
    }
46
47
}