Conditions | 4 |
Paths | 5 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4.0119 |
Changes | 0 |
1 | <?php |
||
53 | public static function run($f, ...$args) |
||
54 | { |
||
55 | 1 | if($f instanceof self) { |
|
56 | 1 | $return = $f; |
|
57 | 1 | } else if(is_callable($f)) { |
|
58 | 1 | $return = call_user_func_array($f, $args); |
|
59 | 1 | } else { |
|
60 | 1 | throw new \RuntimeException('Expected a callable or an instance of Trampoline.'); |
|
61 | } |
||
62 | |||
63 | 1 | while($return instanceof self) { |
|
64 | 1 | $return = $return(); |
|
65 | 1 | } |
|
66 | |||
67 | 1 | return $return; |
|
68 | } |
||
69 | |||
81 | } |