Code Duplication    Length = 4-4 lines in 5 locations

src/Sphinx/Client.php 5 locations

@@ 1390-1393 (lines=4) @@
1387
        $len = 8 + strlen($req);
1388
        $req = pack('nnNNN', self::SEARCHD_COMMAND_SEARCH, self::VER_COMMAND_SEARCH, $len, 0, $nreqs) . $req; // add header
1389
1390
        if (!$this->send($fp, $req, $len + 8) || !($response = $this->getResponse($fp, self::VER_COMMAND_SEARCH))) {
1391
            $this->mbPop();
1392
            return false;
1393
        }
1394
1395
        // query sent ok; we can reset reqs now
1396
        $this->reqs = array();
@@ 1696-1699 (lines=4) @@
1693
1694
        $len = strlen($req);
1695
        $req = pack('nnN', self::SEARCHD_COMMAND_EXCERPT, self::VER_COMMAND_EXCERPT, $len) . $req; // add header
1696
        if (!$this->send($fp, $req, $len + 8) || !($response = $this->getResponse($fp, self::VER_COMMAND_EXCERPT))) {
1697
            $this->mbPop();
1698
            return false;
1699
        }
1700
1701
        //////////////////
1702
        // parse response
@@ 1769-1772 (lines=4) @@
1766
1767
        $len = strlen($req);
1768
        $req = pack('nnN', self::SEARCHD_COMMAND_KEYWORDS, self::VER_COMMAND_KEYWORDS, $len) . $req; // add header
1769
        if (!$this->send($fp, $req, $len + 8) || !($response = $this->getResponse($fp, self::VER_COMMAND_KEYWORDS))) {
1770
            $this->mbPop();
1771
            return false;
1772
        }
1773
1774
        //////////////////
1775
        // parse response
@@ 1983-1986 (lines=4) @@
1980
        }
1981
1982
        $req = pack('nnNN', self::SEARCHD_COMMAND_STATUS, self::VER_COMMAND_STATUS, 4, $session ? 0 : 1); // len=4, body=1
1983
        if (!$this->send($fp, $req, 12) || !($response = $this->getResponse($fp, self::VER_COMMAND_STATUS))) {
1984
            $this->mbPop();
1985
            return false;
1986
        }
1987
1988
        $res = substr($response, 4); // just ignore length, error handling, etc
1989
        $p = 0;
@@ 2023-2026 (lines=4) @@
2020
        }
2021
2022
        $req = pack('nnN', self::SEARCHD_COMMAND_FLUSH_ATTRS, self::VER_COMMAND_FLUSH_ATTRS, 0); // len=0
2023
        if (!$this->send($fp, $req, 8) || !($response = $this->getResponse($fp, self::VER_COMMAND_FLUSH_ATTRS))) {
2024
            $this->mbPop();
2025
            return -1;
2026
        }
2027
2028
        $tag = -1;
2029
        if (strlen($response) == 4) {