Code Duplication    Length = 4-4 lines in 5 locations

src/SphinxClient.php 5 locations

@@ 1311-1314 (lines=4) @@
1308
        $len = 8 + strlen($req);
1309
        $req = pack('nnNNN', SEARCHD_COMMAND_SEARCH, VER_COMMAND_SEARCH, $len, 0, $nreqs) . $req; // add header
1310
1311
        if (!$this->send($fp, $req, $len + 8) || !($response = $this->getResponse($fp, VER_COMMAND_SEARCH))) {
1312
            $this->mbPop();
1313
            return false;
1314
        }
1315
1316
        // query sent ok; we can reset reqs now
1317
        $this->reqs = array();
@@ 1643-1646 (lines=4) @@
1640
1641
        $len = strlen($req);
1642
        $req = pack('nnN', SEARCHD_COMMAND_EXCERPT, VER_COMMAND_EXCERPT, $len) . $req; // add header
1643
        if (!$this->send($fp, $req, $len + 8) || !($response = $this->getResponse($fp, VER_COMMAND_EXCERPT))) {
1644
            $this->mbPop();
1645
            return false;
1646
        }
1647
1648
        //////////////////
1649
        // parse response
@@ 1708-1711 (lines=4) @@
1705
1706
        $len = strlen($req);
1707
        $req = pack('nnN', SEARCHD_COMMAND_KEYWORDS, VER_COMMAND_KEYWORDS, $len) . $req; // add header
1708
        if (!$this->send($fp, $req, $len + 8) || !($response = $this->getResponse($fp, VER_COMMAND_KEYWORDS))) {
1709
            $this->mbPop();
1710
            return false;
1711
        }
1712
1713
        //////////////////
1714
        // parse response
@@ 1898-1901 (lines=4) @@
1895
        }
1896
1897
        $req = pack('nnNN', SEARCHD_COMMAND_STATUS, VER_COMMAND_STATUS, 4, $session ? 0 : 1); // len=4, body=1
1898
        if (!$this->send($fp, $req, 12) || !($response = $this->getResponse($fp, VER_COMMAND_STATUS))) {
1899
            $this->mbPop();
1900
            return false;
1901
        }
1902
1903
        $res = substr($response, 4); // just ignore length, error handling, etc
1904
        $p = 0;
@@ 1935-1938 (lines=4) @@
1932
        }
1933
1934
        $req = pack('nnN', SEARCHD_COMMAND_FLUSHATTRS, VER_COMMAND_FLUSHATTRS, 0); // len=0
1935
        if (!$this->send($fp, $req, 8) || !($response = $this->getResponse($fp, VER_COMMAND_FLUSHATTRS))) {
1936
            $this->mbPop();
1937
            return -1;
1938
        }
1939
1940
        $tag = -1;
1941
        if (strlen($response) == 4) {