Code Duplication    Length = 20-20 lines in 2 locations

admin/gateways/pec24/nusoap.php 2 locations

@@ 3041-3060 (lines=20) @@
3038
        $header_array = explode($lb,$header_data);
3039
        $this->incoming_headers = array();
3040
        $this->incoming_cookies = array();
3041
        foreach ($header_array as $header_line) {
3042
            $arr = explode(':',$header_line, 2);
3043
            if (count($arr) > 1) {
3044
                $header_name = strtolower(trim($arr[0]));
3045
                $this->incoming_headers[$header_name] = trim($arr[1]);
3046
                if ($header_name == 'set-cookie') {
3047
                    // TODO: allow multiple cookies from parseCookie
3048
                    $cookie = $this->parseCookie(trim($arr[1]));
3049
                    if ($cookie) {
3050
                        $this->incoming_cookies[] = $cookie;
3051
                        $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
3052
                    } else {
3053
                        $this->debug('did not find cookie in ' . trim($arr[1]));
3054
                    }
3055
                }
3056
            } else if (isset($header_name)) {
3057
                // append continuation line to previous header
3058
                $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
3059
            }
3060
        }
3061
3062
        // loop until msg has been received
3063
        if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') {
@@ 3225-3244 (lines=20) @@
3222
        $this->debug('found proper separation of headers and document');
3223
        $this->debug('cleaned data, stringlen: '.strlen($data));
3224
        // clean headers
3225
        foreach ($header_array as $header_line) {
3226
            $arr = explode(':',$header_line,2);
3227
            if (count($arr) > 1) {
3228
                $header_name = strtolower(trim($arr[0]));
3229
                $this->incoming_headers[$header_name] = trim($arr[1]);
3230
                if ($header_name == 'set-cookie') {
3231
                    // TODO: allow multiple cookies from parseCookie
3232
                    $cookie = $this->parseCookie(trim($arr[1]));
3233
                    if ($cookie) {
3234
                        $this->incoming_cookies[] = $cookie;
3235
                        $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
3236
                    } else {
3237
                        $this->debug('did not find cookie in ' . trim($arr[1]));
3238
                    }
3239
                }
3240
            } else if (isset($header_name)) {
3241
                // append continuation line to previous header
3242
                $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
3243
            }
3244
        }
3245
      }
3246
3247
        $this->response_status_line = $header_array[0];