* @file
*/
+/**
+ * @since 1.16.3
+ * @author Tim Starling
+ */
abstract class Collation {
private static $instance;
/**
+ * @since 1.16.3
* @return Collation
*/
- static function singleton() {
+ public static function singleton() {
if ( !self::$instance ) {
global $wgCategoryCollation;
self::$instance = self::factory( $wgCategoryCollation );
}
/**
+ * @since 1.16.3
* @throws MWException
* @param string $collationName
* @return Collation
*/
- static function factory( $collationName ) {
+ public static function factory( $collationName ) {
switch ( $collationName ) {
case 'uppercase':
return new UppercaseCollation;
* has no other particular expectations (and that one can be changed if
* necessary).
*
+ * @since 1.16.3
+ *
* @param string $string UTF-8 string
* @return string Binary sortkey
*/
*
* etc., assuming for the sake of argument that $wgCapitalLinks is false.
*
+ * @since 1.16.3
+ *
* @param string $string UTF-8 string
* @return string UTF-8 string corresponding to the first letter of input
*/
* Workaround for the lack of support of Sorani Kurdish / Central Kurdish language ('ckb') in ICU.
*
* Uses the same collation rules as Persian / Farsi ('fa'), but different characters for digits.
+ *
+ * @since 1.23
*/
class CollationCkb extends IcuCollation {
- function __construct() {
+ public function __construct() {
// This will set $locale and collators, which affect the actual sorting order
parent::__construct( 'fa' );
// Override the 'fa' language set by parent constructor, which affects #getFirstLetterData()
* Estonian. We work around this by replacing 'W' and 'w' with 'ᴡ' U+1D21 'LATIN LETTER SMALL
* CAPITAL W' for sortkey generation, which is collated like 'W' and is not tailored to have the
* same primary weight as 'V' in Estonian.
+ *
+ * @since 1.24
*/
class CollationEt extends IcuCollation {
- function __construct() {
+ public function __construct() {
parent::__construct( 'et' );
}
);
}
- function getSortKey( $string ) {
+ public function getSortKey( $string ) {
return parent::getSortKey( self::mangle( $string ) );
}
- function getFirstLetter( $string ) {
+ public function getFirstLetter( $string ) {
return self::unmangle( parent::getFirstLetter( self::mangle( $string ) ) );
}
}
* @file
*/
+/**
+ * @since 1.16.3
+ */
class IcuCollation extends Collation {
const FIRST_LETTER_VERSION = 2;
'uz' => [ "Ch", "G'", "Ng", "O'", "Sh" ],
];
+ /**
+ * @since 1.16.3
+ */
const RECORD_LENGTH = 14;
public function __construct( $locale ) {
return $this->getLetterByIndex( $min );
}
+ /**
+ * @since 1.16.3
+ */
public function getFirstLetterData() {
if ( $this->firstLetterData !== null ) {
return $this->firstLetterData;
return $data;
}
+ /**
+ * @since 1.16.3
+ */
public function getLetterByIndex( $index ) {
if ( $this->firstLetterData === null ) {
$this->getFirstLetterData();
return $this->firstLetterData['chars'][$index];
}
+ /**
+ * @since 1.16.3
+ */
public function getSortKeyByLetterIndex( $index ) {
if ( $this->firstLetterData === null ) {
$this->getFirstLetterData();
return $this->firstLetterData['keys'][$index];
}
+ /**
+ * @since 1.16.3
+ */
public function getFirstLetterCount() {
if ( $this->firstLetterData === null ) {
$this->getFirstLetterData();
return count( $this->firstLetterData['chars'] );
}
- static function isCjk( $codepoint ) {
+ /**
+ * @since 1.16.3
+ */
+ public static function isCjk( $codepoint ) {
foreach ( self::$cjkBlocks as $block ) {
if ( $codepoint >= $block[0] && $codepoint <= $block[1] ) {
return true;
*
* Does sorting based on binary value of the string.
* Like how things were pre 1.17.
+ *
+ * @since 1.18
*/
class IdentityCollation extends Collation {
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
+ * @since 1.16.3
+ *
* @file
*/