Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 4688-4696 (lines=9) @@
4685
      $needle = self::clean($needle);
4686
    }
4687
4688
    if (
4689
        $encoding === 'UTF-8'
4690
        ||
4691
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
4692
    ) {
4693
      $encoding = 'UTF-8';
4694
    } else {
4695
      $encoding = self::normalize_encoding($encoding);
4696
    }
4697
4698
    if (
4699
        $encoding == 'UTF-8' // INFO: "grapheme_stripos()" can't handle other encodings
@@ 4796-4804 (lines=9) @@
4793
      return 0;
4794
    }
4795
4796
    if (
4797
        $encoding === 'UTF-8'
4798
        ||
4799
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
4800
    ) {
4801
      $encoding = 'UTF-8';
4802
    } else {
4803
      $encoding = self::normalize_encoding($encoding);
4804
    }
4805
4806
    switch ($encoding) {
4807
      case 'ASCII':
@@ 4999-5007 (lines=9) @@
4996
      $haystack = self::clean($haystack);
4997
    }
4998
4999
    if (
5000
        $encoding === 'UTF-8'
5001
        ||
5002
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5003
    ) {
5004
      $encoding = 'UTF-8';
5005
    } else {
5006
      $encoding = self::normalize_encoding($encoding);
5007
    }
5008
5009
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5010
      self::checkForSupport();
@@ 5201-5209 (lines=9) @@
5198
      $haystack = self::clean($haystack);
5199
    }
5200
5201
    if (
5202
        $encoding === 'UTF-8'
5203
        ||
5204
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5205
    ) {
5206
      $encoding = 'UTF-8';
5207
    } else {
5208
      $encoding = self::normalize_encoding($encoding);
5209
    }
5210
5211
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5212
      self::checkForSupport();
@@ 5282-5290 (lines=9) @@
5279
      $haystack = self::clean($haystack);
5280
    }
5281
5282
    if (
5283
        $encoding === 'UTF-8'
5284
        ||
5285
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5286
    ) {
5287
      $encoding = 'UTF-8';
5288
    } else {
5289
      $encoding = self::normalize_encoding($encoding);
5290
    }
5291
5292
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5293
      self::checkForSupport();
@@ 5671-5679 (lines=9) @@
5668
      $length = (int)$length;
5669
    }
5670
5671
    if (
5672
        $encoding === 'UTF-8'
5673
        ||
5674
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5675
    ) {
5676
      $encoding = 'UTF-8';
5677
    } else {
5678
      $encoding = self::normalize_encoding($encoding);
5679
    }
5680
5681
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5682
      self::checkForSupport();