Code Duplication    Length = 9-9 lines in 6 locations

src/voku/helper/UTF8.php 6 locations

@@ 4856-4864 (lines=9) @@
4853
      $needle = self::clean($needle);
4854
    }
4855
4856
    if (
4857
        $encoding === 'UTF-8'
4858
        ||
4859
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
4860
    ) {
4861
      $encoding = 'UTF-8';
4862
    } else {
4863
      $encoding = self::normalize_encoding($encoding);
4864
    }
4865
4866
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
4867
      self::checkForSupport();
@@ 4971-4979 (lines=9) @@
4968
      return 0;
4969
    }
4970
4971
    if (
4972
        $encoding === 'UTF-8'
4973
        ||
4974
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
4975
    ) {
4976
      $encoding = 'UTF-8';
4977
    } else {
4978
      $encoding = self::normalize_encoding($encoding);
4979
    }
4980
4981
    switch ($encoding) {
4982
      case 'ASCII':
@@ 5190-5198 (lines=9) @@
5187
      $haystack = self::clean($haystack);
5188
    }
5189
5190
    if (
5191
        $encoding === 'UTF-8'
5192
        ||
5193
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5194
    ) {
5195
      $encoding = 'UTF-8';
5196
    } else {
5197
      $encoding = self::normalize_encoding($encoding);
5198
    }
5199
5200
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5201
      self::checkForSupport();
@@ 5408-5416 (lines=9) @@
5405
      $haystack = self::clean($haystack);
5406
    }
5407
5408
    if (
5409
        $encoding === 'UTF-8'
5410
        ||
5411
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5412
    ) {
5413
      $encoding = 'UTF-8';
5414
    } else {
5415
      $encoding = self::normalize_encoding($encoding);
5416
    }
5417
5418
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5419
      self::checkForSupport();
@@ 5488-5496 (lines=9) @@
5485
      $haystack = self::clean($haystack);
5486
    }
5487
5488
    if (
5489
        $encoding === 'UTF-8'
5490
        ||
5491
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5492
    ) {
5493
      $encoding = 'UTF-8';
5494
    } else {
5495
      $encoding = self::normalize_encoding($encoding);
5496
    }
5497
5498
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5499
      self::checkForSupport();
@@ 5875-5883 (lines=9) @@
5872
      $length = (int)$length;
5873
    }
5874
5875
    if (
5876
        $encoding === 'UTF-8'
5877
        ||
5878
        $encoding === true || $encoding === false // INFO: the "bool"-check is only a fallback for old versions
5879
    ) {
5880
      $encoding = 'UTF-8';
5881
    } else {
5882
      $encoding = self::normalize_encoding($encoding);
5883
    }
5884
5885
    if (!isset(self::$support['already_checked_via_portable_utf8'])) {
5886
      self::checkForSupport();