Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 5257-5265 (lines=9) @@
5254
      $needle = self::clean($needle);
5255
    }
5256
5257
    if (
5258
        $encoding === 'UTF-8'
5259
        ||
5260
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5261
    ) {
5262
      $encoding = 'UTF-8';
5263
    } else {
5264
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5265
    }
5266
5267
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5268
      self::checkForSupport();
@@ 5387-5395 (lines=9) @@
5384
      return 0;
5385
    }
5386
5387
    if (
5388
        $encoding === 'UTF-8'
5389
        ||
5390
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5391
    ) {
5392
      $encoding = 'UTF-8';
5393
    } else {
5394
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5395
    }
5396
5397
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5398
      self::checkForSupport();
@@ 5617-5625 (lines=9) @@
5614
      $haystack = self::clean($haystack);
5615
    }
5616
5617
    if (
5618
        $encoding === 'UTF-8'
5619
        ||
5620
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5621
    ) {
5622
      $encoding = 'UTF-8';
5623
    } else {
5624
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5625
    }
5626
5627
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5628
      self::checkForSupport();
@@ 5859-5867 (lines=9) @@
5856
      $haystack = self::clean($haystack);
5857
    }
5858
5859
    if (
5860
        $encoding === 'UTF-8'
5861
        ||
5862
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5863
    ) {
5864
      $encoding = 'UTF-8';
5865
    } else {
5866
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5867
    }
5868
5869
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5870
      self::checkForSupport();
@@ 5942-5950 (lines=9) @@
5939
      $haystack = self::clean($haystack);
5940
    }
5941
5942
    if (
5943
        $encoding === 'UTF-8'
5944
        ||
5945
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5946
    ) {
5947
      $encoding = 'UTF-8';
5948
    } else {
5949
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5950
    }
5951
5952
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5953
      self::checkForSupport();
@@ 6452-6460 (lines=9) @@
6449
      $length = (int)$length;
6450
    }
6451
6452
    if (
6453
        $encoding === 'UTF-8'
6454
        ||
6455
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
6456
    ) {
6457
      $encoding = 'UTF-8';
6458
    } else {
6459
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
6460
    }
6461
6462
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
6463
      self::checkForSupport();