Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 5268-5276 (lines=9) @@
5265
      $needle = self::clean($needle);
5266
    }
5267
5268
    if (
5269
        $encoding === 'UTF-8'
5270
        ||
5271
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5272
    ) {
5273
      $encoding = 'UTF-8';
5274
    } else {
5275
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5276
    }
5277
5278
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5279
      self::checkForSupport();
@@ 5398-5406 (lines=9) @@
5395
      return 0;
5396
    }
5397
5398
    if (
5399
        $encoding === 'UTF-8'
5400
        ||
5401
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5402
    ) {
5403
      $encoding = 'UTF-8';
5404
    } else {
5405
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5406
    }
5407
5408
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5409
      self::checkForSupport();
@@ 5628-5636 (lines=9) @@
5625
      $haystack = self::clean($haystack);
5626
    }
5627
5628
    if (
5629
        $encoding === 'UTF-8'
5630
        ||
5631
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5632
    ) {
5633
      $encoding = 'UTF-8';
5634
    } else {
5635
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5636
    }
5637
5638
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5639
      self::checkForSupport();
@@ 5870-5878 (lines=9) @@
5867
      $haystack = self::clean($haystack);
5868
    }
5869
5870
    if (
5871
        $encoding === 'UTF-8'
5872
        ||
5873
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5874
    ) {
5875
      $encoding = 'UTF-8';
5876
    } else {
5877
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5878
    }
5879
5880
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5881
      self::checkForSupport();
@@ 5953-5961 (lines=9) @@
5950
      $haystack = self::clean($haystack);
5951
    }
5952
5953
    if (
5954
        $encoding === 'UTF-8'
5955
        ||
5956
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5957
    ) {
5958
      $encoding = 'UTF-8';
5959
    } else {
5960
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5961
    }
5962
5963
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5964
      self::checkForSupport();
@@ 6463-6471 (lines=9) @@
6460
      $length = (int)$length;
6461
    }
6462
6463
    if (
6464
        $encoding === 'UTF-8'
6465
        ||
6466
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
6467
    ) {
6468
      $encoding = 'UTF-8';
6469
    } else {
6470
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
6471
    }
6472
6473
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
6474
      self::checkForSupport();