Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 4711-4719 (lines=9) @@
4708
      $needle = self::clean($needle);
4709
    }
4710
4711
    if (
4712
        $encoding === 'UTF-8'
4713
        ||
4714
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
4715
    ) {
4716
      $encoding = 'UTF-8';
4717
    } else {
4718
      $encoding = self::normalize_encoding($encoding);
4719
    }
4720
4721
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
4722
      self::checkForSupport();
@@ 4826-4834 (lines=9) @@
4823
      return 0;
4824
    }
4825
4826
    if (
4827
        $encoding === 'UTF-8'
4828
        ||
4829
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
4830
    ) {
4831
      $encoding = 'UTF-8';
4832
    } else {
4833
      $encoding = self::normalize_encoding($encoding);
4834
    }
4835
4836
    switch ($encoding) {
4837
      case 'ASCII':
@@ 5029-5037 (lines=9) @@
5026
      $haystack = self::clean($haystack);
5027
    }
5028
5029
    if (
5030
        $encoding === 'UTF-8'
5031
        ||
5032
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5033
    ) {
5034
      $encoding = 'UTF-8';
5035
    } else {
5036
      $encoding = self::normalize_encoding($encoding);
5037
    }
5038
5039
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5040
      self::checkForSupport();
@@ 5231-5239 (lines=9) @@
5228
      $haystack = self::clean($haystack);
5229
    }
5230
5231
    if (
5232
        $encoding === 'UTF-8'
5233
        ||
5234
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5235
    ) {
5236
      $encoding = 'UTF-8';
5237
    } else {
5238
      $encoding = self::normalize_encoding($encoding);
5239
    }
5240
5241
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5242
      self::checkForSupport();
@@ 5312-5320 (lines=9) @@
5309
      $haystack = self::clean($haystack);
5310
    }
5311
5312
    if (
5313
        $encoding === 'UTF-8'
5314
        ||
5315
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5316
    ) {
5317
      $encoding = 'UTF-8';
5318
    } else {
5319
      $encoding = self::normalize_encoding($encoding);
5320
    }
5321
5322
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5323
      self::checkForSupport();
@@ 5701-5709 (lines=9) @@
5698
      $length = (int)$length;
5699
    }
5700
5701
    if (
5702
        $encoding === 'UTF-8'
5703
        ||
5704
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5705
    ) {
5706
      $encoding = 'UTF-8';
5707
    } else {
5708
      $encoding = self::normalize_encoding($encoding);
5709
    }
5710
5711
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5712
      self::checkForSupport();