Code Duplication    Length = 11-11 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 5406-5416 (lines=11) @@
5403
      $haystack = self::clean($haystack);
5404
    }
5405
5406
    if (self::$support['mbstring'] === true) {
5407
5408
      // INFO: this is only a fallback for old versions
5409
      if ($encoding === true || $encoding === false) {
5410
        $encoding = 'UTF-8';
5411
      } else {
5412
        $encoding = self::normalizeEncoding($encoding);
5413
      }
5414
5415
      return \mb_strpos($haystack, $needle, $offset, $encoding);
5416
    }
5417
5418
    if (self::$support['iconv'] === true) {
5419
      // ignore invalid negative offset to keep compatility
@@ 5891-5901 (lines=11) @@
5888
      $length = (int)$length;
5889
    }
5890
5891
    if (self::$support['mbstring'] === true) {
5892
5893
      // INFO: this is only a fallback for old versions
5894
      if ($encoding === true || $encoding === false) {
5895
        $encoding = 'UTF-8';
5896
      } else {
5897
        $encoding = self::normalizeEncoding($encoding);
5898
      }
5899
5900
      return \mb_substr($str, $start, $length, $encoding);
5901
    }
5902
5903
    if (self::$support['iconv'] === true) {
5904
      return (string)\grapheme_substr($str, $start, $length);