Code Duplication    Length = 31-31 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 3795-3825 (lines=31) @@
3792
   *
3793
   * @return string
3794
   */
3795
  public static function rawurldecode($str, $multi_decode = true)
3796
  {
3797
    $str = (string)$str;
3798
3799
    if (!isset($str[0])) {
3800
      return '';
3801
    }
3802
3803
    $pattern = '/%u([0-9a-f]{3,4})/i';
3804
    if (preg_match($pattern, $str)) {
3805
      $str = preg_replace($pattern, '&#x\\1;', rawurldecode($str));
3806
    }
3807
3808
    $flags = Bootup::is_php('5.4') === true ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES;
3809
3810
    do {
3811
      $str_compare = $str;
3812
3813
      $str = self::fix_simple_utf8(
3814
          rawurldecode(
3815
              self::html_entity_decode(
3816
                  self::to_utf8($str),
3817
                  $flags
3818
              )
3819
          )
3820
      );
3821
3822
    } while ($multi_decode === true && $str_compare !== $str);
3823
3824
    return (string)$str;
3825
  }
3826
3827
  /**
3828
   * alias for "UTF8::remove_bom()"
@@ 7131-7161 (lines=31) @@
7128
   *
7129
   * @return string
7130
   */
7131
  public static function urldecode($str, $multi_decode = true)
7132
  {
7133
    $str = (string)$str;
7134
7135
    if (!isset($str[0])) {
7136
      return '';
7137
    }
7138
7139
    $pattern = '/%u([0-9a-f]{3,4})/i';
7140
    if (preg_match($pattern, $str)) {
7141
      $str = preg_replace($pattern, '&#x\\1;', urldecode($str));
7142
    }
7143
7144
    $flags = Bootup::is_php('5.4') === true ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES;
7145
7146
    do {
7147
      $str_compare = $str;
7148
7149
      $str = self::fix_simple_utf8(
7150
          urldecode(
7151
              self::html_entity_decode(
7152
                  self::to_utf8($str),
7153
                  $flags
7154
              )
7155
          )
7156
      );
7157
7158
    } while ($multi_decode === true && $str_compare !== $str);
7159
7160
    return (string)$str;
7161
  }
7162
7163
  /**
7164
   * Return a array with "urlencoded"-win1252 -> UTF-8