Horde_Idna_Punycode
in package
Punycode implementation as described in RFC 3492.
Original code (v1.0.1; released under the MIT License): https://github.com/true/php-punycode/
Tags
Table of Contents
- BASE = 36
- Bootstring parameter values.
- DAMP = 700
- DELIMITER = '-'
- INITIAL_BIAS = 72
- INITIAL_N = 128
- PREFIX = 'xn--'
- SKEW = 38
- TMAX = 26
- TMIN = 1
- $_decodeTable : mixed
- Decode table.
- $_encodeTable : mixed
- Encode table.
- decode() : string
- Decode a Punycode domain name to its Unicode counterpart.
- encode() : string
- Encode a domain to its Punycode version.
- _adapt() : int
- Bias adaptation.
- _calculateThreshold() : int
- Calculate the bias threshold to fall between TMIN and TMAX.
- _charToCodePoint() : int
- Convert a single or multi-byte character to its code point.
- _codePoints() : array<string|int, mixed>
- List code points for a given input.
- _codePointToChar() : string
- Convert a code point to its single or multi-byte character
- _decodePart() : string
- Decode a part of domain name, such as tld.
- _encodePart() : string
- Encode a part of a domain name, such as tld, to its Punycode version.
Constants
BASE
Bootstring parameter values.
public
mixed
BASE
= 36
DAMP
public
mixed
DAMP
= 700
DELIMITER
public
mixed
DELIMITER
= '-'
INITIAL_BIAS
public
mixed
INITIAL_BIAS
= 72
INITIAL_N
public
mixed
INITIAL_N
= 128
PREFIX
public
mixed
PREFIX
= 'xn--'
SKEW
public
mixed
SKEW
= 38
TMAX
public
mixed
TMAX
= 26
TMIN
public
mixed
TMIN
= 1
Properties
$_decodeTable
Decode table.
protected
static mixed
$_decodeTable
= array('a' => 0, 'b' => 1, 'c' => 2, 'd' => 3, 'e' => 4, 'f' => 5, 'g' => 6, 'h' => 7, 'i' => 8, 'j' => 9, 'k' => 10, 'l' => 11, 'm' => 12, 'n' => 13, 'o' => 14, 'p' => 15, 'q' => 16, 'r' => 17, 's' => 18, 't' => 19, 'u' => 20, 'v' => 21, 'w' => 22, 'x' => 23, 'y' => 24, 'z' => 25, '0' => 26, '1' => 27, '2' => 28, '3' => 29, '4' => 30, '5' => 31, '6' => 32, '7' => 33, '8' => 34, '9' => 35)
$_encodeTable
Encode table.
protected
static mixed
$_encodeTable
= array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
Methods
decode()
Decode a Punycode domain name to its Unicode counterpart.
public
decode(string $input) : string
Parameters
- $input : string
-
Domain name in Punycode
Return values
string —Unicode domain name.
encode()
Encode a domain to its Punycode version.
public
encode(string $input) : string
Parameters
- $input : string
-
Domain name in Unicde to be encoded.
Return values
string —Punycode representation in ASCII.
_adapt()
Bias adaptation.
protected
_adapt(int $delta, int $numPoints, bool $firstTime) : int
Parameters
- $delta : int
- $numPoints : int
- $firstTime : bool
Return values
int —_calculateThreshold()
Calculate the bias threshold to fall between TMIN and TMAX.
protected
_calculateThreshold(int $k, int $bias) : int
Parameters
- $k : int
- $bias : int
Return values
int —_charToCodePoint()
Convert a single or multi-byte character to its code point.
protected
_charToCodePoint(string $char) : int
Parameters
- $char : string
Return values
int —_codePoints()
List code points for a given input.
protected
_codePoints(string $input) : array<string|int, mixed>
Parameters
- $input : string
Return values
array<string|int, mixed> —Multi-dimension array with basic, non-basic and aggregated code points.
_codePointToChar()
Convert a code point to its single or multi-byte character
protected
_codePointToChar(int $code) : string
Parameters
- $code : int
Return values
string —_decodePart()
Decode a part of domain name, such as tld.
protected
_decodePart(string $input) : string
Parameters
- $input : string
-
Part of a domain name.
Return values
string —Unicode domain part.
_encodePart()
Encode a part of a domain name, such as tld, to its Punycode version.
protected
_encodePart(string $input) : string
Parameters
- $input : string
-
Part of a domain name.
Return values
string —Punycode representation of a domain part.