Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 5011-5019 (lines=9) @@
5008
      $needle = self::clean($needle);
5009
    }
5010
5011
    if (
5012
        $encoding === 'UTF-8'
5013
        ||
5014
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5015
    ) {
5016
      $encoding = 'UTF-8';
5017
    } else {
5018
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5019
    }
5020
5021
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5022
      self::checkForSupport();
@@ 5133-5141 (lines=9) @@
5130
      return 0;
5131
    }
5132
5133
    if (
5134
        $encoding === 'UTF-8'
5135
        ||
5136
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5137
    ) {
5138
      $encoding = 'UTF-8';
5139
    } else {
5140
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5141
    }
5142
5143
    switch ($encoding) {
5144
      case 'ASCII':
@@ 5358-5366 (lines=9) @@
5355
      $haystack = self::clean($haystack);
5356
    }
5357
5358
    if (
5359
        $encoding === 'UTF-8'
5360
        ||
5361
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5362
    ) {
5363
      $encoding = 'UTF-8';
5364
    } else {
5365
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5366
    }
5367
5368
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5369
      self::checkForSupport();
@@ 5587-5595 (lines=9) @@
5584
      $haystack = self::clean($haystack);
5585
    }
5586
5587
    if (
5588
        $encoding === 'UTF-8'
5589
        ||
5590
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5591
    ) {
5592
      $encoding = 'UTF-8';
5593
    } else {
5594
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5595
    }
5596
5597
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5598
      self::checkForSupport();
@@ 5670-5678 (lines=9) @@
5667
      $haystack = self::clean($haystack);
5668
    }
5669
5670
    if (
5671
        $encoding === 'UTF-8'
5672
        ||
5673
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5674
    ) {
5675
      $encoding = 'UTF-8';
5676
    } else {
5677
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5678
    }
5679
5680
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5681
      self::checkForSupport();
@@ 6057-6065 (lines=9) @@
6054
      $length = (int)$length;
6055
    }
6056
6057
    if (
6058
        $encoding === 'UTF-8'
6059
        ||
6060
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
6061
    ) {
6062
      $encoding = 'UTF-8';
6063
    } else {
6064
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
6065
    }
6066
6067
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
6068
      self::checkForSupport();