Conditions | 4 |
Paths | 10 |
Total Lines | 23 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | 15 | public static function funcSeriesSum($x, $n, $m, ...$args) |
|
23 | { |
||
24 | try { |
||
25 | 15 | $x = Helpers::validateNumericNullSubstitution($x, 0); |
|
26 | 13 | $n = Helpers::validateNumericNullSubstitution($n, 0); |
|
27 | 12 | $m = Helpers::validateNumericNullSubstitution($m, 0); |
|
28 | |||
29 | // Loop through arguments |
||
30 | 11 | $aArgs = Functions::flattenArray($args); |
|
31 | 11 | $returnValue = 0; |
|
32 | 11 | $i = 0; |
|
33 | 11 | foreach ($aArgs as $argx) { |
|
34 | 11 | if ($argx !== null) { |
|
35 | 11 | $arg = Helpers::validateNumericNullSubstitution($argx, 0); |
|
36 | 11 | $returnValue += $arg * $x ** ($n + ($m * $i)); |
|
37 | 11 | ++$i; |
|
38 | } |
||
39 | } |
||
40 | 6 | } catch (Exception $e) { |
|
41 | 6 | return $e->getMessage(); |
|
42 | } |
||
43 | |||
44 | 9 | return $returnValue; |
|
45 | } |
||
47 |