Code Duplication    Length = 11-12 lines in 2 locations

src/Helper/Http.php 2 locations

@@ 80-90 (lines=11) @@
77
            // Look for CR/LF or simple LF as line separator,
78
            // (even though it is not valid http)
79
            $pos = strpos($data, "\r\n\r\n");
80
            if ($pos || is_int($pos)) {
81
                $bd = $pos + 4;
82
            } else {
83
                $pos = strpos($data, "\n\n");
84
                if ($pos || is_int($pos)) {
85
                    $bd = $pos + 2;
86
                } else {
87
                    // No separation between response headers and body: fault?
88
                    $bd = 0;
89
                }
90
            }
91
            if ($bd) {
92
                // this filters out all http headers from proxy.
93
                // maybe we could take them into account, too?
@@ 131-142 (lines=12) @@
128
        // be tolerant to usage of \n instead of \r\n to separate headers and data
129
        // (even though it is not valid http)
130
        $pos = strpos($data, "\r\n\r\n");
131
        if ($pos || is_int($pos)) {
132
            $bd = $pos + 4;
133
        } else {
134
            $pos = strpos($data, "\n\n");
135
            if ($pos || is_int($pos)) {
136
                $bd = $pos + 2;
137
            } else {
138
                // No separation between response headers and body: fault?
139
                // we could take some action here instead of going on...
140
                $bd = 0;
141
            }
142
        }
143
144
        // be tolerant to line endings, and extra empty lines
145
        $ar = preg_split("/\r?\n/", trim(substr($data, 0, $pos)));