Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

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