| Conditions | 4 |
| Paths | 6 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4.3244 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | 2 | public function hasRole($role) |
|
| 28 | { |
||
| 29 | 2 | $inList = false; |
|
| 30 | |||
| 31 | 2 | if (is_string($role)) { |
|
| 32 | 2 | $role = new Role($role); |
|
| 33 | 1 | } |
|
| 34 | |||
| 35 | 2 | foreach ($this->getRoles() as $listedRole) { |
|
| 36 | if ($role->getRole() === $listedRole->getRole()) { |
||
| 37 | $inList = true; |
||
| 38 | break; |
||
| 39 | } |
||
| 40 | 1 | } |
|
| 41 | |||
| 42 | 2 | return $inList; |
|
| 43 | } |
||
| 44 | } |
||
| 45 |