Code Duplication    Length = 20-23 lines in 2 locations

lib/xmlrpc_wrappers.inc 1 location

@@ 221-243 (lines=23) @@
218
/**
219
 * @deprecated
220
 */
221
function build_client_wrapper_code($client, $verbatim_client_copy, $prefix='xmlrpc')
222
{
223
    $code = "\$client = new {$prefix}_client('".str_replace("'", "\'", $client->path).
224
        "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n";
225
226
    // copy all client fields to the client that will be generated runtime
227
    // (this provides for future expansion or subclassing of client obj)
228
    if ($verbatim_client_copy)
229
    {
230
        foreach($client as $fld => $val)
231
        {
232
            if($fld != 'debug' && $fld != 'return_type')
233
            {
234
                $val = var_export($val, true);
235
                $code .= "\$client->$fld = $val;\n";
236
            }
237
        }
238
    }
239
    // only make sure that client always returns the correct data type
240
    $code .= "\$client->return_type = '{$prefix}vals';\n";
241
    //$code .= "\$client->setDebug(\$debug);\n";
242
    return $code;
243
}
244

src/Wrapper.php 1 location

@@ 1098-1117 (lines=20) @@
1095
     *
1096
     * @return string
1097
     */
1098
    protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\' )
1099
    {
1100
        $code = "\$client = new {$namespace}Client('" . str_replace("'", "\'", $client->path) .
1101
            "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n";
1102
1103
        // copy all client fields to the client that will be generated runtime
1104
        // (this provides for future expansion or subclassing of client obj)
1105
        if ($verbatimClientCopy) {
1106
            foreach ($client as $fld => $val) {
1107
                if ($fld != 'debug' && $fld != 'return_type') {
1108
                    $val = var_export($val, true);
1109
                    $code .= "\$client->$fld = $val;\n";
1110
                }
1111
            }
1112
        }
1113
        // only make sure that client always returns the correct data type
1114
        $code .= "\$client->return_type = '{$prefix}vals';\n";
1115
        //$code .= "\$client->setDebug(\$debug);\n";
1116
        return $code;
1117
    }
1118
}
1119