Code Duplication    Length = 7-9 lines in 7 locations

src/voku/helper/UTF8.php 7 locations

@@ 1372-1380 (lines=9) @@
1369
        return self::to_iso8859($str);
1370
      }
1371
1372
      if (
1373
          $encoding !== 'UTF-8'
1374
          &&
1375
          $encoding !== 'WINDOWS-1252'
1376
          &&
1377
          self::$SUPPORT['mbstring'] === false
1378
      ) {
1379
        trigger_error('UTF8::encode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
1380
      }
1381
1382
      $strEncoded = \mb_convert_encoding(
1383
          $str,
@@ 5252-5258 (lines=7) @@
5249
      self::checkForSupport();
5250
    }
5251
5252
    if (
5253
        $encoding !== 'UTF-8'
5254
        &&
5255
        self::$SUPPORT['mbstring'] === false
5256
    ) {
5257
      trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5258
    }
5259
5260
    if (self::$SUPPORT['mbstring'] === true) {
5261
      return \mb_stristr($haystack, $needle, $before_needle, $encoding);
@@ 5796-5802 (lines=7) @@
5793
      self::checkForSupport();
5794
    }
5795
5796
    if (
5797
        $encoding !== 'UTF-8'
5798
        &&
5799
        self::$SUPPORT['mbstring'] === false
5800
    ) {
5801
      trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5802
    }
5803
5804
    if (self::$SUPPORT['mbstring'] === true) {
5805
      return \mb_strripos($haystack, $needle, $offset, $encoding);
@@ 5879-5885 (lines=7) @@
5876
      self::checkForSupport();
5877
    }
5878
5879
    if (
5880
        $encoding !== 'UTF-8'
5881
        &&
5882
        self::$SUPPORT['mbstring'] === false
5883
    ) {
5884
      trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5885
    }
5886
5887
    if (self::$SUPPORT['mbstring'] === true) {
5888
      return \mb_strrpos($haystack, $needle, $offset, $encoding);
@@ 5993-5999 (lines=7) @@
5990
      self::checkForSupport();
5991
    }
5992
5993
    if (
5994
        $encoding !== 'UTF-8'
5995
        &&
5996
        self::$SUPPORT['mbstring'] === false
5997
    ) {
5998
      trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5999
    }
6000
6001
    if (self::$SUPPORT['mbstring'] === true) {
6002
      return \mb_strstr($haystack, $needle, $before_needle, $encoding);
@@ 6397-6403 (lines=7) @@
6394
      return substr($str, $offset, $length === null ? $str_length : $length);
6395
    }
6396
6397
    if (
6398
        $encoding !== 'UTF-8'
6399
        &&
6400
        self::$SUPPORT['mbstring'] === false
6401
    ) {
6402
      trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6403
    }
6404
6405
    if (self::$SUPPORT['mbstring'] === true) {
6406
      return \mb_substr($str, $offset, $length, $encoding);
@@ 6560-6566 (lines=7) @@
6557
      self::checkForSupport();
6558
    }
6559
6560
    if (
6561
        $encoding !== 'UTF-8'
6562
        &&
6563
        self::$SUPPORT['mbstring'] === false
6564
    ) {
6565
      trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6566
    }
6567
6568
    if (self::$SUPPORT['mbstring'] === true) {
6569
      return \mb_substr_count($haystack, $needle, $encoding);