Code Duplication    Length = 4-4 lines in 5 locations

src/SphinxClient.php 5 locations

@@ 1270-1273 (lines=4) @@
1267
        $len = 8 + strlen($req);
1268
        $req = pack('nnNNN', SEARCHD_COMMAND_SEARCH, VER_COMMAND_SEARCH, $len, 0, $nreqs) . $req; // add header
1269
1270
        if (!$this->send($fp, $req, $len + 8) || !($response = $this->getResponse($fp, VER_COMMAND_SEARCH))) {
1271
            $this->mbPop();
1272
            return false;
1273
        }
1274
1275
        // query sent ok; we can reset reqs now
1276
        $this->reqs = array();
@@ 1602-1605 (lines=4) @@
1599
1600
        $len = strlen($req);
1601
        $req = pack('nnN', SEARCHD_COMMAND_EXCERPT, VER_COMMAND_EXCERPT, $len) . $req; // add header
1602
        if (!$this->send($fp, $req, $len + 8) || !($response = $this->getResponse($fp, VER_COMMAND_EXCERPT))) {
1603
            $this->mbPop();
1604
            return false;
1605
        }
1606
1607
        //////////////////
1608
        // parse response
@@ 1668-1671 (lines=4) @@
1665
1666
        $len = strlen($req);
1667
        $req = pack('nnN', SEARCHD_COMMAND_KEYWORDS, VER_COMMAND_KEYWORDS, $len) . $req; // add header
1668
        if (!$this->send($fp, $req, $len + 8) || !($response = $this->getResponse($fp, VER_COMMAND_KEYWORDS))) {
1669
            $this->mbPop();
1670
            return false;
1671
        }
1672
1673
        //////////////////
1674
        // parse response
@@ 1858-1861 (lines=4) @@
1855
        }
1856
1857
        $req = pack('nnNN', SEARCHD_COMMAND_STATUS, VER_COMMAND_STATUS, 4, $session ? 0 : 1); // len=4, body=1
1858
        if (!$this->send($fp, $req, 12) || !($response = $this->getResponse($fp, VER_COMMAND_STATUS))) {
1859
            $this->mbPop();
1860
            return false;
1861
        }
1862
1863
        $res = substr($response, 4); // just ignore length, error handling, etc
1864
        $p = 0;
@@ 1895-1898 (lines=4) @@
1892
        }
1893
1894
        $req = pack('nnN', SEARCHD_COMMAND_FLUSHATTRS, VER_COMMAND_FLUSHATTRS, 0); // len=0
1895
        if (!$this->send($fp, $req, 8) || !($response = $this->getResponse($fp, VER_COMMAND_FLUSHATTRS))) {
1896
            $this->mbPop();
1897
            return -1;
1898
        }
1899
1900
        $tag = -1;
1901
        if (strlen($response) == 4) {