Code Duplication    Length = 7-7 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 4619-4625 (lines=7) @@
4616
      self::checkForSupport();
4617
    }
4618
4619
    if (
4620
        $encoding !== 'UTF-8'
4621
        &&
4622
        self::$SUPPORT['mbstring'] === false
4623
    ) {
4624
      \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
4625
    }
4626
4627
    if (self::$SUPPORT['mbstring'] === true) {
4628
      return \mb_stristr($haystack, $needle, $before_needle, $encoding);
@@ 5151-5157 (lines=7) @@
5148
      self::checkForSupport();
5149
    }
5150
5151
    if (
5152
        $encoding !== 'UTF-8'
5153
        &&
5154
        self::$SUPPORT['mbstring'] === false
5155
    ) {
5156
      \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5157
    }
5158
5159
    if (self::$SUPPORT['mbstring'] === true) {
5160
      return \mb_strripos($haystack, $needle, $offset, $encoding);
@@ 5222-5228 (lines=7) @@
5219
      self::checkForSupport();
5220
    }
5221
5222
    if (
5223
        $encoding !== 'UTF-8'
5224
        &&
5225
        self::$SUPPORT['mbstring'] === false
5226
    ) {
5227
      \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5228
    }
5229
5230
    if (self::$SUPPORT['mbstring'] === true) {
5231
      return \mb_strrpos($haystack, $needle, $offset, $encoding);
@@ 5330-5336 (lines=7) @@
5327
      self::checkForSupport();
5328
    }
5329
5330
    if (
5331
        $encoding !== 'UTF-8'
5332
        &&
5333
        self::$SUPPORT['mbstring'] === false
5334
    ) {
5335
      \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5336
    }
5337
5338
    if (self::$SUPPORT['mbstring'] === true) {
5339
      return \mb_strstr($haystack, $needle, $before_needle, $encoding);
@@ 5675-5681 (lines=7) @@
5672
      return \substr($str, $offset, $length ?? $str_length);
5673
    }
5674
5675
    if (
5676
        $encoding !== 'UTF-8'
5677
        &&
5678
        self::$SUPPORT['mbstring'] === false
5679
    ) {
5680
      \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5681
    }
5682
5683
    if (self::$SUPPORT['mbstring'] === true) {
5684
      return \mb_substr($str, $offset, $length, $encoding);
@@ 5832-5838 (lines=7) @@
5829
      self::checkForSupport();
5830
    }
5831
5832
    if (
5833
        $encoding !== 'UTF-8'
5834
        &&
5835
        self::$SUPPORT['mbstring'] === false
5836
    ) {
5837
      \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5838
    }
5839
5840
    if (self::$SUPPORT['mbstring'] === true) {
5841
      return \mb_substr_count($haystack, $needle, $encoding);