Code Duplication    Length = 11-11 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 5426-5436 (lines=11) @@
5423
      $haystack = self::clean($haystack);
5424
    }
5425
5426
    if (self::$support['mbstring'] === true) {
5427
5428
      // INFO: this is only a fallback for old versions
5429
      if ($encoding === true || $encoding === false) {
5430
        $encoding = 'UTF-8';
5431
      } else {
5432
        $encoding = self::normalizeEncoding($encoding);
5433
      }
5434
5435
      return \mb_strpos($haystack, $needle, $offset, $encoding);
5436
    }
5437
5438
    if (self::$support['iconv'] === true) {
5439
      // ignore invalid negative offset to keep compatility
@@ 5902-5912 (lines=11) @@
5899
      $length = (int)$length;
5900
    }
5901
5902
    if (self::$support['mbstring'] === true) {
5903
5904
      // INFO: this is only a fallback for old versions
5905
      if ($encoding === true || $encoding === false) {
5906
        $encoding = 'UTF-8';
5907
      } else {
5908
        $encoding = self::normalizeEncoding($encoding);
5909
      }
5910
5911
      return \mb_substr($str, $start, $length, $encoding);
5912
    }
5913
5914
    if (self::$support['iconv'] === true) {
5915
      return (string)\grapheme_substr($str, $start, $length);