Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| LanguageConverterSpecific | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
30 | |
0.00% |
0 / 1 |
| findVariantLink | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
30 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * @license GPL-2.0-or-later |
| 4 | * @file |
| 5 | */ |
| 6 | |
| 7 | namespace MediaWiki\Language; |
| 8 | |
| 9 | use MediaWiki\Title\Title; |
| 10 | |
| 11 | /** |
| 12 | * A class that extends LanguageConverter with specific behaviour. |
| 13 | * |
| 14 | * @ingroup Language |
| 15 | */ |
| 16 | abstract class LanguageConverterSpecific extends LanguageConverter { |
| 17 | /** |
| 18 | * A function wrapper: |
| 19 | * - if there is no selected variant, leave the link |
| 20 | * names as they were |
| 21 | * - do not try to find variants for usernames |
| 22 | * |
| 23 | * @param string &$link |
| 24 | * @param Title &$nt |
| 25 | * @param bool $ignoreOtherCond |
| 26 | */ |
| 27 | public function findVariantLink( &$link, &$nt, $ignoreOtherCond = false ) { |
| 28 | // check for user namespace |
| 29 | if ( is_object( $nt ) ) { |
| 30 | $ns = $nt->getNamespace(); |
| 31 | if ( $ns === NS_USER || $ns === NS_USER_TALK ) { |
| 32 | return; |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | $oldlink = $link; |
| 37 | parent::findVariantLink( $link, $nt, $ignoreOtherCond ); |
| 38 | if ( $this->getPreferredVariant() == $this->getMainCode() ) { |
| 39 | $link = $oldlink; |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | /** @deprecated class alias since 1.46 */ |
| 45 | class_alias( LanguageConverterSpecific::class, 'LanguageConverterSpecific' ); |