Code Duplication    Length = 7-9 lines in 9 locations

src/voku/helper/UTF8.php 9 locations

@@ 976-984 (lines=9) @@
973
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
974
    }
975
976
    if (
977
        $encoding !== 'UTF-8'
978
        &&
979
        $encoding !== 'WINDOWS-1252'
980
        &&
981
        self::$SUPPORT['mbstring'] === false
982
    ) {
983
      trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
984
    }
985
986
    $cacheKey = $code_point . $encoding;
987
    if (isset($CHAR_CACHE[$cacheKey]) === true) {
@@ 1393-1401 (lines=9) @@
1390
        return self::to_iso8859($str);
1391
      }
1392
1393
      if (
1394
          $encoding !== 'UTF-8'
1395
          &&
1396
          $encoding !== 'WINDOWS-1252'
1397
          &&
1398
          self::$SUPPORT['mbstring'] === false
1399
      ) {
1400
        trigger_error('UTF8::encode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
1401
      }
1402
1403
      $strEncoded = \mb_convert_encoding(
1404
          $str,
@@ 2292-2300 (lines=9) @@
2289
      }
2290
    }
2291
2292
    if (
2293
        $encoding !== 'UTF-8'
2294
        &&
2295
        $encoding !== 'WINDOWS-1252'
2296
        &&
2297
        self::$SUPPORT['mbstring'] === false
2298
    ) {
2299
      trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
2300
    }
2301
2302
    do {
2303
      $str_compare = $str;
@@ 5328-5334 (lines=7) @@
5325
      self::checkForSupport();
5326
    }
5327
5328
    if (
5329
        $encoding !== 'UTF-8'
5330
        &&
5331
        self::$SUPPORT['mbstring'] === false
5332
    ) {
5333
      trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5334
    }
5335
5336
    if (self::$SUPPORT['mbstring'] === true) {
5337
      return \mb_stristr($haystack, $needle, $before_needle, $encoding);
@@ 5873-5879 (lines=7) @@
5870
      self::checkForSupport();
5871
    }
5872
5873
    if (
5874
        $encoding !== 'UTF-8'
5875
        &&
5876
        self::$SUPPORT['mbstring'] === false
5877
    ) {
5878
      trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5879
    }
5880
5881
    if (self::$SUPPORT['mbstring'] === true) {
5882
      return \mb_strripos($haystack, $needle, $offset, $encoding);
@@ 5956-5962 (lines=7) @@
5953
      self::checkForSupport();
5954
    }
5955
5956
    if (
5957
        $encoding !== 'UTF-8'
5958
        &&
5959
        self::$SUPPORT['mbstring'] === false
5960
    ) {
5961
      trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5962
    }
5963
5964
    if (self::$SUPPORT['mbstring'] === true) {
5965
      return \mb_strrpos($haystack, $needle, $offset, $encoding);
@@ 6070-6076 (lines=7) @@
6067
      self::checkForSupport();
6068
    }
6069
6070
    if (
6071
        $encoding !== 'UTF-8'
6072
        &&
6073
        self::$SUPPORT['mbstring'] === false
6074
    ) {
6075
      trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6076
    }
6077
6078
    if (self::$SUPPORT['mbstring'] === true) {
6079
      return \mb_strstr($haystack, $needle, $before_needle, $encoding);
@@ 6474-6480 (lines=7) @@
6471
      return substr($str, $offset, $length === null ? $str_length : $length);
6472
    }
6473
6474
    if (
6475
        $encoding !== 'UTF-8'
6476
        &&
6477
        self::$SUPPORT['mbstring'] === false
6478
    ) {
6479
      trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6480
    }
6481
6482
    if (self::$SUPPORT['mbstring'] === true) {
6483
      return \mb_substr($str, $offset, $length, $encoding);
@@ 6637-6643 (lines=7) @@
6634
      self::checkForSupport();
6635
    }
6636
6637
    if (
6638
        $encoding !== 'UTF-8'
6639
        &&
6640
        self::$SUPPORT['mbstring'] === false
6641
    ) {
6642
      trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6643
    }
6644
6645
    if (self::$SUPPORT['mbstring'] === true) {
6646
      return \mb_substr_count($haystack, $needle, $encoding);