Code Duplication    Length = 5-5 lines in 3 locations

src/Request.php 1 location

@@ 272-276 (lines=5) @@
269
        // we use the broadest one, ie. utf8
270
        // This allows to send data which is native in various charset,
271
        // by extending xmlrpc_encode_entities() and setting xmlrpc_internalencoding
272
        if (!in_array(PhpXmlRpc::$xmlrpc_internalencoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) {
273
            xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
274
        } else {
275
            xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, PhpXmlRpc::$xmlrpc_internalencoding);
276
        }
277
278
        $xmlRpcParser = new XMLParser();
279
        xml_set_object($parser, $xmlRpcParser);

src/Server.php 1 location

@@ 501-505 (lines=5) @@
498
        // we use the broadest one, ie. utf8
499
        // This allows to send data which is native in various charset,
500
        // by extending xmlrpc_encode_entities() and setting xmlrpc_internalencoding
501
        if (!in_array(PhpXmlRpc::$xmlrpc_internalencoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) {
502
            xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
503
        } else {
504
            xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, PhpXmlRpc::$xmlrpc_internalencoding);
505
        }
506
507
        $xmlRpcParser = new XMLParser();
508
        xml_set_object($parser, $xmlRpcParser);

src/Encoder.php 1 location

@@ 263-267 (lines=5) @@
260
        xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
261
        // What if internal encoding is not in one of the 3 allowed?
262
        // we use the broadest one, ie. utf8!
263
        if (!in_array(PhpXmlRpc::$xmlrpc_internalencoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) {
264
            xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
265
        } else {
266
            xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, PhpXmlRpc::$xmlrpc_internalencoding);
267
        }
268
269
        $xmlRpcParser = new XMLParser();
270
        xml_set_object($parser, $xmlRpcParser);