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/Encoder.php 1 location

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