Code Duplication    Length = 31-31 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 3787-3817 (lines=31) @@
3784
   *
3785
   * @return string
3786
   */
3787
  public static function rawurldecode($str, $multi_decode = true)
3788
  {
3789
    $str = (string)$str;
3790
3791
    if (!isset($str[0])) {
3792
      return '';
3793
    }
3794
3795
    $pattern = '/%u([0-9a-f]{3,4})/i';
3796
    if (preg_match($pattern, $str)) {
3797
      $str = preg_replace($pattern, '&#x\\1;', rawurldecode($str));
3798
    }
3799
3800
    $flags = Bootup::is_php('5.4') === true ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES;
3801
3802
    do {
3803
      $str_compare = $str;
3804
3805
      $str = self::fix_simple_utf8(
3806
          rawurldecode(
3807
              self::html_entity_decode(
3808
                  self::to_utf8($str),
3809
                  $flags
3810
              )
3811
          )
3812
      );
3813
3814
    } while ($multi_decode === true && $str_compare !== $str);
3815
3816
    return (string)$str;
3817
  }
3818
3819
  /**
3820
   * alias for "UTF8::remove_bom()"
@@ 7024-7054 (lines=31) @@
7021
   *
7022
   * @return string
7023
   */
7024
  public static function urldecode($str, $multi_decode = true)
7025
  {
7026
    $str = (string)$str;
7027
7028
    if (!isset($str[0])) {
7029
      return '';
7030
    }
7031
7032
    $pattern = '/%u([0-9a-f]{3,4})/i';
7033
    if (preg_match($pattern, $str)) {
7034
      $str = preg_replace($pattern, '&#x\\1;', urldecode($str));
7035
    }
7036
7037
    $flags = Bootup::is_php('5.4') === true ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES;
7038
7039
    do {
7040
      $str_compare = $str;
7041
7042
      $str = self::fix_simple_utf8(
7043
          urldecode(
7044
              self::html_entity_decode(
7045
                  self::to_utf8($str),
7046
                  $flags
7047
              )
7048
          )
7049
      );
7050
7051
    } while ($multi_decode === true && $str_compare !== $str);
7052
7053
    return (string)$str;
7054
  }
7055
7056
  /**
7057
   * Return a array with "urlencoded"-win1252 -> UTF-8