MediaWiki master
UppercaseCollation.php
Go to the documentation of this file.
1<?php
9namespace MediaWiki\Collation;
10
12use MediaWiki\Languages\LanguageFactory;
13
15
19 private $lang;
20
21 public function __construct( LanguageFactory $languageFactory ) {
22 $this->lang = $languageFactory->getLanguage( 'en' );
23 }
24
26 public function getSortKey( $string ) {
27 return $this->lang->uc( $string );
28 }
29
31 public function getFirstLetter( $string ) {
32 if ( $string[0] == "\0" ) {
33 $string = substr( $string, 1 );
34 }
35 return $this->lang->ucfirst( $this->lang->firstChar( $string ) );
36 }
37
38}
39
41class_alias( UppercaseCollation::class, 'UppercaseCollation' );
getSortKey( $string)
Given a string, convert it to a (hopefully short) key that can be used for efficient sorting....
getFirstLetter( $string)
Given a string, return the logical "first letter" to be used for grouping on category pages and so on...
__construct(LanguageFactory $languageFactory)
Base class for language-specific code.
Definition Language.php:69