Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace CirrusSearch; |
| 4 | |
| 5 | /** |
| 6 | * Retrieve Interwiki information. |
| 7 | * Designed to support CirrusSearch usecase: |
| 8 | * - getSisterProjectPrefixes(): same lang different project |
| 9 | * - getSameProjectWikiByLang(): same project different lang |
| 10 | * - getInterwikiPrefix(): retrieve the interwiki prefix from a wikiId |
| 11 | */ |
| 12 | interface InterwikiResolver { |
| 13 | /** @const string service name */ |
| 14 | public const SERVICE = 'CirrusSearchInterwikiresolver'; |
| 15 | |
| 16 | /** |
| 17 | * @return string[] of wikiIds indexed by interwiki prefix |
| 18 | */ |
| 19 | public function getSisterProjectPrefixes(); |
| 20 | |
| 21 | /** |
| 22 | * @return SearchConfig[] configs of sister projects indexed by interwiki prefix |
| 23 | */ |
| 24 | public function getSisterProjectConfigs(); |
| 25 | |
| 26 | /** |
| 27 | * @param string $wikiId |
| 28 | * @return string|null the interwiki identified for this $wikiId or null if none found |
| 29 | */ |
| 30 | public function getInterwikiPrefix( $wikiId ); |
| 31 | |
| 32 | /** |
| 33 | * Determine the proper interwiki_prefix <=> wikiId pair for a given language code. |
| 34 | * Most the time the language code is equals to interwiki prefix but in |
| 35 | * some rarer cases it's not true. Always use the interwiki prefix returned by this function |
| 36 | * to generate crosslanguage interwiki links. |
| 37 | * |
| 38 | * @param string $lang |
| 39 | * @return string[] a two elt array ['wikiId', 'iwPrefix'] or [] if none found |
| 40 | */ |
| 41 | public function getSameProjectWikiByLang( $lang ); |
| 42 | |
| 43 | /** |
| 44 | * Fetch the config of the wiki identified by this language code |
| 45 | * |
| 46 | * @param string $lang |
| 47 | * @return SearchConfig[] zero or one element array: [] or [ interwiki => SearchConfig ] |
| 48 | */ |
| 49 | public function getSameProjectConfigByLang( $lang ); |
| 50 | } |