private function decode($seed, $format = null)
    {
        $encoder = new RawEncoder();

        // Auto-detect
        if ($format === null) {
            if (preg_match('/^[0-9a-f]+$/i', $seed)) {
                $encoder = new HexEncoder();
            } elseif (preg_match('/^[2-7a-z]+$/i', $seed)) {
                $encoder = new Base32Encoder();
            }
        // User-specified
        } else {
            if ($format == self::FORMAT_HEX) {
                $encoder = new HexEncoder();
            } elseif ($format == self::FORMAT_BASE32) {
                $encoder = new Base32Encoder();
            }
        }

        $output = $encoder->decode($seed);

        return $output;
    }
private function decode($seed, $format = null)
    {
        $encoder = new RawEncoder();

        // Auto-detect
        if ($format === null) {
            if (preg_match('/^[0-9a-f]+$/i', $seed)) {
                $encoder = new HexEncoder();
            } elseif (preg_match('/^[2-7a-z]+$/i', $seed)) {
                $encoder = new Base32Encoder();
            }
        // User-specified
        } else {
            if ($format == self::FORMAT_HEX) {
                $encoder = new HexEncoder();
            } elseif ($format == self::FORMAT_BASE32) {
                $encoder = new Base32Encoder();
            }
        }

        $output = $encoder->decode($seed);

        return $output;
    }
private function decode ( $ seed , $ format = null ) { $ encoder = new RawEncoder ( ) ; // Auto-detect if ( $ format === null ) { if ( preg_match ( '/^[0-9a-f]+$/i' , $ seed ) ) { $ encoder = new HexEncoder ( ) ; } elseif ( preg_match ( '/^[2-7a-z]+$/i' , $ seed ) ) { $ encoder = new Base32Encoder ( ) ; } // User-specified } else { if ( $ format == self :: FORMAT_HEX ) { $ encoder = new HexEncoder ( ) ; } elseif ( $ format == self :: FORMAT_BASE32 ) { $ encoder = new Base32Encoder ( ) ; } } $ output = $ encoder -> decode ( $ seed ) ; return $ output ; }
Attempt to decode a seed value

@param  string  $seed   The encoded seed value.
@param  string  $format Optional; value encoding format. If not
provided, format will be auto-detected.
@return string  Returns the decoded seed value.
Attempt to decode a seed value