Conditions | 4 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | 90 | public function hasRole(string $name, $matchingFunc): bool |
|
21 | { |
||
22 | 90 | if ($matchingFunc instanceof \Closure) { |
|
23 | 12 | foreach ($this->roles as $key => $value) { |
|
24 | 12 | if ($matchingFunc($name, (string) $key)) { |
|
25 | 12 | return true; |
|
26 | } |
||
27 | } |
||
28 | } else { |
||
29 | 81 | return isset($this->roles[$name]); |
|
30 | } |
||
31 | |||
32 | 3 | return false; |
|
33 | } |
||
67 |