Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 5181-5189 (lines=9) @@
5178
      $needle = self::clean($needle);
5179
    }
5180
5181
    if (
5182
        $encoding === 'UTF-8'
5183
        ||
5184
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5185
    ) {
5186
      $encoding = 'UTF-8';
5187
    } else {
5188
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5189
    }
5190
5191
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5192
      self::checkForSupport();
@@ 5311-5319 (lines=9) @@
5308
      return 0;
5309
    }
5310
5311
    if (
5312
        $encoding === 'UTF-8'
5313
        ||
5314
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5315
    ) {
5316
      $encoding = 'UTF-8';
5317
    } else {
5318
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5319
    }
5320
5321
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5322
      self::checkForSupport();
@@ 5540-5548 (lines=9) @@
5537
      $haystack = self::clean($haystack);
5538
    }
5539
5540
    if (
5541
        $encoding === 'UTF-8'
5542
        ||
5543
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5544
    ) {
5545
      $encoding = 'UTF-8';
5546
    } else {
5547
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5548
    }
5549
5550
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5551
      self::checkForSupport();
@@ 5782-5790 (lines=9) @@
5779
      $haystack = self::clean($haystack);
5780
    }
5781
5782
    if (
5783
        $encoding === 'UTF-8'
5784
        ||
5785
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5786
    ) {
5787
      $encoding = 'UTF-8';
5788
    } else {
5789
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5790
    }
5791
5792
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5793
      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();
@@ 6375-6383 (lines=9) @@
6372
      $length = (int)$length;
6373
    }
6374
6375
    if (
6376
        $encoding === 'UTF-8'
6377
        ||
6378
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
6379
    ) {
6380
      $encoding = 'UTF-8';
6381
    } else {
6382
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
6383
    }
6384
6385
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
6386
      self::checkForSupport();