Conditions | 3 |
Paths | 7 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | 8 | public static function funcMultinomial(...$args) |
|
20 | { |
||
21 | 8 | $summer = 0; |
|
22 | 8 | $divisor = 1; |
|
23 | |||
24 | try { |
||
25 | // Loop through arguments |
||
26 | 8 | foreach (Functions::flattenArray($args) as $argx) { |
|
27 | 8 | $arg = Helpers::validateNumericNullSubstitution($argx, null); |
|
28 | 8 | Helpers::validateNotNegative($arg); |
|
29 | 8 | $arg = (int) $arg; |
|
30 | 8 | $summer += $arg; |
|
31 | 8 | $divisor *= Fact::funcFact($arg); |
|
32 | } |
||
33 | 4 | } catch (Exception $e) { |
|
34 | 4 | return $e->getMessage(); |
|
35 | } |
||
36 | |||
37 | 4 | $summer = Fact::funcFact($summer); |
|
38 | |||
39 | 4 | return $summer / $divisor; |
|
40 | } |
||
42 |