Example #1
0
 /**
  *
  * @param Input\Arabic $inputObject
  * @return string
  */
 protected function convert(Input\Arabic $inputObject)
 {
     $input = (string) $inputObject->getValue();
     $return = '';
     $table = $this->getTableArabicToMongolian();
     foreach ($this->utf8StrSplit($input) as $numeral) {
         if (isset($table[$numeral])) {
             $return .= $table[$numeral];
         } else {
             throw new \Exception(sprintf('Unspecified numeral "%s".', $numeral));
         }
     }
     return $return;
 }
Example #2
0
 /**
  *
  * @param Input\Arabic $inputObject
  * @return string
  */
 protected function convert(Input\Arabic $inputObject)
 {
     $input = (int) $inputObject->getValue();
     $return = '';
     while ($input > 0) {
         foreach ($this->getTableRomanToArabic() as $rom => $arb) {
             if ($input >= $arb) {
                 $input -= $arb;
                 $return .= $rom;
                 break;
             }
         }
     }
     return $return;
 }