/** * Percent encode UTF-8 string, using an encode set. * @param string $encodeSet Regular expression (PCRE) pattern matching exactly one UTF-8 character. * @param string $codePoints A UTF-8 string. * @return string */ private static function percentEncodeCodePoints($encodeSet, $codePoints) { return preg_replace_callback($encodeSet, function ($matches) { $result = rawurlencode($matches[0]); if ($result[0] !== '%') { $result = Infrastructure::percentEncode($matches[0]); } return $result; }, $codePoints); }
/** * Alias of {@link Infrastructure}::percentEncode(). * @param string $byte Exactly one byte. * @return string "%", followed by two ASCII hex digits. */ public static function percentEncode($byte) { return Infrastructure::percentEncode($byte); }