| Conditions | 4 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | 4 | public static function fact($number) |
|
| 26 | { |
||
| 27 | 4 | $number = (int) floor($number); |
|
| 28 | 4 | if ($number == 0) { |
|
| 29 | 1 | return 1; |
|
| 30 | 4 | } elseif ($number < 0) { |
|
| 31 | 1 | return false; |
|
| 32 | } |
||
| 33 | 4 | $result = 1; |
|
| 34 | 4 | foreach (Arrays::rangeGenerator(1, $number) as $num) { |
|
| 35 | 4 | $result *= $num; |
|
| 36 | } |
||
| 37 | 4 | return $result; |
|
| 38 | } |
||
| 76 |