Code Duplication    Length = 11-11 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 5439-5449 (lines=11) @@
5436
      $haystack = self::clean($haystack);
5437
    }
5438
5439
    if (self::$support['mbstring'] === true) {
5440
5441
      // INFO: this is only a fallback for old versions
5442
      if ($encoding === true || $encoding === false) {
5443
        $encoding = 'UTF-8';
5444
      } else {
5445
        $encoding = self::normalizeEncoding($encoding);
5446
      }
5447
5448
      return \mb_strpos($haystack, $needle, $offset, $encoding);
5449
    }
5450
5451
    if (self::$support['iconv'] === true) {
5452
      // ignore invalid negative offset to keep compatility
@@ 5957-5967 (lines=11) @@
5954
      $length = (int)$length;
5955
    }
5956
5957
    if (self::$support['mbstring'] === true) {
5958
5959
      // INFO: this is only a fallback for old versions
5960
      if ($encoding === true || $encoding === false) {
5961
        $encoding = 'UTF-8';
5962
      } else {
5963
        $encoding = self::normalizeEncoding($encoding);
5964
      }
5965
5966
      return \mb_substr($str, $start, $length, $encoding);
5967
    }
5968
5969
    if (self::$support['iconv'] === true) {
5970
      return (string)\grapheme_substr($str, $start, $length);