Code Duplication    Length = 9-11 lines in 3 locations

src/MySQL/Protocol/Support/BinarySupport.php 3 locations

@@ 215-223 (lines=9) @@
212
     * @param bool $l Little-endian, defaults to false.
213
     * @return string
214
     */
215
    public static function getStrWord(&$p, $l = false)
216
    {
217
        $r = static::binarySubstr($p, 0, 2);
218
        $p = static::binarySubstr($p, 2);
219
        if ($l) {
220
            $r = strrev($r);
221
        }
222
        return $r;
223
    }
224
225
    /**
226
     * Get double word (4 bytes).
@@ 262-271 (lines=10) @@
259
     * @param bool $l Little-endian, defaults to false.
260
     * @return string
261
     */
262
    public static function getStrQWord(&$p, $l = false)
263
    {
264
        $r = static::binarySubstr($p, 0, 8);
265
        if ($l) {
266
            $r = strrev($r);
267
        }
268
        $p = static::binarySubstr($p, 8);
269
270
        return $r;
271
    }
272
273
    /**
274
     * Parse null-terminated string.
@@ 279-289 (lines=11) @@
276
     * @param &string $str
277
     * @return string
278
     */
279
    public static function getString(&$str)
280
    {
281
        $p = strpos($str, "\x00");
282
        if ($p === false) {
283
            return '';
284
        }
285
        $r   = static::binarySubstr($str, 0, $p);
286
        $str = static::binarySubstr($str, $p + 1);
287
288
        return $r;
289
    }
290
291
    /**
292
     * Parse length-value structure.