Code Duplication    Length = 31-31 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 3718-3748 (lines=31) @@
3715
   *
3716
   * @return string
3717
   */
3718
  public static function rawurldecode($str, $multi_decode = true)
3719
  {
3720
    $str = (string)$str;
3721
3722
    if (!isset($str[0])) {
3723
      return '';
3724
    }
3725
3726
    $pattern = '/%u([0-9a-f]{3,4})/i';
3727
    if (preg_match($pattern, $str)) {
3728
      $str = preg_replace($pattern, '&#x\\1;', rawurldecode($str));
3729
    }
3730
3731
    $flags = Bootup::is_php('5.4') === true ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES;
3732
3733
    do {
3734
      $str_compare = $str;
3735
3736
      $str = self::fix_simple_utf8(
3737
          rawurldecode(
3738
              self::html_entity_decode(
3739
                  self::to_utf8($str),
3740
                  $flags
3741
              )
3742
          )
3743
      );
3744
3745
    } while ($multi_decode === true && $str_compare !== $str);
3746
3747
    return (string)$str;
3748
  }
3749
3750
  /**
3751
   * alias for "UTF8::remove_bom()"
@@ 6898-6928 (lines=31) @@
6895
   *
6896
   * @return string
6897
   */
6898
  public static function urldecode($str, $multi_decode = true)
6899
  {
6900
    $str = (string)$str;
6901
6902
    if (!isset($str[0])) {
6903
      return '';
6904
    }
6905
6906
    $pattern = '/%u([0-9a-f]{3,4})/i';
6907
    if (preg_match($pattern, $str)) {
6908
      $str = preg_replace($pattern, '&#x\\1;', urldecode($str));
6909
    }
6910
6911
    $flags = Bootup::is_php('5.4') === true ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES;
6912
6913
    do {
6914
      $str_compare = $str;
6915
6916
      $str = self::fix_simple_utf8(
6917
          urldecode(
6918
              self::html_entity_decode(
6919
                  self::to_utf8($str),
6920
                  $flags
6921
              )
6922
          )
6923
      );
6924
6925
    } while ($multi_decode === true && $str_compare !== $str);
6926
6927
    return (string)$str;
6928
  }
6929
6930
  /**
6931
   * Return a array with "urlencoded"-win1252 -> UTF-8