Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 5182-5190 (lines=9) @@
5179
      $needle = self::clean($needle);
5180
    }
5181
5182
    if (
5183
        $encoding === 'UTF-8'
5184
        ||
5185
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5186
    ) {
5187
      $encoding = 'UTF-8';
5188
    } else {
5189
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5190
    }
5191
5192
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5193
      self::checkForSupport();
@@ 5304-5312 (lines=9) @@
5301
      return 0;
5302
    }
5303
5304
    if (
5305
        $encoding === 'UTF-8'
5306
        ||
5307
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5308
    ) {
5309
      $encoding = 'UTF-8';
5310
    } else {
5311
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5312
    }
5313
5314
    switch ($encoding) {
5315
      case 'ASCII':
@@ 5529-5537 (lines=9) @@
5526
      $haystack = self::clean($haystack);
5527
    }
5528
5529
    if (
5530
        $encoding === 'UTF-8'
5531
        ||
5532
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5533
    ) {
5534
      $encoding = 'UTF-8';
5535
    } else {
5536
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5537
    }
5538
5539
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5540
      self::checkForSupport();
@@ 5762-5770 (lines=9) @@
5759
      $haystack = self::clean($haystack);
5760
    }
5761
5762
    if (
5763
        $encoding === 'UTF-8'
5764
        ||
5765
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5766
    ) {
5767
      $encoding = 'UTF-8';
5768
    } else {
5769
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5770
    }
5771
5772
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5773
      self::checkForSupport();
@@ 5845-5853 (lines=9) @@
5842
      $haystack = self::clean($haystack);
5843
    }
5844
5845
    if (
5846
        $encoding === 'UTF-8'
5847
        ||
5848
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5849
    ) {
5850
      $encoding = 'UTF-8';
5851
    } else {
5852
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5853
    }
5854
5855
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5856
      self::checkForSupport();
@@ 6344-6352 (lines=9) @@
6341
      $length = (int)$length;
6342
    }
6343
6344
    if (
6345
        $encoding === 'UTF-8'
6346
        ||
6347
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
6348
    ) {
6349
      $encoding = 'UTF-8';
6350
    } else {
6351
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
6352
    }
6353
6354
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
6355
      self::checkForSupport();