Code Duplication    Length = 4-4 lines in 5 locations

src/SphinxClient.php 5 locations

@@ 1274-1277 (lines=4) @@
1271
        $len = 8 + strlen($req);
1272
        $req = pack('nnNNN', SEARCHD_COMMAND_SEARCH, VER_COMMAND_SEARCH, $len, 0, $nreqs) . $req; // add header
1273
1274
        if (!$this->send($fp, $req, $len + 8) || !($response = $this->getResponse($fp, VER_COMMAND_SEARCH))) {
1275
            $this->mbPop();
1276
            return false;
1277
        }
1278
1279
        // query sent ok; we can reset reqs now
1280
        $this->reqs = array();
@@ 1606-1609 (lines=4) @@
1603
1604
        $len = strlen($req);
1605
        $req = pack('nnN', SEARCHD_COMMAND_EXCERPT, VER_COMMAND_EXCERPT, $len) . $req; // add header
1606
        if (!$this->send($fp, $req, $len + 8) || !($response = $this->getResponse($fp, VER_COMMAND_EXCERPT))) {
1607
            $this->mbPop();
1608
            return false;
1609
        }
1610
1611
        //////////////////
1612
        // parse response
@@ 1672-1675 (lines=4) @@
1669
1670
        $len = strlen($req);
1671
        $req = pack('nnN', SEARCHD_COMMAND_KEYWORDS, VER_COMMAND_KEYWORDS, $len) . $req; // add header
1672
        if (!$this->send($fp, $req, $len + 8) || !($response = $this->getResponse($fp, VER_COMMAND_KEYWORDS))) {
1673
            $this->mbPop();
1674
            return false;
1675
        }
1676
1677
        //////////////////
1678
        // parse response
@@ 1862-1865 (lines=4) @@
1859
        }
1860
1861
        $req = pack('nnNN', SEARCHD_COMMAND_STATUS, VER_COMMAND_STATUS, 4, $session ? 0 : 1); // len=4, body=1
1862
        if (!$this->send($fp, $req, 12) || !($response = $this->getResponse($fp, VER_COMMAND_STATUS))) {
1863
            $this->mbPop();
1864
            return false;
1865
        }
1866
1867
        $res = substr($response, 4); // just ignore length, error handling, etc
1868
        $p = 0;
@@ 1899-1902 (lines=4) @@
1896
        }
1897
1898
        $req = pack('nnN', SEARCHD_COMMAND_FLUSHATTRS, VER_COMMAND_FLUSHATTRS, 0); // len=0
1899
        if (!$this->send($fp, $req, 8) || !($response = $this->getResponse($fp, VER_COMMAND_FLUSHATTRS))) {
1900
            $this->mbPop();
1901
            return -1;
1902
        }
1903
1904
        $tag = -1;
1905
        if (strlen($response) == 4) {