Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 5040-5048 (lines=9) @@
5037
      $needle = self::clean($needle);
5038
    }
5039
5040
    if (
5041
        $encoding === 'UTF-8'
5042
        ||
5043
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5044
    ) {
5045
      $encoding = 'UTF-8';
5046
    } else {
5047
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5048
    }
5049
5050
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5051
      self::checkForSupport();
@@ 5162-5170 (lines=9) @@
5159
      return 0;
5160
    }
5161
5162
    if (
5163
        $encoding === 'UTF-8'
5164
        ||
5165
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5166
    ) {
5167
      $encoding = 'UTF-8';
5168
    } else {
5169
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5170
    }
5171
5172
    switch ($encoding) {
5173
      case 'ASCII':
@@ 5387-5395 (lines=9) @@
5384
      $haystack = self::clean($haystack);
5385
    }
5386
5387
    if (
5388
        $encoding === 'UTF-8'
5389
        ||
5390
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5391
    ) {
5392
      $encoding = 'UTF-8';
5393
    } else {
5394
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5395
    }
5396
5397
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5398
      self::checkForSupport();
@@ 5616-5624 (lines=9) @@
5613
      $haystack = self::clean($haystack);
5614
    }
5615
5616
    if (
5617
        $encoding === 'UTF-8'
5618
        ||
5619
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5620
    ) {
5621
      $encoding = 'UTF-8';
5622
    } else {
5623
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5624
    }
5625
5626
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5627
      self::checkForSupport();
@@ 5699-5707 (lines=9) @@
5696
      $haystack = self::clean($haystack);
5697
    }
5698
5699
    if (
5700
        $encoding === 'UTF-8'
5701
        ||
5702
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5703
    ) {
5704
      $encoding = 'UTF-8';
5705
    } else {
5706
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5707
    }
5708
5709
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5710
      self::checkForSupport();
@@ 6132-6140 (lines=9) @@
6129
      $length = (int)$length;
6130
    }
6131
6132
    if (
6133
        $encoding === 'UTF-8'
6134
        ||
6135
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
6136
    ) {
6137
      $encoding = 'UTF-8';
6138
    } else {
6139
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
6140
    }
6141
6142
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
6143
      self::checkForSupport();