Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
45 | public function compareTo($other) |
||
46 | { |
||
47 | if ($other instanceof self) { |
||
48 | return $this->value() - $other->value(); |
||
49 | } |
||
50 | |||
51 | if (\is_numeric($other)) { |
||
52 | return $this->compareTo(new self($other)); |
||
53 | } |
||
54 | |||
55 | throw new \InvalidArgumentException(sprintf( |
||
56 | 'Argument "%s" is invalid. Allowed types for argument are "%s" or numeric values.', |
||
57 | $other, |
||
58 | self::class |
||
59 | )); |
||
60 | } |
||
61 | } |
||
62 |