Conditions | 3 |
Paths | 3 |
Total Lines | 9 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
17 | public function isAllowed($parameter = null): bool { |
||
18 | 1 | if(!is_callable($parameter)) { |
|
19 | 1 | throw new \InvalidArgumentException("Method " . __METHOD__ . " expects callback as parameter."); |
|
20 | } |
||
21 | 1 | $result = call_user_func($parameter); |
|
1 ignored issue
–
show
|
|||
22 | 1 | if(!is_bool($result)) { |
|
23 | 1 | throw new \UnexpectedValueException("The callback for method " . __METHOD__ . " has to return boolean, " . gettype($result) . " returned."); |
|
24 | } |
||
25 | 1 | return $result; |
|
26 | } |
||
28 | ?> |