Code Duplication    Length = 11-11 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 5393-5403 (lines=11) @@
5390
      $haystack = self::clean($haystack);
5391
    }
5392
5393
    if (self::$support['mbstring'] === true) {
5394
5395
      // INFO: this is only a fallback for old versions
5396
      if ($encoding === true || $encoding === false) {
5397
        $encoding = 'UTF-8';
5398
      } else {
5399
        $encoding = self::normalizeEncoding($encoding);
5400
      }
5401
5402
      return \mb_strpos($haystack, $needle, $offset, $encoding);
5403
    }
5404
5405
    if (self::$support['iconv'] === true) {
5406
      // ignore invalid negative offset to keep compatility
@@ 5869-5879 (lines=11) @@
5866
      $length = (int)$length;
5867
    }
5868
5869
    if (self::$support['mbstring'] === true) {
5870
5871
      // INFO: this is only a fallback for old versions
5872
      if ($encoding === true || $encoding === false) {
5873
        $encoding = 'UTF-8';
5874
      } else {
5875
        $encoding = self::normalizeEncoding($encoding);
5876
      }
5877
5878
      return \mb_substr($str, $start, $length, $encoding);
5879
    }
5880
5881
    if (self::$support['iconv'] === true) {
5882
      return (string)\grapheme_substr($str, $start, $length);