Code Duplication    Length = 11-11 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 5507-5517 (lines=11) @@
5504
      $haystack = self::clean($haystack);
5505
    }
5506
5507
    if (self::$support['mbstring'] === true) {
5508
5509
      // INFO: this is only a fallback for old versions
5510
      if ($encoding === true || $encoding === false) {
5511
        $encoding = 'UTF-8';
5512
      } else {
5513
        $encoding = self::normalizeEncoding($encoding);
5514
      }
5515
5516
      return \mb_strpos($haystack, $needle, $offset, $encoding);
5517
    }
5518
5519
    if (self::$support['iconv'] === true) {
5520
      // ignore invalid negative offset to keep compatility
@@ 5983-5993 (lines=11) @@
5980
      $length = (int)$length;
5981
    }
5982
5983
    if (self::$support['mbstring'] === true) {
5984
5985
      // INFO: this is only a fallback for old versions
5986
      if ($encoding === true || $encoding === false) {
5987
        $encoding = 'UTF-8';
5988
      } else {
5989
        $encoding = self::normalizeEncoding($encoding);
5990
      }
5991
5992
      return \mb_substr($str, $start, $length, $encoding);
5993
    }
5994
5995
    if (self::$support['iconv'] === true) {
5996
      return (string)\grapheme_substr($str, $start, $length);