Code Duplication    Length = 31-31 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 3788-3818 (lines=31) @@
3785
   *
3786
   * @return string
3787
   */
3788
  public static function rawurldecode($str, $multi_decode = true)
3789
  {
3790
    $str = (string)$str;
3791
3792
    if (!isset($str[0])) {
3793
      return '';
3794
    }
3795
3796
    $pattern = '/%u([0-9a-f]{3,4})/i';
3797
    if (preg_match($pattern, $str)) {
3798
      $str = preg_replace($pattern, '&#x\\1;', rawurldecode($str));
3799
    }
3800
3801
    $flags = Bootup::is_php('5.4') === true ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES;
3802
3803
    do {
3804
      $str_compare = $str;
3805
3806
      $str = self::fix_simple_utf8(
3807
          rawurldecode(
3808
              self::html_entity_decode(
3809
                  self::to_utf8($str),
3810
                  $flags
3811
              )
3812
          )
3813
      );
3814
3815
    } while ($multi_decode === true && $str_compare !== $str);
3816
3817
    return (string)$str;
3818
  }
3819
3820
  /**
3821
   * alias for "UTF8::remove_bom()"
@@ 7078-7108 (lines=31) @@
7075
   *
7076
   * @return string
7077
   */
7078
  public static function urldecode($str, $multi_decode = true)
7079
  {
7080
    $str = (string)$str;
7081
7082
    if (!isset($str[0])) {
7083
      return '';
7084
    }
7085
7086
    $pattern = '/%u([0-9a-f]{3,4})/i';
7087
    if (preg_match($pattern, $str)) {
7088
      $str = preg_replace($pattern, '&#x\\1;', urldecode($str));
7089
    }
7090
7091
    $flags = Bootup::is_php('5.4') === true ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES;
7092
7093
    do {
7094
      $str_compare = $str;
7095
7096
      $str = self::fix_simple_utf8(
7097
          urldecode(
7098
              self::html_entity_decode(
7099
                  self::to_utf8($str),
7100
                  $flags
7101
              )
7102
          )
7103
      );
7104
7105
    } while ($multi_decode === true && $str_compare !== $str);
7106
7107
    return (string)$str;
7108
  }
7109
7110
  /**
7111
   * Return a array with "urlencoded"-win1252 -> UTF-8