Code Duplication    Length = 7-7 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 4610-4616 (lines=7) @@
4607
      self::checkForSupport();
4608
    }
4609
4610
    if (
4611
        $encoding !== 'UTF-8'
4612
        &&
4613
        self::$SUPPORT['mbstring'] === false
4614
    ) {
4615
      \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
4616
    }
4617
4618
    if (self::$SUPPORT['mbstring'] === true) {
4619
      return \mb_stristr($haystack, $needle, $before_needle, $encoding);
@@ 5142-5148 (lines=7) @@
5139
      self::checkForSupport();
5140
    }
5141
5142
    if (
5143
        $encoding !== 'UTF-8'
5144
        &&
5145
        self::$SUPPORT['mbstring'] === false
5146
    ) {
5147
      \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5148
    }
5149
5150
    if (self::$SUPPORT['mbstring'] === true) {
5151
      return \mb_strripos($haystack, $needle, $offset, $encoding);
@@ 5213-5219 (lines=7) @@
5210
      self::checkForSupport();
5211
    }
5212
5213
    if (
5214
        $encoding !== 'UTF-8'
5215
        &&
5216
        self::$SUPPORT['mbstring'] === false
5217
    ) {
5218
      \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5219
    }
5220
5221
    if (self::$SUPPORT['mbstring'] === true) {
5222
      return \mb_strrpos($haystack, $needle, $offset, $encoding);
@@ 5321-5327 (lines=7) @@
5318
      self::checkForSupport();
5319
    }
5320
5321
    if (
5322
        $encoding !== 'UTF-8'
5323
        &&
5324
        self::$SUPPORT['mbstring'] === false
5325
    ) {
5326
      \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5327
    }
5328
5329
    if (self::$SUPPORT['mbstring'] === true) {
5330
      return \mb_strstr($haystack, $needle, $before_needle, $encoding);
@@ 5664-5670 (lines=7) @@
5661
      return \substr($str, $offset, $length ?? $str_length);
5662
    }
5663
5664
    if (
5665
        $encoding !== 'UTF-8'
5666
        &&
5667
        self::$SUPPORT['mbstring'] === false
5668
    ) {
5669
      \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5670
    }
5671
5672
    if (self::$SUPPORT['mbstring'] === true) {
5673
      return \mb_substr($str, $offset, $length, $encoding);
@@ 5821-5827 (lines=7) @@
5818
      self::checkForSupport();
5819
    }
5820
5821
    if (
5822
        $encoding !== 'UTF-8'
5823
        &&
5824
        self::$SUPPORT['mbstring'] === false
5825
    ) {
5826
      \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5827
    }
5828
5829
    if (self::$SUPPORT['mbstring'] === true) {
5830
      return \mb_substr_count($haystack, $needle, $encoding);