Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

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