Code Duplication    Length = 31-31 lines in 2 locations

includes/libraries/protect/AntiXSS/UTF8.php 2 locations

@@ 3878-3908 (lines=31) @@
3875
   *
3876
   * @return string
3877
   */
3878
  public static function rawurldecode($str, $multi_decode = true)
3879
  {
3880
    $str = (string)$str;
3881
3882
    if (!isset($str[0])) {
3883
      return '';
3884
    }
3885
3886
    $pattern = '/%u([0-9a-f]{3,4})/i';
3887
    if (preg_match($pattern, $str)) {
3888
      $str = preg_replace($pattern, '&#x\\1;', rawurldecode($str));
3889
    }
3890
3891
    $flags = Bootup::is_php('5.4') === true ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES;
3892
3893
    do {
3894
      $str_compare = $str;
3895
3896
      $str = self::fix_simple_utf8(
3897
          rawurldecode(
3898
              self::html_entity_decode(
3899
                  self::to_utf8($str),
3900
                  $flags
3901
              )
3902
          )
3903
      );
3904
3905
    } while ($multi_decode === true && $str_compare !== $str);
3906
3907
    return (string)$str;
3908
  }
3909
3910
  /**
3911
   * alias for "UTF8::remove_bom()"
@@ 7350-7380 (lines=31) @@
7347
   *
7348
   * @return string
7349
   */
7350
  public static function urldecode($str, $multi_decode = true)
7351
  {
7352
    $str = (string)$str;
7353
7354
    if (!isset($str[0])) {
7355
      return '';
7356
    }
7357
7358
    $pattern = '/%u([0-9a-f]{3,4})/i';
7359
    if (preg_match($pattern, $str)) {
7360
      $str = preg_replace($pattern, '&#x\\1;', urldecode($str));
7361
    }
7362
7363
    $flags = Bootup::is_php('5.4') === true ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES;
7364
7365
    do {
7366
      $str_compare = $str;
7367
7368
      $str = self::fix_simple_utf8(
7369
          urldecode(
7370
              self::html_entity_decode(
7371
                  self::to_utf8($str),
7372
                  $flags
7373
              )
7374
          )
7375
      );
7376
7377
    } while ($multi_decode === true && $str_compare !== $str);
7378
7379
    return (string)$str;
7380
  }
7381
7382
  /**
7383
   * Return a array with "urlencoded"-win1252 -> UTF-8