| Conditions | 3 |
| Paths | 3 |
| Total Lines | 7 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 28 | public function isAllowed($parameter = null): bool { |
||
| 29 | 1 | if(!is_string($parameter)) { |
|
| 30 | 1 | throw new \InvalidArgumentException("Method " . __METHOD__ . " expects string as parameter."); |
|
| 31 | 1 | } elseif(!str_contains($parameter, ":")) { |
|
| 32 | 1 | throw new \OutOfBoundsException("Method " . __METHOD__ . " expects parameter in format resource:privilege."); |
|
| 33 | } |
||
| 34 | 1 | return $this->user->isAllowed(Strings::before($parameter, ":"), Strings::after($parameter, ":")); |
|
| 35 | } |
||
| 37 | ?> |