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

PositionObserverCascadeDelete   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 86.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 11
c 1
b 0
f 0
dl 0
loc 35
ccs 13
cts 15
cp 0.8667
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A removeTags() 0 4 2
A __construct() 0 4 1
A deleteRoles() 0 4 2
A delete() 0 4 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\Position;
6
use BristolSU\ControlDB\Contracts\Repositories\Pivots\Tags\PositionPositionTag;
7
use BristolSU\ControlDB\Contracts\Repositories\Role;
8
9
class PositionObserverCascadeDelete
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class PositionObserverCascadeDelete
Loading history...
10
{
11
12
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
13
     * @var Role
14
     */
15
    private $roleRepository;
0 ignored issues
show
Coding Style introduced by
Private member variable "roleRepository" 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 PositionPositionTag
18
     */
19
    private $positionPositionTag;
0 ignored issues
show
Coding Style introduced by
Private member variable "positionPositionTag" must be prefixed with an underscore
Loading history...
20
21 4
    public function __construct(Role $roleRepository, PositionPositionTag $positionPositionTag)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
22
    {
23 4
        $this->roleRepository = $roleRepository;
24 4
        $this->positionPositionTag = $positionPositionTag;
25 4
    }
26
27 1
    public function delete(Position $position)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function delete()
Loading history...
28
    {
29 1
        $this->deleteRoles($position);
30 1
        $this->removeTags($position);
31 1
    }
32
33 1
    private function deleteRoles(Position $position)
0 ignored issues
show
Coding Style introduced by
Private method name "PositionObserverCascadeDelete::deleteRoles" must be prefixed with an underscore
Loading history...
Coding Style introduced by
Missing doc comment for function deleteRoles()
Loading history...
34
    {
35 1
        foreach($this->roleRepository->allThroughPosition($position) as $role) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
36
            $this->roleRepository->delete($role->id());
37
        }
38 1
    }
39
40 1
    private function removeTags(Position $position)
0 ignored issues
show
Coding Style introduced by
Private method name "PositionObserverCascadeDelete::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->positionPositionTag->getTagsThroughPosition($position) as $tag) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
43
            $this->positionPositionTag->removeTagFromPosition($tag, $position);
44
        }
45 1
    }
46
47
}