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

RoleObserverClearCache   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 4 1
A __construct() 0 3 1
A update() 0 10 1
A delete() 0 7 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\Role as RoleCache;
6
use BristolSU\ControlDB\Contracts\Models\Role as RoleModel;
7
use Illuminate\Contracts\Cache\Repository;
8
9
class RoleObserverClearCache
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class RoleObserverClearCache
Loading history...
10
{
11
12
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
13
     * @var Repository
14
     */
15
    private $cache;
0 ignored issues
show
Coding Style introduced by
Private member variable "cache" must be prefixed with an underscore
Loading history...
16
17 7
    public function __construct(Repository $cache)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
18
    {
19 7
        $this->cache = $cache;
20 7
    }
21
22 2
    public function create(RoleModel $roleModel)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function create()
Loading history...
23
    {
24 2
        $this->cache->forget(RoleCache::class . '@count');
25 2
        $this->cache->forget(RoleCache::class . '@getByDataProviderId:' . $roleModel->dataProviderId());
26 2
    }
27
28 1
    public function delete(RoleModel $role)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function delete()
Loading history...
29
    {
30 1
        $this->cache->forget(RoleCache::class . '@count');
31 1
        $this->cache->forget(RoleCache::class . '@getById:' . $role->id());
32 1
        $this->cache->forget(RoleCache::class . '@getByDataProviderId:' . $role->dataProviderId());
33 1
        $this->cache->forget(RoleCache::class . '@allThroughGroup:' . $role->groupId());
34 1
        $this->cache->forget(RoleCache::class . '@allThroughPosition:' . $role->positionId());
35 1
    }
36
37 4
    public function update(RoleModel $oldRole, RoleModel $newRole)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function update()
Loading history...
38
    {
39 4
        $this->cache->forget(RoleCache::class . '@count');
40 4
        $this->cache->forget(RoleCache::class . '@getById:' . $newRole->id());
41 4
        $this->cache->forget(RoleCache::class . '@getByDataProviderId:' . $oldRole->dataProviderId());
42 4
        $this->cache->forget(RoleCache::class . '@getByDataProviderId:' . $newRole->dataProviderId());
43 4
        $this->cache->forget(RoleCache::class . '@allThroughPosition:' . $oldRole->positionId());
44 4
        $this->cache->forget(RoleCache::class . '@allThroughPosition:' . $newRole->positionId());
45 4
        $this->cache->forget(RoleCache::class . '@allThroughGroup:' . $oldRole->groupId());
46 4
        $this->cache->forget(RoleCache::class . '@allThroughGroup:' . $newRole->groupId());
47 4
    }
48
    
49
}