Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 5277-5285 (lines=9) @@
5274
      $needle = self::clean($needle);
5275
    }
5276
5277
    if (
5278
        $encoding === 'UTF-8'
5279
        ||
5280
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5281
    ) {
5282
      $encoding = 'UTF-8';
5283
    } else {
5284
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5285
    }
5286
5287
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5288
      self::checkForSupport();
@@ 5407-5415 (lines=9) @@
5404
      return 0;
5405
    }
5406
5407
    if (
5408
        $encoding === 'UTF-8'
5409
        ||
5410
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5411
    ) {
5412
      $encoding = 'UTF-8';
5413
    } else {
5414
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5415
    }
5416
5417
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5418
      self::checkForSupport();
@@ 5637-5645 (lines=9) @@
5634
      $haystack = self::clean($haystack);
5635
    }
5636
5637
    if (
5638
        $encoding === 'UTF-8'
5639
        ||
5640
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5641
    ) {
5642
      $encoding = 'UTF-8';
5643
    } else {
5644
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5645
    }
5646
5647
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5648
      self::checkForSupport();
@@ 5879-5887 (lines=9) @@
5876
      $haystack = self::clean($haystack);
5877
    }
5878
5879
    if (
5880
        $encoding === 'UTF-8'
5881
        ||
5882
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5883
    ) {
5884
      $encoding = 'UTF-8';
5885
    } else {
5886
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5887
    }
5888
5889
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5890
      self::checkForSupport();
@@ 5962-5970 (lines=9) @@
5959
      $haystack = self::clean($haystack);
5960
    }
5961
5962
    if (
5963
        $encoding === 'UTF-8'
5964
        ||
5965
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5966
    ) {
5967
      $encoding = 'UTF-8';
5968
    } else {
5969
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5970
    }
5971
5972
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5973
      self::checkForSupport();
@@ 6471-6479 (lines=9) @@
6468
      $length = (int)$length;
6469
    }
6470
6471
    if (
6472
        $encoding === 'UTF-8'
6473
        ||
6474
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
6475
    ) {
6476
      $encoding = 'UTF-8';
6477
    } else {
6478
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
6479
    }
6480
6481
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
6482
      self::checkForSupport();