Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 5011-5019 (lines=9) @@
5008
      $needle = self::clean($needle);
5009
    }
5010
5011
    if (
5012
        $encoding === 'UTF-8'
5013
        ||
5014
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5015
    ) {
5016
      $encoding = 'UTF-8';
5017
    } else {
5018
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5019
    }
5020
5021
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5022
      self::checkForSupport();
@@ 5127-5135 (lines=9) @@
5124
      return 0;
5125
    }
5126
5127
    if (
5128
        $encoding === 'UTF-8'
5129
        ||
5130
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5131
    ) {
5132
      $encoding = 'UTF-8';
5133
    } else {
5134
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5135
    }
5136
5137
    switch ($encoding) {
5138
      case 'ASCII':
@@ 5347-5355 (lines=9) @@
5344
      $haystack = self::clean($haystack);
5345
    }
5346
5347
    if (
5348
        $encoding === 'UTF-8'
5349
        ||
5350
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5351
    ) {
5352
      $encoding = 'UTF-8';
5353
    } else {
5354
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5355
    }
5356
5357
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5358
      self::checkForSupport();
@@ 5565-5573 (lines=9) @@
5562
      $haystack = self::clean($haystack);
5563
    }
5564
5565
    if (
5566
        $encoding === 'UTF-8'
5567
        ||
5568
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5569
    ) {
5570
      $encoding = 'UTF-8';
5571
    } else {
5572
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5573
    }
5574
5575
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5576
      self::checkForSupport();
@@ 5645-5653 (lines=9) @@
5642
      $haystack = self::clean($haystack);
5643
    }
5644
5645
    if (
5646
        $encoding === 'UTF-8'
5647
        ||
5648
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5649
    ) {
5650
      $encoding = 'UTF-8';
5651
    } else {
5652
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5653
    }
5654
5655
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
5656
      self::checkForSupport();
@@ 6032-6040 (lines=9) @@
6029
      $length = (int)$length;
6030
    }
6031
6032
    if (
6033
        $encoding === 'UTF-8'
6034
        ||
6035
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
6036
    ) {
6037
      $encoding = 'UTF-8';
6038
    } else {
6039
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
6040
    }
6041
6042
    if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) {
6043
      self::checkForSupport();