protected static function internalDecode($string, $errmode = self::NORMALIZE_ERRMODE_SILENT, $isChecksum = false)
    {
        if ('' === $string) {
            return '';
        }

        if (null === $string) {
            return '';
        }

        $string = static::normalize($string, $errmode);

        if ($isChecksum) {
            $valid = '/^[A-Z0-9\*\~\$=U]$/';
        } else {
            $valid = '/^[A-TV-Z0-9]+$/';
        }

        if (!preg_match($valid, $string)) {
            throw new \RuntimeException("String '$string' contains invalid characters");
        }

        $total = 0;
        foreach (str_split($string) as $symbol) {
            $total = $total * 32 + static::$flippedSymbols[$symbol];
        }

        return $total;
    }
protected static function internalDecode($string, $errmode = self::NORMALIZE_ERRMODE_SILENT, $isChecksum = false)
    {
        if ('' === $string) {
            return '';
        }

        if (null === $string) {
            return '';
        }

        $string = static::normalize($string, $errmode);

        if ($isChecksum) {
            $valid = '/^[A-Z0-9\*\~\$=U]$/';
        } else {
            $valid = '/^[A-TV-Z0-9]+$/';
        }

        if (!preg_match($valid, $string)) {
            throw new \RuntimeException("String '$string' contains invalid characters");
        }

        $total = 0;
        foreach (str_split($string) as $symbol) {
            $total = $total * 32 + static::$flippedSymbols[$symbol];
        }

        return $total;
    }
protected static function internalDecode ( $ string , $ errmode = self :: NORMALIZE_ERRMODE_SILENT , $ isChecksum = false ) { if ( '' === $ string ) { return '' ; } if ( null === $ string ) { return '' ; } $ string = static :: normalize ( $ string , $ errmode ) ; if ( $ isChecksum ) { $ valid = '/^[A-Z0-9\*\~\$=U]$/' ; } else { $ valid = '/^[A-TV-Z0-9]+$/' ; } if ( ! preg_match ( $ valid , $ string ) ) { throw new \ RuntimeException ( "String '$string' contains invalid characters" ) ; } $ total = 0 ; foreach ( str_split ( $ string ) as $ symbol ) { $ total = $ total * 32 + static :: $ flippedSymbols [ $ symbol ] ; } return $ total ; }
Decode a string

@param string $string     Encoded string
@param int    $errmode    Error mode
@param bool   $isChecksum Is encoded with a checksum?

@return int

@throws \RuntimeException
Decode a string