Total Complexity | 3 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class UserRoleObserverClearCache |
||
11 | { |
||
12 | |||
13 | /** |
||
14 | * @var Repository |
||
15 | */ |
||
16 | private $cache; |
||
17 | |||
18 | 12 | public function __construct(Repository $cache) |
|
19 | { |
||
20 | 12 | $this->cache = $cache; |
|
21 | 12 | } |
|
22 | |||
23 | 12 | public function addUserToRole(User $user, Role $role) |
|
24 | { |
||
25 | 12 | $this->cache->forget(UserRoleCache::class . '@getRolesThroughUser:' . $user->id()); |
|
26 | 12 | $this->cache->forget(UserRoleCache::class . '@getUsersThroughRole:' . $role->id()); |
|
27 | 12 | } |
|
28 | |||
29 | 4 | public function removeUserFromRole(User $user, Role $role): void |
|
33 | 4 | } |
|
34 | |||
35 | } |