| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3.009 |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | 7 | public function __call($method, $args) |
|
| 32 | { |
||
| 33 | 7 | if (in_array($method, ['from', 'of'])) { |
|
| 34 | 7 | $this->value = $args[0]; |
|
| 35 | 7 | return $this; |
|
| 36 | } |
||
| 37 | |||
| 38 | 7 | if (method_exists($this->metric, $method)) { |
|
| 39 | 6 | $rate = call_user_func([$this->metric, $method]); |
|
| 40 | |||
| 41 | 6 | $this->convert->setValue($rate * $this->value); |
|
| 42 | |||
| 43 | 6 | return new To($this->convert, $this->metric); |
|
| 44 | } |
||
| 45 | |||
| 46 | 1 | BadMethodCallException::throw($method, $this->metric, $this); |
|
| 47 | } |
||
| 48 | } |
||
| 49 |