Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

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