original_string: private function round($number)
      {
          if (null !== $this->scale && null !== $this->roundingMode) {
              // shift number to maintain the correct scale during rounding
              $roundingCoef = pow(10, $this->scale);
              // string representation to avoid rounding errors, similar to bcmul()
              $number = (string) ($number * $roundingCoef);
  
              switch ($this->roundingMode) {
                  case self::ROUND_CEILING:
                      $number = ceil($number);
                      break;
                  case self::ROUND_FLOOR:
                      $number = floor($number);
                      break;
                  case self::ROUND_UP:
                      $number = $number > 0 ? ceil($number) : floor($number);
                      break;
                  case self::ROUND_DOWN:
                      $number = $number > 0 ? floor($number) : ceil($number);
                      break;
                  case self::ROUND_HALF_EVEN:
                      $number = round($number, 0, PHP_ROUND_HALF_EVEN);
                      break;
                  case self::ROUND_HALF_UP:
                      $number = round($number, 0, PHP_ROUND_HALF_UP);
                      break;
                  case self::ROUND_HALF_DOWN:
                      $number = round($number, 0, PHP_ROUND_HALF_DOWN);
                      break;
              }
  
              $number /= $roundingCoef;
          }
  
          return $number;
      }
code: private function round($number)
      {
          if (null !== $this->scale && null !== $this->roundingMode) {
              // shift number to maintain the correct scale during rounding
              $roundingCoef = pow(10, $this->scale);
              // string representation to avoid rounding errors, similar to bcmul()
              $number = (string) ($number * $roundingCoef);
  
              switch ($this->roundingMode) {
                  case self::ROUND_CEILING:
                      $number = ceil($number);
                      break;
                  case self::ROUND_FLOOR:
                      $number = floor($number);
                      break;
                  case self::ROUND_UP:
                      $number = $number > 0 ? ceil($number) : floor($number);
                      break;
                  case self::ROUND_DOWN:
                      $number = $number > 0 ? floor($number) : ceil($number);
                      break;
                  case self::ROUND_HALF_EVEN:
                      $number = round($number, 0, PHP_ROUND_HALF_EVEN);
                      break;
                  case self::ROUND_HALF_UP:
                      $number = round($number, 0, PHP_ROUND_HALF_UP);
                      break;
                  case self::ROUND_HALF_DOWN:
                      $number = round($number, 0, PHP_ROUND_HALF_DOWN);
                      break;
              }
  
              $number /= $roundingCoef;
          }
  
          return $number;
      }
code_tokens: private function round ( $ number ) { if ( null !== $ this -> scale && null !== $ this -> roundingMode ) { // shift number to maintain the correct scale during rounding $ roundingCoef = pow ( 10 , $ this -> scale ) ; // string representation to avoid rounding errors, similar to bcmul() $ number = ( string ) ( $ number * $ roundingCoef ) ; switch ( $ this -> roundingMode ) { case self :: ROUND_CEILING : $ number = ceil ( $ number ) ; break ; case self :: ROUND_FLOOR : $ number = floor ( $ number ) ; break ; case self :: ROUND_UP : $ number = $ number > 0 ? ceil ( $ number ) : floor ( $ number ) ; break ; case self :: ROUND_DOWN : $ number = $ number > 0 ? floor ( $ number ) : ceil ( $ number ) ; break ; case self :: ROUND_HALF_EVEN : $ number = round ( $ number , 0 , PHP_ROUND_HALF_EVEN ) ; break ; case self :: ROUND_HALF_UP : $ number = round ( $ number , 0 , PHP_ROUND_HALF_UP ) ; break ; case self :: ROUND_HALF_DOWN : $ number = round ( $ number , 0 , PHP_ROUND_HALF_DOWN ) ; break ; } $ number /= $ roundingCoef ; } return $ number ; }
docstring: Rounds a number according to the configured scale and rounding mode.
  
  @param int|float $number A number
  
  @return int|float The rounded number
docstring_tokens: Rounds a number according to the configured scale and rounding mode .