| 1 |  |  | <?php
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Samsara\Fermat\Values;
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Samsara\Fermat\Numbers;
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Samsara\Fermat\Types\Decimal;
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | class ImmutableDecimal extends Decimal
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | {
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 | 16 |  |     public function continuousModulo($mod)
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |     {
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 | 16 |  |         if (is_object($mod) && method_exists($mod, 'getPrecision')) {
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 | 15 |  |             $precision = ($this->getPrecision() < $mod->getPrecision()) ? $mod->getPrecision() : $this->getPrecision();
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |         } else {
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 | 4 |  |             $precision = $this->getPrecision();
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |         }
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 | 16 |  |         $oldPrecision = $this->precision;
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 | 16 |  |         $newPrecision = $precision+1;
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 | 16 |  |         $this->precision = $newPrecision;
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 | 16 |  |         if (is_object($mod) && method_exists($mod, 'truncateToPrecision')) {
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 | 15 |  |             $mod = $mod->truncateToPrecision($newPrecision);
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |         } else {
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 | 4 |  |             $mod = Numbers::make(Numbers::IMMUTABLE, $mod, $newPrecision);
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |         }
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 | 16 |  |         $multiple = $this->divide($mod)->floor();
 | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 | 16 |  |         $remainder = $this->subtract($mod->multiply($multiple));
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 | 16 |  |         $this->precision = $oldPrecision;
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 | 16 |  |         return $remainder->truncateToPrecision($oldPrecision);
 | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     }
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     /**
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |      * @return bool
 | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 43 |  |  |      */
 | 
            
                                                                        
                            
            
                                    
            
            
                | 44 | 53 |  |     public function isComplex(): bool
 | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  |     {
 | 
            
                                                                        
                            
            
                                    
            
            
                | 46 | 53 |  |         return false;
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |     }
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |     /**
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |      * @param string $value
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |      * @param int $precision
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      * @param int $base
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |      *
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |      * @return ImmutableDecimal
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |      */
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 | 69 |  |     protected function setValue(string $value, int $precision = null, int $base = 10)
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     {
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 | 69 |  |         $imaginary = false;
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 | 69 |  |         if (strpos($value, 'i') !== false) {
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 | 1 |  |             $value = str_replace('i', '', $value);
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 | 1 |  |             $imaginary = true;
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |         }
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 | 69 |  |         if ($base != 10 || $this->getBase() != 10) {
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 | 3 |  |             $base = $base == 10 ? $this->getBase() : $base;
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 | 3 |  |             $value = $this->convertValue($value, 10, $base);
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         }
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 | 69 |  |         if ($imaginary) {
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 | 1 |  |             $value .= 'i';
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |         }
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 | 69 |  |         if (is_null($precision)) {
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 | 62 |  |             $precision = $this->getPrecision();
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |         }
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  | 
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 | 69 |  |         return new ImmutableDecimal($value, $precision, $base);
 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     }
 | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 80 |  |  | 
 | 
            
                                                        
            
                                    
            
            
                | 81 |  |  | } | 
            
                        
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.