Code Duplication    Length = 4-4 lines in 5 locations

src/SphinxClient.php 5 locations

@@ 1728-1731 (lines=4) @@
1725
        $len = 8 + strlen($req);
1726
        $req = pack('nnNNN', SEARCHD_COMMAND_SEARCH, VER_COMMAND_SEARCH, $len, 0, $nreqs) . $req; // add header
1727
1728
        if (!$this->send($fp, $req, $len + 8) || !($response = $this->getResponse($fp, VER_COMMAND_SEARCH))) {
1729
            $this->mbPop();
1730
            return false;
1731
        }
1732
1733
        // query sent ok; we can reset reqs now
1734
        $this->reqs = array();
@@ 2034-2037 (lines=4) @@
2031
2032
        $len = strlen($req);
2033
        $req = pack('nnN', SEARCHD_COMMAND_EXCERPT, VER_COMMAND_EXCERPT, $len) . $req; // add header
2034
        if (!$this->send($fp, $req, $len + 8) || !($response = $this->getResponse($fp, VER_COMMAND_EXCERPT))) {
2035
            $this->mbPop();
2036
            return false;
2037
        }
2038
2039
        //////////////////
2040
        // parse response
@@ 2107-2110 (lines=4) @@
2104
2105
        $len = strlen($req);
2106
        $req = pack('nnN', SEARCHD_COMMAND_KEYWORDS, VER_COMMAND_KEYWORDS, $len) . $req; // add header
2107
        if (!$this->send($fp, $req, $len + 8) || !($response = $this->getResponse($fp, VER_COMMAND_KEYWORDS))) {
2108
            $this->mbPop();
2109
            return false;
2110
        }
2111
2112
        //////////////////
2113
        // parse response
@@ 2321-2324 (lines=4) @@
2318
        }
2319
2320
        $req = pack('nnNN', SEARCHD_COMMAND_STATUS, VER_COMMAND_STATUS, 4, $session ? 0 : 1); // len=4, body=1
2321
        if (!$this->send($fp, $req, 12) || !($response = $this->getResponse($fp, VER_COMMAND_STATUS))) {
2322
            $this->mbPop();
2323
            return false;
2324
        }
2325
2326
        $res = substr($response, 4); // just ignore length, error handling, etc
2327
        $p = 0;
@@ 2361-2364 (lines=4) @@
2358
        }
2359
2360
        $req = pack('nnN', SEARCHD_COMMAND_FLUSHATTRS, VER_COMMAND_FLUSHATTRS, 0); // len=0
2361
        if (!$this->send($fp, $req, 8) || !($response = $this->getResponse($fp, VER_COMMAND_FLUSHATTRS))) {
2362
            $this->mbPop();
2363
            return -1;
2364
        }
2365
2366
        $tag = -1;
2367
        if (strlen($response) == 4) {