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) {
@@ 1392-1400 (lines=9) @@
1389
        return self::to_iso8859($str);
1390
      }
1391
1392
      if (
1393
          $encoding !== 'UTF-8'
1394
          &&
1395
          $encoding !== 'WINDOWS-1252'
1396
          &&
1397
          self::$SUPPORT['mbstring'] === false
1398
      ) {
1399
        trigger_error('UTF8::encode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
1400
      }
1401
1402
      $strEncoded = \mb_convert_encoding(
1403
          $str,
@@ 2291-2299 (lines=9) @@
2288
      }
2289
    }
2290
2291
    if (
2292
        $encoding !== 'UTF-8'
2293
        &&
2294
        $encoding !== 'WINDOWS-1252'
2295
        &&
2296
        self::$SUPPORT['mbstring'] === false
2297
    ) {
2298
      trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
2299
    }
2300
2301
    do {
2302
      $str_compare = $str;
@@ 5283-5289 (lines=7) @@
5280
      self::checkForSupport();
5281
    }
5282
5283
    if (
5284
        $encoding !== 'UTF-8'
5285
        &&
5286
        self::$SUPPORT['mbstring'] === false
5287
    ) {
5288
      trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5289
    }
5290
5291
    if (self::$SUPPORT['mbstring'] === true) {
5292
      return \mb_stristr($haystack, $needle, $before_needle, $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::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5834
    }
5835
5836
    if (self::$SUPPORT['mbstring'] === true) {
5837
      return \mb_strripos($haystack, $needle, $offset, $encoding);
@@ 5911-5917 (lines=7) @@
5908
      self::checkForSupport();
5909
    }
5910
5911
    if (
5912
        $encoding !== 'UTF-8'
5913
        &&
5914
        self::$SUPPORT['mbstring'] === false
5915
    ) {
5916
      trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5917
    }
5918
5919
    if (self::$SUPPORT['mbstring'] === true) {
5920
      return \mb_strrpos($haystack, $needle, $offset, $encoding);
@@ 6025-6031 (lines=7) @@
6022
      self::checkForSupport();
6023
    }
6024
6025
    if (
6026
        $encoding !== 'UTF-8'
6027
        &&
6028
        self::$SUPPORT['mbstring'] === false
6029
    ) {
6030
      trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6031
    }
6032
6033
    if (self::$SUPPORT['mbstring'] === true) {
6034
      return \mb_strstr($haystack, $needle, $before_needle, $encoding);
@@ 6429-6435 (lines=7) @@
6426
      return substr($str, $offset, $length === null ? $str_length : $length);
6427
    }
6428
6429
    if (
6430
        $encoding !== 'UTF-8'
6431
        &&
6432
        self::$SUPPORT['mbstring'] === false
6433
    ) {
6434
      trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6435
    }
6436
6437
    if (self::$SUPPORT['mbstring'] === true) {
6438
      return \mb_substr($str, $offset, $length, $encoding);
@@ 6592-6598 (lines=7) @@
6589
      self::checkForSupport();
6590
    }
6591
6592
    if (
6593
        $encoding !== 'UTF-8'
6594
        &&
6595
        self::$SUPPORT['mbstring'] === false
6596
    ) {
6597
      trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6598
    }
6599
6600
    if (self::$SUPPORT['mbstring'] === true) {
6601
      return \mb_substr_count($haystack, $needle, $encoding);