Example #1
0
 /**
  * Transforms a given (big) number to a string value, based on the set alphabet.
  *
  * @param BigNumber $number
  *
  * @return string
  *
  * @throws ArithmeticException
  */
 private function numToString(BigNumber $number)
 {
     $output = '';
     while ($number->getValue() > 0) {
         $previousNumber = clone $number;
         $number = $number->divide($this->alphabetLength);
         $digit = $previousNumber->mod($this->alphabetLength);
         $output .= $this->alphabet[$digit->getValue()];
     }
     return $output;
 }