| Total Complexity | 7 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class MutableDecimal extends Decimal |
||
| 9 | {
|
||
| 10 | |||
| 11 | public function continuousModulo($mod) |
||
| 12 | {
|
||
| 13 | |||
| 14 | $mod = Numbers::makeOrDont(Numbers::IMMUTABLE, $mod, $this->precision+1); |
||
| 15 | $oldNum = Numbers::make(Numbers::IMMUTABLE, $this->getValue(), $this->precision+1); |
||
| 16 | |||
| 17 | $multiple = $oldNum->divide($mod)->floor(); |
||
| 18 | |||
| 19 | $remainder = $oldNum->subtract($mod->multiply($multiple)); |
||
| 20 | |||
| 21 | return Numbers::make(Numbers::MUTABLE, $remainder->truncate($this->precision)->getValue()); |
||
| 22 | |||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param string $value |
||
| 27 | * |
||
| 28 | * @return MutableDecimal |
||
| 29 | */ |
||
| 30 | protected function setValue(string $value, int $precision = null, int $base = 10) |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @return bool |
||
| 58 | */ |
||
| 59 | public function isComplex(): bool |
||
| 62 | } |
||
| 63 | |||
| 64 | } |