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 ( e6912b...498113 )
by Toby
13:04
created

GroupObserverCascadeDelete   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 85.71%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
eloc 16
c 1
b 0
f 0
dl 0
loc 48
ccs 18
cts 21
cp 0.8571
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A removeTags() 0 4 2
A deleteRoles() 0 4 2
A __construct() 0 5 1
A removeUsers() 0 4 2
A delete() 0 5 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\Cache\Pivots\Tags\GroupGroupTag;
6
use BristolSU\ControlDB\Contracts\Models\Group;
7
use BristolSU\ControlDB\Contracts\Repositories\Pivots\UserGroup;
8
use BristolSU\ControlDB\Contracts\Repositories\Role;
9
10
class GroupObserverCascadeDelete
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class GroupObserverCascadeDelete
Loading history...
11
{
12
13
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
14
     * @var UserGroup
15
     */
16
    private $userGroup;
0 ignored issues
show
Coding Style introduced by
Private member variable "userGroup" must be prefixed with an underscore
Loading history...
17
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
18
     * @var Role
19
     */
20
    private $role;
0 ignored issues
show
Coding Style introduced by
Private member variable "role" must be prefixed with an underscore
Loading history...
21
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
22
     * @var GroupGroupTag
23
     */
24
    private $groupGroupTag;
0 ignored issues
show
Coding Style introduced by
Private member variable "groupGroupTag" must be prefixed with an underscore
Loading history...
25
26 4
    public function __construct(UserGroup $userGroup, GroupGroupTag $groupGroupTag, Role $role)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
27
    {
28 4
        $this->userGroup = $userGroup;
29 4
        $this->role = $role;
30 4
        $this->groupGroupTag = $groupGroupTag;
31 4
    }
32
33 1
    public function delete(Group $group)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function delete()
Loading history...
34
    {
35 1
        $this->removeUsers($group);
36 1
        $this->removeTags($group);
37 1
        $this->deleteRoles($group);
38 1
    }
39
40 1
    private function removeUsers(Group $group)
0 ignored issues
show
Coding Style introduced by
Private method name "GroupObserverCascadeDelete::removeUsers" must be prefixed with an underscore
Loading history...
Coding Style introduced by
Missing doc comment for function removeUsers()
Loading history...
41
    {
42 1
        foreach($this->userGroup->getUsersThroughGroup($group) as $user) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
43
            $this->userGroup->removeUserFromGroup($user, $group);
44
        }
45 1
    }
46
47 1
    private function removeTags(Group $group)
0 ignored issues
show
Coding Style introduced by
Private method name "GroupObserverCascadeDelete::removeTags" must be prefixed with an underscore
Loading history...
Coding Style introduced by
Missing doc comment for function removeTags()
Loading history...
48
    {
49 1
        foreach($this->groupGroupTag->getTagsThroughGroup($group) as $tag) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
50
            $this->groupGroupTag->removeTagFromGroup($tag, $group);
51
        }
52 1
    }
53
54 1
    private function deleteRoles(Group $group)
0 ignored issues
show
Coding Style introduced by
Private method name "GroupObserverCascadeDelete::deleteRoles" must be prefixed with an underscore
Loading history...
Coding Style introduced by
Missing doc comment for function deleteRoles()
Loading history...
55
    {
56 1
        foreach($this->role->allThroughGroup($group) as $role) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
57
            $this->role->delete($role->id());
58
        }
59 1
    }
60
61
}