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

UserRoleObserverClearCache   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 1
b 0
f 0
dl 0
loc 23
ccs 0
cts 10
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A removeUserFromRole() 0 4 1
A __construct() 0 3 1
A addUserToRole() 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\Pivots;
4
5
use BristolSU\ControlDB\Cache\Pivots\UserRole as UserRoleCache;
6
use BristolSU\ControlDB\Contracts\Models\Role;
7
use BristolSU\ControlDB\Contracts\Models\User;
8
use Illuminate\Contracts\Cache\Repository;
9
10
class UserRoleObserverClearCache
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class UserRoleObserverClearCache
Loading history...
11
{
12
13
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
14
     * @var Repository
15
     */
16
    private $cache;
0 ignored issues
show
Coding Style introduced by
Private member variable "cache" must be prefixed with an underscore
Loading history...
17
18
    public function __construct(Repository $cache)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
19
    {
20
        $this->cache = $cache;
21
    }
22
23
    public function addUserToRole(User $user, Role $role)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function addUserToRole()
Loading history...
24
    {
25
        $this->cache->forget(UserRoleCache::class . '@getRolesThroughUser:' . $user->id());
26
        $this->cache->forget(UserRoleCache::class . '@getUsersThroughRole:' . $role->id());
27
    }
28
29
    public function removeUserFromRole(User $user, Role $role): void
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function removeUserFromRole()
Loading history...
30
    {
31
        $this->cache->forget(UserRoleCache::class . '@getRolesThroughUser:' . $user->id());
32
        $this->cache->forget(UserRoleCache::class . '@getUsersThroughRole:' . $role->id());
33
    }
34
35
}