Code Duplication    Length = 20-20 lines in 2 locations

admin/gateways/pec24/nusoap.php 2 locations

@@ 3233-3252 (lines=20) @@
3230
            $header_array           = explode($lb, $header_data);
3231
            $this->incoming_headers = array();
3232
            $this->incoming_cookies = array();
3233
            foreach ($header_array as $header_line) {
3234
                $arr = explode(':', $header_line, 2);
3235
                if (count($arr) > 1) {
3236
                    $header_name                          = strtolower(trim($arr[0]));
3237
                    $this->incoming_headers[$header_name] = trim($arr[1]);
3238
                    if ($header_name === 'set-cookie') {
3239
                        // TODO: allow multiple cookies from parseCookie
3240
                        $cookie = $this->parseCookie(trim($arr[1]));
3241
                        if ($cookie) {
3242
                            $this->incoming_cookies[] = $cookie;
3243
                            $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
3244
                        } else {
3245
                            $this->debug('did not find cookie in ' . trim($arr[1]));
3246
                        }
3247
                    }
3248
                } elseif (isset($header_name)) {
3249
                    // append continuation line to previous header
3250
                    $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
3251
                }
3252
            }
3253
3254
            // loop until msg has been received
3255
            if (isset($this->incoming_headers['transfer-encoding'])
@@ 3420-3439 (lines=20) @@
3417
            $this->debug('found proper separation of headers and document');
3418
            $this->debug('cleaned data, stringlen: ' . strlen($data));
3419
            // clean headers
3420
            foreach ($header_array as $header_line) {
3421
                $arr = explode(':', $header_line, 2);
3422
                if (count($arr) > 1) {
3423
                    $header_name                          = strtolower(trim($arr[0]));
3424
                    $this->incoming_headers[$header_name] = trim($arr[1]);
3425
                    if ($header_name === 'set-cookie') {
3426
                        // TODO: allow multiple cookies from parseCookie
3427
                        $cookie = $this->parseCookie(trim($arr[1]));
3428
                        if ($cookie) {
3429
                            $this->incoming_cookies[] = $cookie;
3430
                            $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
3431
                        } else {
3432
                            $this->debug('did not find cookie in ' . trim($arr[1]));
3433
                        }
3434
                    }
3435
                } elseif (isset($header_name)) {
3436
                    // append continuation line to previous header
3437
                    $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
3438
                }
3439
            }
3440
        }
3441
3442
        $this->response_status_line = $header_array[0];