Code Duplication    Length = 7-9 lines in 7 locations

src/voku/helper/UTF8.php 7 locations

@@ 1328-1336 (lines=9) @@
1325
        return self::to_iso8859($str);
1326
      }
1327
1328
      if (
1329
          $encoding !== 'UTF-8'
1330
          &&
1331
          $encoding !== 'WINDOWS-1252'
1332
          &&
1333
          self::$support['mbstring'] === false
1334
      ) {
1335
        trigger_error('UTF8::encode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
1336
      }
1337
1338
      $strEncoded = \mb_convert_encoding(
1339
          $str,
@@ 4920-4926 (lines=7) @@
4917
      self::checkForSupport();
4918
    }
4919
4920
    if (
4921
        $encoding !== 'UTF-8'
4922
        &&
4923
        self::$support['mbstring'] === false
4924
    ) {
4925
      trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
4926
    }
4927
4928
    if (self::$support['mbstring'] === true) {
4929
      return \mb_stristr($haystack, $needle, $before_needle, $encoding);
@@ 5420-5426 (lines=7) @@
5417
      self::checkForSupport();
5418
    }
5419
5420
    if (
5421
        $encoding !== 'UTF-8'
5422
        &&
5423
        self::$support['mbstring'] === false
5424
    ) {
5425
      trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5426
    }
5427
5428
    if (self::$support['mbstring'] === true) {
5429
      return \mb_strripos($haystack, $needle, $offset, $encoding);
@@ 5500-5506 (lines=7) @@
5497
      self::checkForSupport();
5498
    }
5499
5500
    if (
5501
        $encoding !== 'UTF-8'
5502
        &&
5503
        self::$support['mbstring'] === false
5504
    ) {
5505
      trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5506
    }
5507
5508
    if (self::$support['mbstring'] === true) {
5509
      $returnTmp = \mb_strrpos($haystack, $needle, $offset, $encoding);
@@ 5606-5612 (lines=7) @@
5603
      self::checkForSupport();
5604
    }
5605
5606
    if (
5607
        $encoding !== 'UTF-8'
5608
        &&
5609
        self::$support['mbstring'] === false
5610
    ) {
5611
      trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5612
    }
5613
5614
    if (self::$support['mbstring'] === true) {
5615
      $returnTmp = \mb_strstr($haystack, $needle, $before_needle, $encoding);
@@ 5887-5893 (lines=7) @@
5884
      self::checkForSupport();
5885
    }
5886
5887
    if (
5888
        $encoding !== 'UTF-8'
5889
        &&
5890
        self::$support['mbstring'] === false
5891
    ) {
5892
      trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5893
    }
5894
5895
    if (self::$support['mbstring'] === true) {
5896
      return \mb_substr($str, $start, $length, $encoding);
@@ 6000-6006 (lines=7) @@
5997
      self::checkForSupport();
5998
    }
5999
6000
    if (
6001
        $encoding !== 'UTF-8'
6002
        &&
6003
        self::$support['mbstring'] === false
6004
    ) {
6005
      trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6006
    }
6007
6008
    if (self::$support['mbstring'] === true) {
6009
      return \mb_substr_count($haystack, $needle, $encoding);