Code Duplication    Length = 31-31 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 3875-3905 (lines=31) @@
3872
   *
3873
   * @return string
3874
   */
3875
  public static function rawurldecode($str, $multi_decode = true)
3876
  {
3877
    $str = (string)$str;
3878
3879
    if (!isset($str[0])) {
3880
      return '';
3881
    }
3882
3883
    $pattern = '/%u([0-9a-f]{3,4})/i';
3884
    if (preg_match($pattern, $str)) {
3885
      $str = preg_replace($pattern, '&#x\\1;', rawurldecode($str));
3886
    }
3887
3888
    $flags = Bootup::is_php('5.4') === true ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES;
3889
3890
    do {
3891
      $str_compare = $str;
3892
3893
      $str = self::fix_simple_utf8(
3894
          rawurldecode(
3895
              self::html_entity_decode(
3896
                  self::to_utf8($str),
3897
                  $flags
3898
              )
3899
          )
3900
      );
3901
3902
    } while ($multi_decode === true && $str_compare !== $str);
3903
3904
    return (string)$str;
3905
  }
3906
3907
  /**
3908
   * alias for "UTF8::remove_bom()"
@@ 7297-7327 (lines=31) @@
7294
   *
7295
   * @return string
7296
   */
7297
  public static function urldecode($str, $multi_decode = true)
7298
  {
7299
    $str = (string)$str;
7300
7301
    if (!isset($str[0])) {
7302
      return '';
7303
    }
7304
7305
    $pattern = '/%u([0-9a-f]{3,4})/i';
7306
    if (preg_match($pattern, $str)) {
7307
      $str = preg_replace($pattern, '&#x\\1;', urldecode($str));
7308
    }
7309
7310
    $flags = Bootup::is_php('5.4') === true ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES;
7311
7312
    do {
7313
      $str_compare = $str;
7314
7315
      $str = self::fix_simple_utf8(
7316
          urldecode(
7317
              self::html_entity_decode(
7318
                  self::to_utf8($str),
7319
                  $flags
7320
              )
7321
          )
7322
      );
7323
7324
    } while ($multi_decode === true && $str_compare !== $str);
7325
7326
    return (string)$str;
7327
  }
7328
7329
  /**
7330
   * Return a array with "urlencoded"-win1252 -> UTF-8