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,
@@ 4747-4753 (lines=7) @@
4744
      self::checkForSupport();
4745
    }
4746
4747
    if (
4748
        $encoding !== 'UTF-8'
4749
        &&
4750
        self::$support['mbstring'] === false
4751
    ) {
4752
      trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
4753
    }
4754
4755
    if (self::$support['mbstring'] === true) {
4756
      return \mb_stristr($haystack, $needle, $before_needle, $encoding);
@@ 4820-4826 (lines=7) @@
4817
      self::checkForSupport();
4818
    }
4819
4820
    if (
4821
        $encoding !== 'UTF-8'
4822
        &&
4823
        self::$support['mbstring'] === false
4824
    ) {
4825
      trigger_error('UTF8::strlen() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
4826
    }
4827
4828
    if (self::$support['mbstring'] === true) {
4829
      return \mb_strlen($str, $encoding);
@@ 5013-5019 (lines=7) @@
5010
      self::checkForSupport();
5011
    }
5012
5013
    if (
5014
        $encoding !== 'UTF-8'
5015
        &&
5016
        self::$support['mbstring'] === false
5017
    ) {
5018
      trigger_error('UTF8::strpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5019
    }
5020
5021
    if (self::$support['mbstring'] === true) {
5022
      return \mb_strpos($haystack, $needle, $offset, $encoding);
@@ 5215-5221 (lines=7) @@
5212
      self::checkForSupport();
5213
    }
5214
5215
    if (
5216
        $encoding !== 'UTF-8'
5217
        &&
5218
        self::$support['mbstring'] === false
5219
    ) {
5220
      trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5221
    }
5222
5223
    if (self::$support['mbstring'] === true) {
5224
      return \mb_strripos($haystack, $needle, $offset, $encoding);
@@ 5296-5302 (lines=7) @@
5293
      self::checkForSupport();
5294
    }
5295
5296
    if (
5297
        $encoding !== 'UTF-8'
5298
        &&
5299
        self::$support['mbstring'] === false
5300
    ) {
5301
      trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5302
    }
5303
5304
    if (self::$support['mbstring'] === true) {
5305
      $returnTmp = \mb_strrpos($haystack, $needle, $offset, $encoding);
@@ 5402-5408 (lines=7) @@
5399
      self::checkForSupport();
5400
    }
5401
5402
    if (
5403
        $encoding !== 'UTF-8'
5404
        &&
5405
        self::$support['mbstring'] === false
5406
    ) {
5407
      trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5408
    }
5409
5410
    if (self::$support['mbstring'] === true) {
5411
      $returnTmp = \mb_strstr($haystack, $needle, $before_needle, $encoding);
@@ 5685-5691 (lines=7) @@
5682
      self::checkForSupport();
5683
    }
5684
5685
    if (
5686
        $encoding !== 'UTF-8'
5687
        &&
5688
        self::$support['mbstring'] === false
5689
    ) {
5690
      trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5691
    }
5692
5693
    if (self::$support['mbstring'] === true) {
5694
      return \mb_substr($str, $start, $length, $encoding);
@@ 5798-5804 (lines=7) @@
5795
      self::checkForSupport();
5796
    }
5797
5798
    if (
5799
        $encoding !== 'UTF-8'
5800
        &&
5801
        self::$support['mbstring'] === false
5802
    ) {
5803
      trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5804
    }
5805
5806
    if (self::$support['mbstring'] === true) {
5807
      return \mb_substr_count($haystack, $needle, $encoding);