Code Duplication    Length = 7-9 lines in 9 locations

src/voku/helper/UTF8.php 9 locations

@@ 1287-1295 (lines=9) @@
1284
        return self::to_iso8859($str);
1285
      }
1286
1287
      if (
1288
          $encoding !== 'UTF-8'
1289
          &&
1290
          $encoding !== 'WINDOWS-1252'
1291
          &&
1292
          self::$support['mbstring'] === false
1293
      ) {
1294
        trigger_error('UTF8::encode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
1295
      }
1296
1297
      $strEncoded = \mb_convert_encoding(
1298
          $str,
@@ 4777-4783 (lines=7) @@
4774
      self::checkForSupport();
4775
    }
4776
4777
    if (
4778
        $encoding !== 'UTF-8'
4779
        &&
4780
        self::$support['mbstring'] === false
4781
    ) {
4782
      trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
4783
    }
4784
4785
    if (self::$support['mbstring'] === true) {
4786
      return \mb_stristr($haystack, $needle, $before_needle, $encoding);
@@ 4850-4856 (lines=7) @@
4847
      self::checkForSupport();
4848
    }
4849
4850
    if (
4851
        $encoding !== 'UTF-8'
4852
        &&
4853
        self::$support['mbstring'] === false
4854
    ) {
4855
      trigger_error('UTF8::strlen() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
4856
    }
4857
4858
    if (self::$support['mbstring'] === true) {
4859
      return \mb_strlen($str, $encoding);
@@ 5043-5049 (lines=7) @@
5040
      self::checkForSupport();
5041
    }
5042
5043
    if (
5044
        $encoding !== 'UTF-8'
5045
        &&
5046
        self::$support['mbstring'] === false
5047
    ) {
5048
      trigger_error('UTF8::strpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5049
    }
5050
5051
    if (self::$support['mbstring'] === true) {
5052
      return \mb_strpos($haystack, $needle, $offset, $encoding);
@@ 5245-5251 (lines=7) @@
5242
      self::checkForSupport();
5243
    }
5244
5245
    if (
5246
        $encoding !== 'UTF-8'
5247
        &&
5248
        self::$support['mbstring'] === false
5249
    ) {
5250
      trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5251
    }
5252
5253
    if (self::$support['mbstring'] === true) {
5254
      return \mb_strripos($haystack, $needle, $offset, $encoding);
@@ 5326-5332 (lines=7) @@
5323
      self::checkForSupport();
5324
    }
5325
5326
    if (
5327
        $encoding !== 'UTF-8'
5328
        &&
5329
        self::$support['mbstring'] === false
5330
    ) {
5331
      trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5332
    }
5333
5334
    if (self::$support['mbstring'] === true) {
5335
      $returnTmp = \mb_strrpos($haystack, $needle, $offset, $encoding);
@@ 5432-5438 (lines=7) @@
5429
      self::checkForSupport();
5430
    }
5431
5432
    if (
5433
        $encoding !== 'UTF-8'
5434
        &&
5435
        self::$support['mbstring'] === false
5436
    ) {
5437
      trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5438
    }
5439
5440
    if (self::$support['mbstring'] === true) {
5441
      $returnTmp = \mb_strstr($haystack, $needle, $before_needle, $encoding);
@@ 5715-5721 (lines=7) @@
5712
      self::checkForSupport();
5713
    }
5714
5715
    if (
5716
        $encoding !== 'UTF-8'
5717
        &&
5718
        self::$support['mbstring'] === false
5719
    ) {
5720
      trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5721
    }
5722
5723
    if (self::$support['mbstring'] === true) {
5724
      return \mb_substr($str, $start, $length, $encoding);
@@ 5828-5834 (lines=7) @@
5825
      self::checkForSupport();
5826
    }
5827
5828
    if (
5829
        $encoding !== 'UTF-8'
5830
        &&
5831
        self::$support['mbstring'] === false
5832
    ) {
5833
      trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5834
    }
5835
5836
    if (self::$support['mbstring'] === true) {
5837
      return \mb_substr_count($haystack, $needle, $encoding);