Code Duplication    Length = 20-20 lines in 2 locations

admin/gateways/pec24/nusoap.php 2 locations

@@ 3260-3279 (lines=20) @@
3257
            $header_array           = explode($lb, $header_data);
3258
            $this->incoming_headers = array();
3259
            $this->incoming_cookies = array();
3260
            foreach ($header_array as $header_line) {
3261
                $arr = explode(':', $header_line, 2);
3262
                if (count($arr) > 1) {
3263
                    $header_name                          = strtolower(trim($arr[0]));
3264
                    $this->incoming_headers[$header_name] = trim($arr[1]);
3265
                    if ($header_name === 'set-cookie') {
3266
                        // TODO: allow multiple cookies from parseCookie
3267
                        $cookie = $this->parseCookie(trim($arr[1]));
3268
                        if ($cookie) {
3269
                            $this->incoming_cookies[] = $cookie;
3270
                            $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
3271
                        } else {
3272
                            $this->debug('did not find cookie in ' . trim($arr[1]));
3273
                        }
3274
                    }
3275
                } elseif (isset($header_name)) {
3276
                    // append continuation line to previous header
3277
                    $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
3278
                }
3279
            }
3280
3281
            // loop until msg has been received
3282
            if (isset($this->incoming_headers['transfer-encoding'])
@@ 3445-3464 (lines=20) @@
3442
            $this->debug('found proper separation of headers and document');
3443
            $this->debug('cleaned data, stringlen: ' . strlen($data));
3444
            // clean headers
3445
            foreach ($header_array as $header_line) {
3446
                $arr = explode(':', $header_line, 2);
3447
                if (count($arr) > 1) {
3448
                    $header_name                          = strtolower(trim($arr[0]));
3449
                    $this->incoming_headers[$header_name] = trim($arr[1]);
3450
                    if ($header_name === 'set-cookie') {
3451
                        // TODO: allow multiple cookies from parseCookie
3452
                        $cookie = $this->parseCookie(trim($arr[1]));
3453
                        if ($cookie) {
3454
                            $this->incoming_cookies[] = $cookie;
3455
                            $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
3456
                        } else {
3457
                            $this->debug('did not find cookie in ' . trim($arr[1]));
3458
                        }
3459
                    }
3460
                } elseif (isset($header_name)) {
3461
                    // append continuation line to previous header
3462
                    $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
3463
                }
3464
            }
3465
        }
3466
3467
        $this->response_status_line = $header_array[0];