| @@ 61-69 (lines=9) @@ | ||
| 58 | * @return int|float |
|
| 59 | * @throws \InvalidArgumentException |
|
| 60 | */ |
|
| 61 | public function subtract(...$args) |
|
| 62 | { |
|
| 63 | array_reduce($args, [$this, 'enforcePredicate'], [$this, 'isNumber']); |
|
| 64 | ||
| 65 | $arg = $args[0]; |
|
| 66 | $args = \array_slice($args, 1); |
|
| 67 | ||
| 68 | return $arg - array_sum($args); |
|
| 69 | } |
|
| 70 | ||
| 71 | /** |
|
| 72 | * Multiply the args |
|
| @@ 91-99 (lines=9) @@ | ||
| 88 | * @return int|float |
|
| 89 | * @throws \InvalidArgumentException |
|
| 90 | */ |
|
| 91 | public function divide(...$args) |
|
| 92 | { |
|
| 93 | array_reduce($args, [$this, 'enforcePredicate'], [$this, 'isNumber']); |
|
| 94 | ||
| 95 | $arg = $args[0]; |
|
| 96 | $args = \array_slice($args, 1); |
|
| 97 | ||
| 98 | return $arg / array_product($args); |
|
| 99 | } |
|
| 100 | ||
| 101 | /** |
|
| 102 | * Returns true if $a is greater than $b, otherwise false |
|