Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 4938-4946 (lines=9) @@
4935
      $needle = self::clean($needle);
4936
    }
4937
4938
    if (
4939
        $encoding === 'UTF-8'
4940
        ||
4941
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
4942
    ) {
4943
      $encoding = 'UTF-8';
4944
    } else {
4945
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
4946
    }
4947
4948
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
4949
      self::checkForSupport();
@@ 5054-5062 (lines=9) @@
5051
      return 0;
5052
    }
5053
5054
    if (
5055
        $encoding === 'UTF-8'
5056
        ||
5057
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5058
    ) {
5059
      $encoding = 'UTF-8';
5060
    } else {
5061
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5062
    }
5063
5064
    switch ($encoding) {
5065
      case 'ASCII':
@@ 5273-5281 (lines=9) @@
5270
      $haystack = self::clean($haystack);
5271
    }
5272
5273
    if (
5274
        $encoding === 'UTF-8'
5275
        ||
5276
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5277
    ) {
5278
      $encoding = 'UTF-8';
5279
    } else {
5280
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5281
    }
5282
5283
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5284
      self::checkForSupport();
@@ 5491-5499 (lines=9) @@
5488
      $haystack = self::clean($haystack);
5489
    }
5490
5491
    if (
5492
        $encoding === 'UTF-8'
5493
        ||
5494
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5495
    ) {
5496
      $encoding = 'UTF-8';
5497
    } else {
5498
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5499
    }
5500
5501
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5502
      self::checkForSupport();
@@ 5571-5579 (lines=9) @@
5568
      $haystack = self::clean($haystack);
5569
    }
5570
5571
    if (
5572
        $encoding === 'UTF-8'
5573
        ||
5574
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5575
    ) {
5576
      $encoding = 'UTF-8';
5577
    } else {
5578
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5579
    }
5580
5581
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5582
      self::checkForSupport();
@@ 5958-5966 (lines=9) @@
5955
      $length = (int)$length;
5956
    }
5957
5958
    if (
5959
        $encoding === 'UTF-8'
5960
        ||
5961
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5962
    ) {
5963
      $encoding = 'UTF-8';
5964
    } else {
5965
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5966
    }
5967
5968
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5969
      self::checkForSupport();