| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 8 | public function run(array $args) |
|
| 18 | { |
||
| 19 | 8 | if (!isset($args[0])) { |
|
| 20 | 1 | return $this->newReturnType('Number', 0); |
|
| 21 | } |
||
| 22 | 8 | $this->expectArguments('*', [0 => ['Number']], $args); |
|
| 23 | 7 | $value = $args[0]->value(); |
|
| 24 | 7 | array_shift($args); |
|
| 25 | 7 | foreach ($args as $number) { |
|
| 26 | 6 | if (!$this->isDesmondType('Number', $number)) { |
|
| 27 | 1 | throw new ArgumentException('"*" expects all arguments to be Numbers.'); |
|
| 28 | } |
||
| 29 | 5 | $value *= $number->value(); |
|
| 30 | } |
||
| 31 | 6 | return $this->newReturnType('Number', $value); |
|
| 32 | } |
||
| 33 | } |
||
| 34 |