private function resolveInputEncoding($string)
    {
        $encoding = null;

        if ($this->detect) {
            $encoding = mb_detect_encoding($string, null, true);
        }

        // Fall back to the internal encoding
        if (false === $encoding || null === $encoding) {
            $encoding = mb_internal_encoding();
        }

        if (false === $encoding || null === $encoding) {
            throw EncodingDetectionException::forString($string);
        }

        return $encoding;
    }
private function resolveInputEncoding($string)
    {
        $encoding = null;

        if ($this->detect) {
            $encoding = mb_detect_encoding($string, null, true);
        }

        // Fall back to the internal encoding
        if (false === $encoding || null === $encoding) {
            $encoding = mb_internal_encoding();
        }

        if (false === $encoding || null === $encoding) {
            throw EncodingDetectionException::forString($string);
        }

        return $encoding;
    }
private function resolveInputEncoding ( $ string ) { $ encoding = null ; if ( $ this -> detect ) { $ encoding = mb_detect_encoding ( $ string , null , true ) ; } // Fall back to the internal encoding if ( false === $ encoding || null === $ encoding ) { $ encoding = mb_internal_encoding ( ) ; } if ( false === $ encoding || null === $ encoding ) { throw EncodingDetectionException :: forString ( $ string ) ; } return $ encoding ; }
Resolves the input encoding of a given string.

May attempt to detect the encoding, or may fall back to using the
internal encoding.

@param string $string The input string to resolve encoding from.
@return string The encoding "name".
@throws EncodingDetectionException If the detection fails.
Resolves the input encoding of a given string .