| Conditions | 3 | 
| Paths | 3 | 
| Total Lines | 14 | 
| Code Lines | 7 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 7 | 
| CRAP Score | 3 | 
| Changes | 0 | ||
| 1 | <?php | ||
| 11 | 17 | public function factorialize(int $integer): int | |
| 12 |     { | ||
| 13 | 17 |         if ($integer < 0) { | |
| 14 | 10 |             throw new \InvalidArgumentException('Negative number can not be processed!'); | |
| 15 | } | ||
| 16 | |||
| 17 | 7 | $factorial = 1; | |
| 18 | |||
| 19 | 7 |         for ($i = 1; $i <= $integer; $i++) { | |
| 20 | 6 | $factorial *= $i; | |
| 21 | }; | ||
| 22 | |||
| 23 | 7 | return $factorial; | |
| 24 | } | ||
| 25 | } | ||
| 26 |