Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 4621-4629 (lines=9) @@
4618
      $needle = self::clean($needle);
4619
    }
4620
4621
    if (
4622
        $encoding === 'UTF-8'
4623
        ||
4624
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
4625
    ) {
4626
      $encoding = 'UTF-8';
4627
    } else {
4628
      $encoding = self::normalize_encoding($encoding);
4629
    }
4630
4631
    if (
4632
        $encoding == 'UTF-8' // INFO: "grapheme_stripos()" can't handle other encodings
@@ 4719-4727 (lines=9) @@
4716
      return 0;
4717
    }
4718
4719
    if (
4720
        $encoding === 'UTF-8'
4721
        ||
4722
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
4723
    ) {
4724
      $encoding = 'UTF-8';
4725
    } else {
4726
      $encoding = self::normalize_encoding($encoding);
4727
    }
4728
4729
    switch ($encoding) {
4730
      case 'ASCII':
@@ 4917-4925 (lines=9) @@
4914
      self::checkForSupport();
4915
    }
4916
4917
    if (
4918
        $encoding === 'UTF-8'
4919
        ||
4920
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
4921
    ) {
4922
      $encoding = 'UTF-8';
4923
    } else {
4924
      $encoding = self::normalize_encoding($encoding);
4925
    }
4926
4927
    if (
4928
        $encoding !== 'UTF-8' // INFO: use "mb_"-function (with polyfill) also if we need another encoding
@@ 5104-5112 (lines=9) @@
5101
      self::checkForSupport();
5102
    }
5103
5104
    if (
5105
        $encoding === 'UTF-8'
5106
        ||
5107
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5108
    ) {
5109
      $encoding = 'UTF-8';
5110
    } else {
5111
      $encoding = self::normalize_encoding($encoding);
5112
    }
5113
5114
    if (
5115
        $encoding !== 'UTF-8' // INFO: use "mb_"-function (with polyfill) also if we need another encoding
@@ 5179-5187 (lines=9) @@
5176
      self::checkForSupport();
5177
    }
5178
5179
    if (
5180
        $encoding === 'UTF-8'
5181
        ||
5182
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5183
    ) {
5184
      $encoding = 'UTF-8';
5185
    } else {
5186
      $encoding = self::normalize_encoding($encoding);
5187
    }
5188
5189
    if (
5190
        $encoding !== 'UTF-8' // INFO: use "mb_"-function (with polyfill) also if we need another encoding
@@ 5550-5558 (lines=9) @@
5547
      self::checkForSupport();
5548
    }
5549
5550
    if (
5551
        $encoding === 'UTF-8'
5552
        ||
5553
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5554
    ) {
5555
      $encoding = 'UTF-8';
5556
    } else {
5557
      $encoding = self::normalize_encoding($encoding);
5558
    }
5559
5560
    if (
5561
        $encoding !== 'UTF-8' // INFO: use "mb_"-function (with polyfill) also if we need another encoding