Code Duplication    Length = 7-7 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 5602-5608 (lines=7) @@
5599
      self::checkForSupport();
5600
    }
5601
5602
    if (
5603
        $encoding !== 'UTF-8'
5604
        &&
5605
        self::$SUPPORT['mbstring'] === false
5606
    ) {
5607
      \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5608
    }
5609
5610
    if (self::$SUPPORT['mbstring'] === true) {
5611
      return \mb_stristr($haystack, $needle, $before_needle, $encoding);
@@ 6134-6140 (lines=7) @@
6131
      self::checkForSupport();
6132
    }
6133
6134
    if (
6135
        $encoding !== 'UTF-8'
6136
        &&
6137
        self::$SUPPORT['mbstring'] === false
6138
    ) {
6139
      \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6140
    }
6141
6142
    if (self::$SUPPORT['mbstring'] === true) {
6143
      return \mb_strripos($haystack, $needle, $offset, $encoding);
@@ 6205-6211 (lines=7) @@
6202
      self::checkForSupport();
6203
    }
6204
6205
    if (
6206
        $encoding !== 'UTF-8'
6207
        &&
6208
        self::$SUPPORT['mbstring'] === false
6209
    ) {
6210
      \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6211
    }
6212
6213
    if (self::$SUPPORT['mbstring'] === true) {
6214
      return \mb_strrpos($haystack, $needle, $offset, $encoding);
@@ 6313-6319 (lines=7) @@
6310
      self::checkForSupport();
6311
    }
6312
6313
    if (
6314
        $encoding !== 'UTF-8'
6315
        &&
6316
        self::$SUPPORT['mbstring'] === false
6317
    ) {
6318
      \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6319
    }
6320
6321
    if (self::$SUPPORT['mbstring'] === true) {
6322
      return \mb_strstr($haystack, $needle, $before_needle, $encoding);
@@ 6658-6664 (lines=7) @@
6655
      return \substr($str, $offset, $length ?? $str_length);
6656
    }
6657
6658
    if (
6659
        $encoding !== 'UTF-8'
6660
        &&
6661
        self::$SUPPORT['mbstring'] === false
6662
    ) {
6663
      \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6664
    }
6665
6666
    if (self::$SUPPORT['mbstring'] === true) {
6667
      return \mb_substr($str, $offset, $length, $encoding);
@@ 6815-6821 (lines=7) @@
6812
      self::checkForSupport();
6813
    }
6814
6815
    if (
6816
        $encoding !== 'UTF-8'
6817
        &&
6818
        self::$SUPPORT['mbstring'] === false
6819
    ) {
6820
      \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6821
    }
6822
6823
    if (self::$SUPPORT['mbstring'] === true) {
6824
      return \mb_substr_count($haystack, $needle, $encoding);