Code Duplication    Length = 11-11 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 5508-5518 (lines=11) @@
5505
      $haystack = self::clean($haystack);
5506
    }
5507
5508
    if (self::$support['mbstring'] === true) {
5509
5510
      // INFO: this is only a fallback for old versions
5511
      if ($encoding === true || $encoding === false) {
5512
        $encoding = 'UTF-8';
5513
      } else {
5514
        $encoding = self::normalizeEncoding($encoding);
5515
      }
5516
5517
      return \mb_strpos($haystack, $needle, $offset, $encoding);
5518
    }
5519
5520
    if (self::$support['iconv'] === true) {
5521
      // ignore invalid negative offset to keep compatility
@@ 5993-6003 (lines=11) @@
5990
      $length = (int)$length;
5991
    }
5992
5993
    if (self::$support['mbstring'] === true) {
5994
5995
      // INFO: this is only a fallback for old versions
5996
      if ($encoding === true || $encoding === false) {
5997
        $encoding = 'UTF-8';
5998
      } else {
5999
        $encoding = self::normalizeEncoding($encoding);
6000
      }
6001
6002
      return \mb_substr($str, $start, $length, $encoding);
6003
    }
6004
6005
    if (self::$support['iconv'] === true) {
6006
      return (string)\grapheme_substr($str, $start, $length);