Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 4864-4872 (lines=9) @@
4861
      $needle = self::clean($needle);
4862
    }
4863
4864
    if (
4865
        $encoding === 'UTF-8'
4866
        ||
4867
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
4868
    ) {
4869
      $encoding = 'UTF-8';
4870
    } else {
4871
      $encoding = self::normalize_encoding($encoding);
4872
    }
4873
4874
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
4875
      self::checkForSupport();
@@ 4979-4987 (lines=9) @@
4976
      return 0;
4977
    }
4978
4979
    if (
4980
        $encoding === 'UTF-8'
4981
        ||
4982
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
4983
    ) {
4984
      $encoding = 'UTF-8';
4985
    } else {
4986
      $encoding = self::normalize_encoding($encoding);
4987
    }
4988
4989
    switch ($encoding) {
4990
      case 'ASCII':
@@ 5198-5206 (lines=9) @@
5195
      $haystack = self::clean($haystack);
5196
    }
5197
5198
    if (
5199
        $encoding === 'UTF-8'
5200
        ||
5201
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5202
    ) {
5203
      $encoding = 'UTF-8';
5204
    } else {
5205
      $encoding = self::normalize_encoding($encoding);
5206
    }
5207
5208
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5209
      self::checkForSupport();
@@ 5416-5424 (lines=9) @@
5413
      $haystack = self::clean($haystack);
5414
    }
5415
5416
    if (
5417
        $encoding === 'UTF-8'
5418
        ||
5419
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5420
    ) {
5421
      $encoding = 'UTF-8';
5422
    } else {
5423
      $encoding = self::normalize_encoding($encoding);
5424
    }
5425
5426
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5427
      self::checkForSupport();
@@ 5496-5504 (lines=9) @@
5493
      $haystack = self::clean($haystack);
5494
    }
5495
5496
    if (
5497
        $encoding === 'UTF-8'
5498
        ||
5499
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5500
    ) {
5501
      $encoding = 'UTF-8';
5502
    } else {
5503
      $encoding = self::normalize_encoding($encoding);
5504
    }
5505
5506
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5507
      self::checkForSupport();
@@ 5883-5891 (lines=9) @@
5880
      $length = (int)$length;
5881
    }
5882
5883
    if (
5884
        $encoding === 'UTF-8'
5885
        ||
5886
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5887
    ) {
5888
      $encoding = 'UTF-8';
5889
    } else {
5890
      $encoding = self::normalize_encoding($encoding);
5891
    }
5892
5893
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5894
      self::checkForSupport();