| Total Complexity | 4 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class MutableNumber extends Number implements NumberInterface, DecimalInterface |
||
| 11 | {
|
||
| 12 | |||
| 13 | 1 | public function modulo($mod) |
|
| 18 | } |
||
| 19 | |||
| 20 | 1 | public function continuousModulo($mod) |
|
| 21 | {
|
||
| 22 | |||
| 23 | 1 | $mod = Numbers::makeOrDont(Numbers::IMMUTABLE, $mod, $this->precision+1); |
|
| 24 | 1 | $oldNum = Numbers::make(Numbers::IMMUTABLE, $this->getValue(), $this->precision+1); |
|
| 25 | |||
| 26 | 1 | $multiple = $oldNum->divide($mod)->floor(); |
|
| 27 | |||
| 28 | 1 | $remainder = $oldNum->subtract($mod->multiply($multiple)); |
|
| 29 | |||
| 30 | 1 | return Numbers::make(Numbers::MUTABLE, $remainder->truncate($this->precision)->getValue()); |
|
| 31 | |||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param $value |
||
| 36 | * |
||
| 37 | * @return MutableNumber |
||
| 38 | */ |
||
| 39 | 2 | protected function setValue($value) |
|
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @return bool |
||
| 48 | */ |
||
| 49 | public function isComplex(): bool |
||
| 54 | } |