Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 4954-4962 (lines=9) @@
4951
      $needle = self::clean($needle);
4952
    }
4953
4954
    if (
4955
        $encoding === 'UTF-8'
4956
        ||
4957
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
4958
    ) {
4959
      $encoding = 'UTF-8';
4960
    } else {
4961
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
4962
    }
4963
4964
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
4965
      self::checkForSupport();
@@ 5070-5078 (lines=9) @@
5067
      return 0;
5068
    }
5069
5070
    if (
5071
        $encoding === 'UTF-8'
5072
        ||
5073
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5074
    ) {
5075
      $encoding = 'UTF-8';
5076
    } else {
5077
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5078
    }
5079
5080
    switch ($encoding) {
5081
      case 'ASCII':
@@ 5289-5297 (lines=9) @@
5286
      $haystack = self::clean($haystack);
5287
    }
5288
5289
    if (
5290
        $encoding === 'UTF-8'
5291
        ||
5292
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5293
    ) {
5294
      $encoding = 'UTF-8';
5295
    } else {
5296
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5297
    }
5298
5299
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5300
      self::checkForSupport();
@@ 5507-5515 (lines=9) @@
5504
      $haystack = self::clean($haystack);
5505
    }
5506
5507
    if (
5508
        $encoding === 'UTF-8'
5509
        ||
5510
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5511
    ) {
5512
      $encoding = 'UTF-8';
5513
    } else {
5514
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5515
    }
5516
5517
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5518
      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();
@@ 5974-5982 (lines=9) @@
5971
      $length = (int)$length;
5972
    }
5973
5974
    if (
5975
        $encoding === 'UTF-8'
5976
        ||
5977
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5978
    ) {
5979
      $encoding = 'UTF-8';
5980
    } else {
5981
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5982
    }
5983
5984
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5985
      self::checkForSupport();