MediaWiki  master
Collation.php
Go to the documentation of this file.
1 <?php
25 
31 abstract class Collation {
32  private static $instance;
33 
39  public static function singleton() {
40  wfDeprecated( __METHOD__, '1.37' );
41  if ( !self::$instance ) {
42  $categoryCollation = MediaWikiServices::getInstance()->getMainConfig()
43  ->get( MainConfigNames::CategoryCollation );
44  self::$instance = self::factory( $categoryCollation );
45  }
46  return self::$instance;
47  }
48 
56  public static function factory( $collationName ) {
57  wfDeprecated( __METHOD__, '1.37' );
58  return MediaWikiServices::getInstance()->getCollationFactory()->makeCollation( $collationName );
59  }
60 
74  abstract public function getSortKey( $string );
75 
82  public function getSortKeys( $strings ) {
83  $ret = [];
84  foreach ( $strings as $key => $s ) {
85  $ret[$key] = $this->getSortKey( $s );
86  }
87  return $ret;
88  }
89 
115  abstract public function getFirstLetter( $string );
116 
117 }
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
static singleton()
Definition: Collation.php:39
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...
getSortKeys( $strings)
Get multiple sort keys.
Definition: Collation.php:82
static $instance
Definition: Collation.php:32
static factory( $collationName)
Definition: Collation.php:56
A class containing constants representing the names of configuration variables.
MediaWikiServices is the service locator for the application scope of MediaWiki.
foreach( $mmfl['setupFiles'] as $fileName) if( $queue) if(empty( $mmfl['quiet'])) $s