Code Duplication    Length = 7-9 lines in 9 locations

src/voku/helper/UTF8.php 9 locations

@@ 1288-1296 (lines=9) @@
1285
        return self::to_iso8859($str);
1286
      }
1287
1288
      if (
1289
          $encoding !== 'UTF-8'
1290
          &&
1291
          $encoding !== 'WINDOWS-1252'
1292
          &&
1293
          self::$support['mbstring'] === false
1294
      ) {
1295
        trigger_error('UTF8::encode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
1296
      }
1297
1298
      $strEncoded = \mb_convert_encoding(
1299
          $str,
@@ 4826-4832 (lines=7) @@
4823
      self::checkForSupport();
4824
    }
4825
4826
    if (
4827
        $encoding !== 'UTF-8'
4828
        &&
4829
        self::$support['mbstring'] === false
4830
    ) {
4831
      trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
4832
    }
4833
4834
    if (self::$support['mbstring'] === true) {
4835
      return \mb_stristr($haystack, $needle, $before_needle, $encoding);
@@ 4899-4905 (lines=7) @@
4896
      self::checkForSupport();
4897
    }
4898
4899
    if (
4900
        $encoding !== 'UTF-8'
4901
        &&
4902
        self::$support['mbstring'] === false
4903
    ) {
4904
      trigger_error('UTF8::strlen() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
4905
    }
4906
4907
    if (self::$support['mbstring'] === true) {
4908
      return \mb_strlen($str, $encoding);
@@ 5092-5098 (lines=7) @@
5089
      self::checkForSupport();
5090
    }
5091
5092
    if (
5093
        $encoding !== 'UTF-8'
5094
        &&
5095
        self::$support['mbstring'] === false
5096
    ) {
5097
      trigger_error('UTF8::strpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5098
    }
5099
5100
    if (self::$support['mbstring'] === true) {
5101
      return \mb_strpos($haystack, $needle, $offset, $encoding);
@@ 5294-5300 (lines=7) @@
5291
      self::checkForSupport();
5292
    }
5293
5294
    if (
5295
        $encoding !== 'UTF-8'
5296
        &&
5297
        self::$support['mbstring'] === false
5298
    ) {
5299
      trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5300
    }
5301
5302
    if (self::$support['mbstring'] === true) {
5303
      return \mb_strripos($haystack, $needle, $offset, $encoding);
@@ 5374-5380 (lines=7) @@
5371
      self::checkForSupport();
5372
    }
5373
5374
    if (
5375
        $encoding !== 'UTF-8'
5376
        &&
5377
        self::$support['mbstring'] === false
5378
    ) {
5379
      trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5380
    }
5381
5382
    if (self::$support['mbstring'] === true) {
5383
      $returnTmp = \mb_strrpos($haystack, $needle, $offset, $encoding);
@@ 5480-5486 (lines=7) @@
5477
      self::checkForSupport();
5478
    }
5479
5480
    if (
5481
        $encoding !== 'UTF-8'
5482
        &&
5483
        self::$support['mbstring'] === false
5484
    ) {
5485
      trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5486
    }
5487
5488
    if (self::$support['mbstring'] === true) {
5489
      $returnTmp = \mb_strstr($haystack, $needle, $before_needle, $encoding);
@@ 5761-5767 (lines=7) @@
5758
      self::checkForSupport();
5759
    }
5760
5761
    if (
5762
        $encoding !== 'UTF-8'
5763
        &&
5764
        self::$support['mbstring'] === false
5765
    ) {
5766
      trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5767
    }
5768
5769
    if (self::$support['mbstring'] === true) {
5770
      return \mb_substr($str, $start, $length, $encoding);
@@ 5874-5880 (lines=7) @@
5871
      self::checkForSupport();
5872
    }
5873
5874
    if (
5875
        $encoding !== 'UTF-8'
5876
        &&
5877
        self::$support['mbstring'] === false
5878
    ) {
5879
      trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5880
    }
5881
5882
    if (self::$support['mbstring'] === true) {
5883
      return \mb_substr_count($haystack, $needle, $encoding);