65 if ( count( $alphabet ) < 1 || count( $alphabet ) >= 4096 ) {
66 throw new UnexpectedValueException(
"Alphabet must be < 4096 items" );
68 $this->firstLetters = $alphabet;
69 $digitTransformLang = $digitTransformLang instanceof
Language
71 : $languageFactory->
getLanguage( $digitTransformLang );
73 $this->alphabet = array_map( [ $digitTransformLang,
'uc' ], $alphabet );
75 $this->puaSubset = [];
76 $len = count( $alphabet );
77 for ( $i = 0; $i < $len; $i++ ) {
78 $this->puaSubset[] =
"\xF3\xB3" . chr( (
int)floor( $i / 64 ) + 128 ) . chr( ( $i % 64 ) + 128 );
83 $lengths = array_map(
'mb_strlen', $this->alphabet );
84 array_multisort( $lengths, SORT_DESC, $this->firstLetters, $this->alphabet, $this->puaSubset );
86 parent::__construct( $languageFactory, $digitTransformLang );