‪TYPO3CMS  9.5
Mso\IdnaConvert\Punycode Class Reference
Inheritance diagram for Mso\IdnaConvert\Punycode:
Mso\IdnaConvert\PunycodeInterface

Public Member Functions

 __construct (NamePrepDataInterface $NamePrepData, UnicodeTranscoderInterface $UnicodeTranscoder)
 
string getPunycodePrefix ()
 
bool validate ($encoded)
 
mixed decode ($encoded)
 
mixed encode ($decoded)
 

Public Attributes

const punycodePrefix = 'xn--'
 
const invalidUcs = 0x80000000
 
const maxUcs = 0x10FFFF
 
const base = 36
 
const tMin = 1
 
const tMax = 26
 
const skew = 38
 
const damp = 700
 
const initialBias = 72
 
const initialN = 0x80
 
const sBase = 0xAC00
 
const lBase = 0x1100
 
const vBase = 0x1161
 
const tBase = 0x11A7
 
const lCount = 19
 
const vCount = 21
 
const tCount = 28
 
const nCount = 588
 
const sCount = 11172
 
const sLast = self::sBase + self::lCount * self::vCount * self::tCount
 

Protected Member Functions

int adapt ($delta, $npoints, $is_first)
 
string encodeDigit ($d)
 
int decodeDigit ($cp)
 
string namePrep ($input)
 
array hangulDecompose ($char)
 
array hangulCompose ($input)
 
int getCombiningClass ($char)
 
array applyCanonicalOrdering ($input)
 
array combine ($input)
 

Static Protected Member Functions

static int byteLength ($string)
 

Protected Attributes

 $NamePrepData
 
 $UnicodeTranscoder
 

Static Protected Attributes

static $isMbStringOverload = null
 

Detailed Description

Definition at line 33 of file Punycode.php.

Constructor & Destructor Documentation

◆ __construct()

Mso\IdnaConvert\Punycode::__construct ( NamePrepDataInterface  $NamePrepData,
UnicodeTranscoderInterface  $UnicodeTranscoder 
)

the constructor

Parameters
$NamePrepDataNamePrepDataInterface inject NamePrepData object
$UnicodeTranscoderUnicodeTranscoderInterface inject Unicode Transcoder
Since
0.5.2

Implements Mso\IdnaConvert\PunycodeInterface.

Definition at line 69 of file Punycode.php.

References Mso\IdnaConvert\Punycode\$NamePrepData, and Mso\IdnaConvert\Punycode\$UnicodeTranscoder.

Member Function Documentation

◆ adapt()

int Mso\IdnaConvert\Punycode::adapt (   $delta,
  $npoints,
  $is_first 
)
protected

Adapt the bias according to the current code point and position

Parameters
int$delta
int$npoints
int$is_first
Returns
‪int

Definition at line 271 of file Punycode.php.

References Mso\IdnaConvert\Punycode\base, and Mso\IdnaConvert\Punycode\tMin.

Referenced by Mso\IdnaConvert\Punycode\decode(), and Mso\IdnaConvert\Punycode\encode().

◆ applyCanonicalOrdering()

array Mso\IdnaConvert\Punycode::applyCanonicalOrdering (   $input)
protected

Applies the canonical ordering of a decomposed UCS4 sequence

Parameters
array$input‪Decomposed UCS4 sequence
Returns
‪array Ordered USC4 sequence

Definition at line 476 of file Punycode.php.

References Mso\IdnaConvert\Punycode\getCombiningClass().

Referenced by Mso\IdnaConvert\Punycode\namePrep().

◆ byteLength()

static int Mso\IdnaConvert\Punycode::byteLength (   $string)
staticprotected

Gets the length of a string in bytes even if mbstring function overloading is turned on

Parameters
string$string‪the string for which to get the length.
Returns
‪int the length of the string in bytes.

Definition at line 546 of file Punycode.php.

Referenced by Mso\IdnaConvert\Punycode\decode(), and Mso\IdnaConvert\Punycode\encode().

◆ combine()

array Mso\IdnaConvert\Punycode::combine (   $input)
protected

Do composition of a sequence of starter and non-starter

Parameters
array$input‪UCS4 Decomposed sequence
Returns
‪array Ordered USC4 sequence

Definition at line 510 of file Punycode.php.

Referenced by Mso\IdnaConvert\Punycode\namePrep().

◆ decode()

◆ decodeDigit()

int Mso\IdnaConvert\Punycode::decodeDigit (   $cp)
protected

Decode a certain digit

Parameters
int$cp
Returns
‪int

Definition at line 296 of file Punycode.php.

References Mso\IdnaConvert\Punycode\base.

Referenced by Mso\IdnaConvert\Punycode\decode().

◆ encode()

◆ encodeDigit()

string Mso\IdnaConvert\Punycode::encodeDigit (   $d)
protected

Encoding a certain digit

Parameters
int$d
Returns
‪string

Definition at line 286 of file Punycode.php.

Referenced by Mso\IdnaConvert\Punycode\encode().

◆ getCombiningClass()

int Mso\IdnaConvert\Punycode::getCombiningClass (   $char)
protected

Returns the combining class of a certain wide char

Parameters
int$char‪Wide char to check (32bit integer)
Returns
‪int Combining class if found, else 0

Definition at line 464 of file Punycode.php.

Referenced by Mso\IdnaConvert\Punycode\applyCanonicalOrdering(), and Mso\IdnaConvert\Punycode\namePrep().

◆ getPunycodePrefix()

string Mso\IdnaConvert\Punycode::getPunycodePrefix ( )

Returns the used prefix for punycode-encoded strings

Returns
‪string

Implements Mso\IdnaConvert\PunycodeInterface.

Definition at line 84 of file Punycode.php.

References Mso\IdnaConvert\Punycode\punycodePrefix.

◆ hangulCompose()

array Mso\IdnaConvert\Punycode::hangulCompose (   $input)
protected

Ccomposes a Hangul syllable (see http://www.unicode.org/unicode/reports/tr15/#Hangul

Parameters
array$input‪Decomposed UCS4 sequence
Returns
‪array UCS4 sequence with syllables composed

Definition at line 422 of file Punycode.php.

References Mso\IdnaConvert\Punycode\lBase, Mso\IdnaConvert\Punycode\sBase, Mso\IdnaConvert\Punycode\tBase, Mso\IdnaConvert\Punycode\tCount, and Mso\IdnaConvert\Punycode\vBase.

Referenced by Mso\IdnaConvert\Punycode\namePrep().

◆ hangulDecompose()

array Mso\IdnaConvert\Punycode::hangulDecompose (   $char)
protected

Decomposes a Hangul syllable (see http://www.unicode.org/unicode/reports/tr15/#Hangul

Parameters
int‪32bit UCS4 code point
Returns
‪array Either Hangul Syllable decomposed or original 32bit value as one value array

Definition at line 400 of file Punycode.php.

References Mso\IdnaConvert\Punycode\tCount.

Referenced by Mso\IdnaConvert\Punycode\namePrep().

◆ namePrep()

string Mso\IdnaConvert\Punycode::namePrep (   $input)
protected

Do Nameprep according to RFC3491 and RFC3454

Parameters
array$input‪Unicode Characters
Returns
‪string Unicode Characters, Nameprep'd

Definition at line 318 of file Punycode.php.

References $output, Mso\IdnaConvert\Punycode\applyCanonicalOrdering(), Mso\IdnaConvert\Punycode\combine(), Mso\IdnaConvert\Punycode\getCombiningClass(), Mso\IdnaConvert\Punycode\hangulCompose(), and Mso\IdnaConvert\Punycode\hangulDecompose().

Referenced by Mso\IdnaConvert\Punycode\encode().

◆ validate()

bool Mso\IdnaConvert\Punycode::validate (   $encoded)

Checks, whether or not the provided string is a valid punycode string

Parameters
string$encoded
Returns
‪bool

Definition at line 94 of file Punycode.php.

Referenced by Mso\IdnaConvert\Punycode\decode().

Member Data Documentation

◆ $isMbStringOverload

Mso\IdnaConvert\Punycode::$isMbStringOverload = null
staticprotected

Definition at line 57 of file Punycode.php.

◆ $NamePrepData

Mso\IdnaConvert\Punycode::$NamePrepData
protected

Definition at line 59 of file Punycode.php.

Referenced by Mso\IdnaConvert\Punycode\__construct().

◆ $UnicodeTranscoder

Mso\IdnaConvert\Punycode::$UnicodeTranscoder
protected

Definition at line 60 of file Punycode.php.

Referenced by Mso\IdnaConvert\Punycode\__construct().

◆ base

◆ damp

const Mso\IdnaConvert\Punycode::damp = 700

Definition at line 43 of file Punycode.php.

◆ initialBias

const Mso\IdnaConvert\Punycode::initialBias = 72

◆ initialN

const Mso\IdnaConvert\Punycode::initialN = 0x80

◆ invalidUcs

const Mso\IdnaConvert\Punycode::invalidUcs = 0x80000000

Definition at line 37 of file Punycode.php.

◆ lBase

const Mso\IdnaConvert\Punycode::lBase = 0x1100

Definition at line 47 of file Punycode.php.

Referenced by Mso\IdnaConvert\Punycode\hangulCompose().

◆ lCount

const Mso\IdnaConvert\Punycode::lCount = 19

Definition at line 50 of file Punycode.php.

◆ maxUcs

const Mso\IdnaConvert\Punycode::maxUcs = 0x10FFFF

Definition at line 38 of file Punycode.php.

◆ nCount

const Mso\IdnaConvert\Punycode::nCount = 588

Definition at line 53 of file Punycode.php.

◆ punycodePrefix

const Mso\IdnaConvert\Punycode::punycodePrefix = 'xn--'

Definition at line 36 of file Punycode.php.

Referenced by Mso\IdnaConvert\Punycode\getPunycodePrefix().

◆ sBase

const Mso\IdnaConvert\Punycode::sBase = 0xAC00

Definition at line 46 of file Punycode.php.

Referenced by Mso\IdnaConvert\Punycode\hangulCompose().

◆ sCount

const Mso\IdnaConvert\Punycode::sCount = 11172

Definition at line 54 of file Punycode.php.

◆ skew

const Mso\IdnaConvert\Punycode::skew = 38

Definition at line 42 of file Punycode.php.

◆ sLast

const Mso\IdnaConvert\Punycode::sLast = self::sBase + self::lCount * self::vCount * self::tCount

Definition at line 55 of file Punycode.php.

◆ tBase

const Mso\IdnaConvert\Punycode::tBase = 0x11A7

Definition at line 49 of file Punycode.php.

Referenced by Mso\IdnaConvert\Punycode\hangulCompose().

◆ tCount

const Mso\IdnaConvert\Punycode::tCount = 28

◆ tMax

const Mso\IdnaConvert\Punycode::tMax = 26

◆ tMin

const Mso\IdnaConvert\Punycode::tMin = 1

Definition at line 40 of file Punycode.php.

Referenced by Mso\IdnaConvert\Punycode\adapt().

◆ vBase

const Mso\IdnaConvert\Punycode::vBase = 0x1161

Definition at line 48 of file Punycode.php.

Referenced by Mso\IdnaConvert\Punycode\hangulCompose().

◆ vCount

const Mso\IdnaConvert\Punycode::vCount = 21

Definition at line 51 of file Punycode.php.