Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 5089-5097 (lines=9) @@
5086
      $needle = self::clean($needle);
5087
    }
5088
5089
    if (
5090
        $encoding === 'UTF-8'
5091
        ||
5092
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5093
    ) {
5094
      $encoding = 'UTF-8';
5095
    } else {
5096
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5097
    }
5098
5099
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5100
      self::checkForSupport();
@@ 5211-5219 (lines=9) @@
5208
      return 0;
5209
    }
5210
5211
    if (
5212
        $encoding === 'UTF-8'
5213
        ||
5214
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5215
    ) {
5216
      $encoding = 'UTF-8';
5217
    } else {
5218
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5219
    }
5220
5221
    switch ($encoding) {
5222
      case 'ASCII':
@@ 5436-5444 (lines=9) @@
5433
      $haystack = self::clean($haystack);
5434
    }
5435
5436
    if (
5437
        $encoding === 'UTF-8'
5438
        ||
5439
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5440
    ) {
5441
      $encoding = 'UTF-8';
5442
    } else {
5443
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5444
    }
5445
5446
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5447
      self::checkForSupport();
@@ 5665-5673 (lines=9) @@
5662
      $haystack = self::clean($haystack);
5663
    }
5664
5665
    if (
5666
        $encoding === 'UTF-8'
5667
        ||
5668
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5669
    ) {
5670
      $encoding = 'UTF-8';
5671
    } else {
5672
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5673
    }
5674
5675
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5676
      self::checkForSupport();
@@ 5748-5756 (lines=9) @@
5745
      $haystack = self::clean($haystack);
5746
    }
5747
5748
    if (
5749
        $encoding === 'UTF-8'
5750
        ||
5751
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5752
    ) {
5753
      $encoding = 'UTF-8';
5754
    } else {
5755
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5756
    }
5757
5758
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5759
      self::checkForSupport();
@@ 6185-6193 (lines=9) @@
6182
      $length = (int)$length;
6183
    }
6184
6185
    if (
6186
        $encoding === 'UTF-8'
6187
        ||
6188
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
6189
    ) {
6190
      $encoding = 'UTF-8';
6191
    } else {
6192
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
6193
    }
6194
6195
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
6196
      self::checkForSupport();