Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 5212-5220 (lines=9) @@
5209
      $needle = self::clean($needle);
5210
    }
5211
5212
    if (
5213
        $encoding === 'UTF-8'
5214
        ||
5215
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5216
    ) {
5217
      $encoding = 'UTF-8';
5218
    } else {
5219
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5220
    }
5221
5222
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5223
      self::checkForSupport();
@@ 5342-5350 (lines=9) @@
5339
      return 0;
5340
    }
5341
5342
    if (
5343
        $encoding === 'UTF-8'
5344
        ||
5345
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5346
    ) {
5347
      $encoding = 'UTF-8';
5348
    } else {
5349
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5350
    }
5351
5352
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5353
      self::checkForSupport();
@@ 5572-5580 (lines=9) @@
5569
      $haystack = self::clean($haystack);
5570
    }
5571
5572
    if (
5573
        $encoding === 'UTF-8'
5574
        ||
5575
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5576
    ) {
5577
      $encoding = 'UTF-8';
5578
    } else {
5579
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5580
    }
5581
5582
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5583
      self::checkForSupport();
@@ 5814-5822 (lines=9) @@
5811
      $haystack = self::clean($haystack);
5812
    }
5813
5814
    if (
5815
        $encoding === 'UTF-8'
5816
        ||
5817
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5818
    ) {
5819
      $encoding = 'UTF-8';
5820
    } else {
5821
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5822
    }
5823
5824
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5825
      self::checkForSupport();
@@ 5897-5905 (lines=9) @@
5894
      $haystack = self::clean($haystack);
5895
    }
5896
5897
    if (
5898
        $encoding === 'UTF-8'
5899
        ||
5900
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5901
    ) {
5902
      $encoding = 'UTF-8';
5903
    } else {
5904
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5905
    }
5906
5907
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5908
      self::checkForSupport();
@@ 6407-6415 (lines=9) @@
6404
      $length = (int)$length;
6405
    }
6406
6407
    if (
6408
        $encoding === 'UTF-8'
6409
        ||
6410
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
6411
    ) {
6412
      $encoding = 'UTF-8';
6413
    } else {
6414
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
6415
    }
6416
6417
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
6418
      self::checkForSupport();