Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 4854-4862 (lines=9) @@
4851
      $needle = self::clean($needle);
4852
    }
4853
4854
    if (
4855
        $encoding === 'UTF-8'
4856
        ||
4857
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
4858
    ) {
4859
      $encoding = 'UTF-8';
4860
    } else {
4861
      $encoding = self::normalize_encoding($encoding);
4862
    }
4863
4864
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
4865
      self::checkForSupport();
@@ 4969-4977 (lines=9) @@
4966
      return 0;
4967
    }
4968
4969
    if (
4970
        $encoding === 'UTF-8'
4971
        ||
4972
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
4973
    ) {
4974
      $encoding = 'UTF-8';
4975
    } else {
4976
      $encoding = self::normalize_encoding($encoding);
4977
    }
4978
4979
    switch ($encoding) {
4980
      case 'ASCII':
@@ 5188-5196 (lines=9) @@
5185
      $haystack = self::clean($haystack);
5186
    }
5187
5188
    if (
5189
        $encoding === 'UTF-8'
5190
        ||
5191
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5192
    ) {
5193
      $encoding = 'UTF-8';
5194
    } else {
5195
      $encoding = self::normalize_encoding($encoding);
5196
    }
5197
5198
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5199
      self::checkForSupport();
@@ 5406-5414 (lines=9) @@
5403
      $haystack = self::clean($haystack);
5404
    }
5405
5406
    if (
5407
        $encoding === 'UTF-8'
5408
        ||
5409
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5410
    ) {
5411
      $encoding = 'UTF-8';
5412
    } else {
5413
      $encoding = self::normalize_encoding($encoding);
5414
    }
5415
5416
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5417
      self::checkForSupport();
@@ 5486-5494 (lines=9) @@
5483
      $haystack = self::clean($haystack);
5484
    }
5485
5486
    if (
5487
        $encoding === 'UTF-8'
5488
        ||
5489
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5490
    ) {
5491
      $encoding = 'UTF-8';
5492
    } else {
5493
      $encoding = self::normalize_encoding($encoding);
5494
    }
5495
5496
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5497
      self::checkForSupport();
@@ 5873-5881 (lines=9) @@
5870
      $length = (int)$length;
5871
    }
5872
5873
    if (
5874
        $encoding === 'UTF-8'
5875
        ||
5876
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5877
    ) {
5878
      $encoding = 'UTF-8';
5879
    } else {
5880
      $encoding = self::normalize_encoding($encoding);
5881
    }
5882
5883
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5884
      self::checkForSupport();