Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 5031-5039 (lines=9) @@
5028
      $needle = self::clean($needle);
5029
    }
5030
5031
    if (
5032
        $encoding === 'UTF-8'
5033
        ||
5034
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5035
    ) {
5036
      $encoding = 'UTF-8';
5037
    } else {
5038
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5039
    }
5040
5041
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5042
      self::checkForSupport();
@@ 5153-5161 (lines=9) @@
5150
      return 0;
5151
    }
5152
5153
    if (
5154
        $encoding === 'UTF-8'
5155
        ||
5156
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5157
    ) {
5158
      $encoding = 'UTF-8';
5159
    } else {
5160
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5161
    }
5162
5163
    switch ($encoding) {
5164
      case 'ASCII':
@@ 5378-5386 (lines=9) @@
5375
      $haystack = self::clean($haystack);
5376
    }
5377
5378
    if (
5379
        $encoding === 'UTF-8'
5380
        ||
5381
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5382
    ) {
5383
      $encoding = 'UTF-8';
5384
    } else {
5385
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5386
    }
5387
5388
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5389
      self::checkForSupport();
@@ 5607-5615 (lines=9) @@
5604
      $haystack = self::clean($haystack);
5605
    }
5606
5607
    if (
5608
        $encoding === 'UTF-8'
5609
        ||
5610
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5611
    ) {
5612
      $encoding = 'UTF-8';
5613
    } else {
5614
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5615
    }
5616
5617
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5618
      self::checkForSupport();
@@ 5690-5698 (lines=9) @@
5687
      $haystack = self::clean($haystack);
5688
    }
5689
5690
    if (
5691
        $encoding === 'UTF-8'
5692
        ||
5693
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5694
    ) {
5695
      $encoding = 'UTF-8';
5696
    } else {
5697
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5698
    }
5699
5700
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5701
      self::checkForSupport();
@@ 6077-6085 (lines=9) @@
6074
      $length = (int)$length;
6075
    }
6076
6077
    if (
6078
        $encoding === 'UTF-8'
6079
        ||
6080
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
6081
    ) {
6082
      $encoding = 'UTF-8';
6083
    } else {
6084
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
6085
    }
6086
6087
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
6088
      self::checkForSupport();