Code Duplication    Length = 5-5 lines in 3 locations

src/Server.php 1 location

@@ 499-503 (lines=5) @@
496
        // What if internal encoding is not in one of the 3 allowed? We use the broadest one, ie. utf8
497
        // This allows to send data which is native in various charset,
498
        // by extending xmlrpc_encode_entities() and setting xmlrpc_internalencoding
499
        if (!in_array(PhpXmlRpc::$xmlrpc_internalencoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) {
500
            $options = array(XML_OPTION_TARGET_ENCODING => 'UTF-8');
501
        } else {
502
            $options = array(XML_OPTION_TARGET_ENCODING => PhpXmlRpc::$xmlrpc_internalencoding);
503
        }
504
505
        $xmlRpcParser = new XMLParser($options);
506
        $xmlRpcParser->parse($data, $this->functions_parameters_type, XMLParser::ACCEPT_REQUEST);

src/Request.php 1 location

@@ 267-271 (lines=5) @@
264
        // What if internal encoding is not in one of the 3 allowed? We use the broadest one, ie. utf8
265
        // This allows to send data which is native in various charset, by extending xmlrpc_encode_entities() and
266
        // setting xmlrpc_internalencoding
267
        if (!in_array(PhpXmlRpc::$xmlrpc_internalencoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) {
268
            $options = array(XML_OPTION_TARGET_ENCODING => 'UTF-8');
269
        } else {
270
            $options = array(XML_OPTION_TARGET_ENCODING => PhpXmlRpc::$xmlrpc_internalencoding);
271
        }
272
273
        $xmlRpcParser = new XMLParser($options);
274
        $xmlRpcParser->parse($data, $returnType, XMLParser::ACCEPT_RESPONSE);

src/Encoder.php 1 location

@@ 257-261 (lines=5) @@
254
        }
255
256
        // What if internal encoding is not in one of the 3 allowed? We use the broadest one, ie. utf8!
257
        if (!in_array(PhpXmlRpc::$xmlrpc_internalencoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) {
258
            $options = array(XML_OPTION_TARGET_ENCODING => 'UTF-8');
259
        } else {
260
            $options = array(XML_OPTION_TARGET_ENCODING => PhpXmlRpc::$xmlrpc_internalencoding);
261
        }
262
263
        $xmlRpcParser = new XMLParser($options);
264
        $xmlRpcParser->parse($xmlVal, XMLParser::RETURN_XMLRPCVALS, XMLParser::ACCEPT_REQUEST | XMLParser::ACCEPT_RESPONSE | XMLParser::ACCEPT_VALUE);