示例#1
0
 private static function parseNumber($text, $parsed, $multiplier, $errorText)
 {
     // regex limits to [-+]?[0-9]+
     if ($parsed === null || $parsed === '') {
         return 0;
     }
     try {
         $val = Long::parseLong($parsed);
         return Math::multiplyExact($val, $multiplier);
     } catch (\Exception $ex) {
         throw new DateTimeParseException("Text cannot be parsed to a Duration: " . $errorText, $text, 0, $ex);
     }
 }