| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4.016 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | 6 | public function __call($method, $args) |
|
| 27 | { |
||
| 28 | 6 | if (in_array($method, ['to', 'in', 'into', 'as'])) { |
|
| 29 | 6 | return $this; |
|
| 30 | } |
||
| 31 | |||
| 32 | 6 | if ($method == 'and') { |
|
| 33 | 1 | return new Add($this->convert, $this->metric, $args[0]); |
|
| 34 | } |
||
| 35 | |||
| 36 | 6 | if (method_exists($this->metric, $method)) { |
|
| 37 | 5 | $rate = call_user_func([$this->metric, $method]); |
|
| 38 | |||
| 39 | 5 | return $this->convert->getValue() / $rate; |
|
| 40 | } |
||
| 41 | |||
| 42 | 1 | BadMethodCallException::throw($method, $this->metric, $this); |
|
| 43 | } |
||
| 44 | } |
||
| 45 |