PHP Класс 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
См. также: https://github.com/true/php-punycode
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$decodeTable Decode table
$encodeTable Encode table
$encoding Character encoding

Открытые методы

Метод Описание
__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

Защищенные методы

Метод Описание
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

Описание методов

__construct() публичный Метод

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

adapt() защищенный Метод

Bias adaptation
protected adapt ( integer $delta, integer $numPoints, boolean $firstTime ) : integer
$delta integer
$numPoints integer
$firstTime boolean
Результат integer

calculateThreshold() защищенный Метод

Calculate the bias threshold to fall between TMIN and TMAX
protected calculateThreshold ( integer $k, integer $bias ) : integer
$k integer
$bias integer
Результат integer

charToCodePoint() защищенный Метод

Convert a single or multi-byte character to its code point
protected charToCodePoint ( string $char ) : integer
$char string
Результат integer

codePointToChar() защищенный Метод

Convert a code point to its single or multi-byte character
protected codePointToChar ( integer $code ) : string
$code integer
Результат string

decode() публичный Метод

Decode a Punycode domain name to its Unicode counterpart
public decode ( string $input ) : string
$input string Domain name in Punycode
Результат string Unicode domain name

decodePart() защищенный Метод

Decode a part of domain name, such as tld
protected decodePart ( string $input ) : string
$input string Part of a domain name
Результат string Unicode domain part

encode() публичный Метод

Encode a domain to its Punycode version
public encode ( string $input ) : string
$input string Domain name in Unicode to be encoded
Результат string Punycode representation in ASCII

encodePart() защищенный Метод

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
Результат string Punycode representation of a domain part

listCodePoints() защищенный Метод

List code points for a given input
protected listCodePoints ( string $input ) : array
$input string
Результат array Multi-dimension array with basic, non-basic and aggregated code points

Описание свойств

$decodeTable защищенное статическое свойство

Decode table
protected static $decodeTable

$encodeTable защищенное статическое свойство

Encode table
protected static $encodeTable

$encoding защищенное свойство

Character encoding
protected $encoding