Factorial   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 18
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A factorialize() 0 14 3
1
<?php
2
3
namespace Vehsamrak\Factorial;
4
5
/**
6
 * @author Vehsamrak
7
 */
8
class Factorial
9
{
10
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