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()"
@@ 7311-7341 (lines=31) @@
7308
   *
7309
   * @return string
7310
   */
7311
  public static function urldecode($str, $multi_decode = true)
7312
  {
7313
    $str = (string)$str;
7314
7315
    if (!isset($str[0])) {
7316
      return '';
7317
    }
7318
7319
    $pattern = '/%u([0-9a-f]{3,4})/i';
7320
    if (preg_match($pattern, $str)) {
7321
      $str = preg_replace($pattern, '&#x\\1;', urldecode($str));
7322
    }
7323
7324
    $flags = Bootup::is_php('5.4') === true ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES;
7325
7326
    do {
7327
      $str_compare = $str;
7328
7329
      $str = self::fix_simple_utf8(
7330
          urldecode(
7331
              self::html_entity_decode(
7332
                  self::to_utf8($str),
7333
                  $flags
7334
              )
7335
          )
7336
      );
7337
7338
    } while ($multi_decode === true && $str_compare !== $str);
7339
7340
    return (string)$str;
7341
  }
7342
7343
  /**
7344
   * Return a array with "urlencoded"-win1252 -> UTF-8