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