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

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