Conditions | 5 |
Paths | 7 |
Total Lines | 22 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
24 | 81 | public static function funcFact($factVal) |
|
25 | { |
||
26 | try { |
||
27 | 81 | $factVal = Helpers::validateNumericNullBool($factVal); |
|
28 | 79 | Helpers::validateNotNegative($factVal); |
|
29 | 4 | } catch (Exception $e) { |
|
30 | 4 | return $e->getMessage(); |
|
31 | } |
||
32 | |||
33 | 77 | $factLoop = floor($factVal); |
|
34 | 77 | if ($factVal > $factLoop) { |
|
35 | 5 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
|
36 | 2 | return Statistical::GAMMAFunction($factVal + 1); |
|
37 | } |
||
38 | } |
||
39 | |||
40 | 75 | $factorial = 1; |
|
41 | 75 | while ($factLoop > 1) { |
|
42 | 69 | $factorial *= $factLoop--; |
|
43 | } |
||
44 | |||
45 | 75 | return $factorial; |
|
46 | } |
||
48 |