Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 4760-4768 (lines=9) @@
4757
      $needle = self::clean($needle);
4758
    }
4759
4760
    if (
4761
        $encoding === 'UTF-8'
4762
        ||
4763
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
4764
    ) {
4765
      $encoding = 'UTF-8';
4766
    } else {
4767
      $encoding = self::normalize_encoding($encoding);
4768
    }
4769
4770
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
4771
      self::checkForSupport();
@@ 4875-4883 (lines=9) @@
4872
      return 0;
4873
    }
4874
4875
    if (
4876
        $encoding === 'UTF-8'
4877
        ||
4878
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
4879
    ) {
4880
      $encoding = 'UTF-8';
4881
    } else {
4882
      $encoding = self::normalize_encoding($encoding);
4883
    }
4884
4885
    switch ($encoding) {
4886
      case 'ASCII':
@@ 5078-5086 (lines=9) @@
5075
      $haystack = self::clean($haystack);
5076
    }
5077
5078
    if (
5079
        $encoding === 'UTF-8'
5080
        ||
5081
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5082
    ) {
5083
      $encoding = 'UTF-8';
5084
    } else {
5085
      $encoding = self::normalize_encoding($encoding);
5086
    }
5087
5088
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5089
      self::checkForSupport();
@@ 5280-5288 (lines=9) @@
5277
      $haystack = self::clean($haystack);
5278
    }
5279
5280
    if (
5281
        $encoding === 'UTF-8'
5282
        ||
5283
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5284
    ) {
5285
      $encoding = 'UTF-8';
5286
    } else {
5287
      $encoding = self::normalize_encoding($encoding);
5288
    }
5289
5290
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5291
      self::checkForSupport();
@@ 5360-5368 (lines=9) @@
5357
      $haystack = self::clean($haystack);
5358
    }
5359
5360
    if (
5361
        $encoding === 'UTF-8'
5362
        ||
5363
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5364
    ) {
5365
      $encoding = 'UTF-8';
5366
    } else {
5367
      $encoding = self::normalize_encoding($encoding);
5368
    }
5369
5370
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5371
      self::checkForSupport();
@@ 5747-5755 (lines=9) @@
5744
      $length = (int)$length;
5745
    }
5746
5747
    if (
5748
        $encoding === 'UTF-8'
5749
        ||
5750
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5751
    ) {
5752
      $encoding = 'UTF-8';
5753
    } else {
5754
      $encoding = self::normalize_encoding($encoding);
5755
    }
5756
5757
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5758
      self::checkForSupport();