Conditions | 2 |
Paths | 1 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
10 | function ifelse() |
||
11 | { |
||
12 | 1 | $args = func_get_args(); |
|
13 | |||
14 | $ifelse = function ($condition, $onTrue, $onFalse) { |
||
15 | return function ($args) use ($condition, $onTrue, $onFalse) { |
||
16 | 1 | if (call_user_func($condition, $args)) { |
|
17 | 1 | return call_user_func($onTrue, $args); |
|
18 | } |
||
19 | |||
20 | 1 | return call_user_func($onFalse, $args); |
|
21 | 1 | }; |
|
22 | 1 | }; |
|
23 | |||
24 | 1 | return call_user_func_array(curry($ifelse), $args); |
|
25 | } |
||
26 |