PHP Class Punycode

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Punycode implementation as described in RFC 3492
See also: https://github.com/true/php-punycode
Afficher le fichier Open project: zblogcn/zblogphp Class Usage Examples

Protected Properties

Свойство Type Description
$decodeTable Decode table
$encodeTable Encode table
$encoding Character encoding

Méthodes publiques

Méthode Description
__construct ( string $encoding = 'UTF-8' ) Constructor
decode ( string $input ) : string Decode a Punycode domain name to its Unicode counterpart
encode ( string $input ) : string Encode a domain to its Punycode version

Méthodes protégées

Méthode Description
adapt ( integer $delta, integer $numPoints, boolean $firstTime ) : integer Bias adaptation
calculateThreshold ( integer $k, integer $bias ) : integer Calculate the bias threshold to fall between TMIN and TMAX
charToCodePoint ( string $char ) : integer Convert a single or multi-byte character to its code point
codePointToChar ( integer $code ) : string Convert a code point to its single or multi-byte character
decodePart ( string $input ) : string Decode a part of domain name, such as tld
encodePart ( string $input ) : string Encode a part of a domain name, such as tld, to its Punycode version
listCodePoints ( string $input ) : array List code points for a given input

Method Details

__construct() public méthode

Constructor
public __construct ( string $encoding = 'UTF-8' )
$encoding string Character encoding

adapt() protected méthode

Bias adaptation
protected adapt ( integer $delta, integer $numPoints, boolean $firstTime ) : integer
$delta integer
$numPoints integer
$firstTime boolean
Résultat integer

calculateThreshold() protected méthode

Calculate the bias threshold to fall between TMIN and TMAX
protected calculateThreshold ( integer $k, integer $bias ) : integer
$k integer
$bias integer
Résultat integer

charToCodePoint() protected méthode

Convert a single or multi-byte character to its code point
protected charToCodePoint ( string $char ) : integer
$char string
Résultat integer

codePointToChar() protected méthode

Convert a code point to its single or multi-byte character
protected codePointToChar ( integer $code ) : string
$code integer
Résultat string

decode() public méthode

Decode a Punycode domain name to its Unicode counterpart
public decode ( string $input ) : string
$input string Domain name in Punycode
Résultat string Unicode domain name

decodePart() protected méthode

Decode a part of domain name, such as tld
protected decodePart ( string $input ) : string
$input string Part of a domain name
Résultat string Unicode domain part

encode() public méthode

Encode a domain to its Punycode version
public encode ( string $input ) : string
$input string Domain name in Unicode to be encoded
Résultat string Punycode representation in ASCII

encodePart() protected méthode

Encode a part of a domain name, such as tld, to its Punycode version
protected encodePart ( string $input ) : string
$input string Part of a domain name
Résultat string Punycode representation of a domain part

listCodePoints() protected méthode

List code points for a given input
protected listCodePoints ( string $input ) : array
$input string
Résultat array Multi-dimension array with basic, non-basic and aggregated code points

Property Details

$decodeTable protected_oe static_oe property

Decode table
protected static $decodeTable

$encodeTable protected_oe static_oe property

Encode table
protected static $encodeTable

$encoding protected_oe property

Character encoding
protected $encoding