MediaWiki  1.34.0
FakeConverter.php
Go to the documentation of this file.
1 <?php
38  public $mLang;
39 
40  function __construct( Language $langobj ) {
41  $this->mLang = $langobj;
42  }
43 
44  function autoConvert( $text, $variant = false ) {
45  return $text;
46  }
47 
48  function autoConvertToAllVariants( $text ) {
49  return [ $this->mLang->getCode() => $text ];
50  }
51 
52  function convert( $t ) {
53  return $t;
54  }
55 
56  function convertTo( $text, $variant ) {
57  return $text;
58  }
59 
64  function convertTitle( $t ) {
65  return $t->getPrefixedText();
66  }
67 
68  function convertNamespace( $ns ) {
69  return $this->mLang->getFormattedNsText( $ns );
70  }
71 
75  function getVariants() {
76  return [ $this->mLang->getCode() ];
77  }
78 
79  function getVariantFallbacks( $variant ) {
80  return $this->mLang->getCode();
81  }
82 
83  function getPreferredVariant() {
84  return $this->mLang->getCode();
85  }
86 
87  function getDefaultVariant() {
88  return $this->mLang->getCode();
89  }
90 
91  function getURLVariant() {
92  return '';
93  }
94 
95  function getConvRuleTitle() {
96  return false;
97  }
98 
99  function findVariantLink( &$l, &$n, $ignoreOtherCond = false ) {
100  }
101 
102  function getExtraHashOptions() {
103  return '';
104  }
105 
106  function getParsedTitle() {
107  return '';
108  }
109 
110  function markNoConversion( $text, $noParse = false ) {
111  return $text;
112  }
113 
114  function convertCategoryKey( $key ) {
115  return $key;
116  }
117 
118  function validateVariant( $variant = null ) {
119  if ( $variant === null ) {
120  return null;
121  }
122  $variant = strtolower( $variant );
123  return $variant === $this->mLang->getCode() ? $variant : null;
124  }
125 
126  function translate( $text, $variant ) {
127  return $text;
128  }
129 
130  public function updateConversionTable( Title $title ) {
131  }
132 
138  private function reloadTables() {
139  }
140 }
FakeConverter\convertCategoryKey
convertCategoryKey( $key)
Definition: FakeConverter.php:114
FakeConverter\translate
translate( $text, $variant)
Definition: FakeConverter.php:126
FakeConverter\autoConvertToAllVariants
autoConvertToAllVariants( $text)
Definition: FakeConverter.php:48
FakeConverter\markNoConversion
markNoConversion( $text, $noParse=false)
Definition: FakeConverter.php:110
FakeConverter\convert
convert( $t)
Definition: FakeConverter.php:52
FakeConverter\getConvRuleTitle
getConvRuleTitle()
Definition: FakeConverter.php:95
FakeConverter\validateVariant
validateVariant( $variant=null)
Definition: FakeConverter.php:118
FakeConverter\getExtraHashOptions
getExtraHashOptions()
Definition: FakeConverter.php:102
FakeConverter\convertTo
convertTo( $text, $variant)
Definition: FakeConverter.php:56
$t
$t
Definition: make-normalization-table.php:143
FakeConverter\getVariantFallbacks
getVariantFallbacks( $variant)
Definition: FakeConverter.php:79
$title
$title
Definition: testCompression.php:34
FakeConverter\getVariants
getVariants()
Definition: FakeConverter.php:75
FakeConverter\__construct
__construct(Language $langobj)
Definition: FakeConverter.php:40
FakeConverter\$mLang
Language $mLang
Definition: FakeConverter.php:38
FakeConverter\reloadTables
reloadTables()
Used by test suites which need to reset the converter state.
Definition: FakeConverter.php:138
FakeConverter\getURLVariant
getURLVariant()
Definition: FakeConverter.php:91
FakeConverter\autoConvert
autoConvert( $text, $variant=false)
Definition: FakeConverter.php:44
FakeConverter
A fake language variant converter.
Definition: FakeConverter.php:34
Title
Represents a title within MediaWiki.
Definition: Title.php:42
FakeConverter\findVariantLink
findVariantLink(&$l, &$n, $ignoreOtherCond=false)
Definition: FakeConverter.php:99
FakeConverter\updateConversionTable
updateConversionTable(Title $title)
Definition: FakeConverter.php:130
FakeConverter\getParsedTitle
getParsedTitle()
Definition: FakeConverter.php:106
FakeConverter\getPreferredVariant
getPreferredVariant()
Definition: FakeConverter.php:83
FakeConverter\convertNamespace
convertNamespace( $ns)
Definition: FakeConverter.php:68
FakeConverter\getDefaultVariant
getDefaultVariant()
Definition: FakeConverter.php:87
Language
Internationalisation code.
Definition: Language.php:37
FakeConverter\convertTitle
convertTitle( $t)
Definition: FakeConverter.php:64