提交的内容
This commit is contained in:
24
vendor/rmccue/requests/src/IdnaEncoder.php
vendored
Executable file → Normal file
24
vendor/rmccue/requests/src/IdnaEncoder.php
vendored
Executable file → Normal file
@ -137,7 +137,7 @@ class IdnaEncoder {
|
||||
*
|
||||
* @internal (Testing found regex was the fastest implementation)
|
||||
*
|
||||
* @param string $text
|
||||
* @param string $text Text to examine.
|
||||
* @return bool Is the text string ASCII-only?
|
||||
*/
|
||||
protected static function is_ascii($text) {
|
||||
@ -148,7 +148,7 @@ class IdnaEncoder {
|
||||
* Prepare a text string for use as an IDNA name
|
||||
*
|
||||
* @todo Implement this based on RFC 3491 and the newer 5891
|
||||
* @param string $text
|
||||
* @param string $text Text to prepare.
|
||||
* @return string Prepared string
|
||||
*/
|
||||
protected static function nameprep($text) {
|
||||
@ -160,7 +160,7 @@ class IdnaEncoder {
|
||||
*
|
||||
* Based on \WpOrg\Requests\Iri::replace_invalid_with_pct_encoding()
|
||||
*
|
||||
* @param string $input
|
||||
* @param string $input Text to convert.
|
||||
* @return array Unicode code points
|
||||
*
|
||||
* @throws \WpOrg\Requests\Exception Invalid UTF-8 codepoint (`idna.invalidcodepoint`)
|
||||
@ -216,18 +216,18 @@ class IdnaEncoder {
|
||||
}
|
||||
|
||||
if (// Non-shortest form sequences are invalid
|
||||
$length > 1 && $character <= 0x7F
|
||||
|| $length > 2 && $character <= 0x7FF
|
||||
|| $length > 3 && $character <= 0xFFFF
|
||||
($length > 1 && $character <= 0x7F)
|
||||
|| ($length > 2 && $character <= 0x7FF)
|
||||
|| ($length > 3 && $character <= 0xFFFF)
|
||||
// Outside of range of ucschar codepoints
|
||||
// Noncharacters
|
||||
|| ($character & 0xFFFE) === 0xFFFE
|
||||
|| $character >= 0xFDD0 && $character <= 0xFDEF
|
||||
|| ($character >= 0xFDD0 && $character <= 0xFDEF)
|
||||
|| (
|
||||
// Everything else not in ucschar
|
||||
$character > 0xD7FF && $character < 0xF900
|
||||
($character > 0xD7FF && $character < 0xF900)
|
||||
|| $character < 0x20
|
||||
|| $character > 0x7E && $character < 0xA0
|
||||
|| ($character > 0x7E && $character < 0xA0)
|
||||
|| $character > 0xEFFFD
|
||||
)
|
||||
) {
|
||||
@ -329,10 +329,10 @@ class IdnaEncoder {
|
||||
}
|
||||
|
||||
// output the code point for digit t + ((q - t) mod (base - t))
|
||||
$digit = $t + (($q - $t) % (self::BOOTSTRAP_BASE - $t));
|
||||
$digit = (int) ($t + (($q - $t) % (self::BOOTSTRAP_BASE - $t)));
|
||||
$output .= self::digit_to_char($digit);
|
||||
// let q = (q - t) div (base - t)
|
||||
$q = floor(($q - $t) / (self::BOOTSTRAP_BASE - $t));
|
||||
$q = (int) floor(($q - $t) / (self::BOOTSTRAP_BASE - $t));
|
||||
} // end
|
||||
// output the code point for digit q
|
||||
$output .= self::digit_to_char($q);
|
||||
@ -381,7 +381,7 @@ class IdnaEncoder {
|
||||
* @param int $delta
|
||||
* @param int $numpoints
|
||||
* @param bool $firsttime
|
||||
* @return int New bias
|
||||
* @return int|float New bias
|
||||
*
|
||||
* function adapt(delta,numpoints,firsttime):
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user