src/Robin/Ntlm/Encoding/Exception/EncodingConversionFailureException.php
public static function forStringAndEncodings(
        $string,
        $from_encoding,
        $to_encoding,
        $code = self::CODE_FOR_STRING_AND_ENCODING_INFO,
        Exception $previous = null
    ) {
        $message = self::DEFAULT_MESSAGE
            . sprintf(self::MESSAGE_EXTENSION_FOR_STRING_FORMAT, $string)
            . sprintf(self::MESSAGE_EXTENSION_FOR_ENCODING_INFO_FORMAT, $from_encoding, $to_encoding);

        return new static($message, $code, $previous);
    }
public static function forStringAndEncodings(
        $string,
        $from_encoding,
        $to_encoding,
        $code = self::CODE_FOR_STRING_AND_ENCODING_INFO,
        Exception $previous = null
    ) {
        $message = self::DEFAULT_MESSAGE
            . sprintf(self::MESSAGE_EXTENSION_FOR_STRING_FORMAT, $string)
            . sprintf(self::MESSAGE_EXTENSION_FOR_ENCODING_INFO_FORMAT, $from_encoding, $to_encoding);

        return new static($message, $code, $previous);
    }
Creates an exception instance for a given string and encoding information.

@param string $string The string that failed to convert the encoding of.
@param string $from_encoding The encoding that the string was being
converted from.
@param string $to_encoding The encoding that the string was being
converted to.
@param int $code The exception code.
@param Exception|null $previous A previous exception used for chaining.
@return static