Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 5261-5269 (lines=9) @@
5258
      $needle = self::clean($needle);
5259
    }
5260
5261
    if (
5262
        $encoding === 'UTF-8'
5263
        ||
5264
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5265
    ) {
5266
      $encoding = 'UTF-8';
5267
    } else {
5268
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5269
    }
5270
5271
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5272
      self::checkForSupport();
@@ 5391-5399 (lines=9) @@
5388
      return 0;
5389
    }
5390
5391
    if (
5392
        $encoding === 'UTF-8'
5393
        ||
5394
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5395
    ) {
5396
      $encoding = 'UTF-8';
5397
    } else {
5398
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5399
    }
5400
5401
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5402
      self::checkForSupport();
@@ 5621-5629 (lines=9) @@
5618
      $haystack = self::clean($haystack);
5619
    }
5620
5621
    if (
5622
        $encoding === 'UTF-8'
5623
        ||
5624
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5625
    ) {
5626
      $encoding = 'UTF-8';
5627
    } else {
5628
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5629
    }
5630
5631
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5632
      self::checkForSupport();
@@ 5863-5871 (lines=9) @@
5860
      $haystack = self::clean($haystack);
5861
    }
5862
5863
    if (
5864
        $encoding === 'UTF-8'
5865
        ||
5866
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5867
    ) {
5868
      $encoding = 'UTF-8';
5869
    } else {
5870
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5871
    }
5872
5873
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5874
      self::checkForSupport();
@@ 5946-5954 (lines=9) @@
5943
      $haystack = self::clean($haystack);
5944
    }
5945
5946
    if (
5947
        $encoding === 'UTF-8'
5948
        ||
5949
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5950
    ) {
5951
      $encoding = 'UTF-8';
5952
    } else {
5953
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5954
    }
5955
5956
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5957
      self::checkForSupport();
@@ 6456-6464 (lines=9) @@
6453
      $length = (int)$length;
6454
    }
6455
6456
    if (
6457
        $encoding === 'UTF-8'
6458
        ||
6459
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
6460
    ) {
6461
      $encoding = 'UTF-8';
6462
    } else {
6463
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
6464
    }
6465
6466
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
6467
      self::checkForSupport();