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 | declare( strict_types = 1 ); |
3 | |
4 | namespace MediaWiki\Extension\Translate\TtmServer; |
5 | |
6 | /** |
7 | * Interface for TtmServer that can be queried (=all of them). |
8 | * @ingroup TTMServer |
9 | */ |
10 | interface ReadableTtmServer { |
11 | /** |
12 | * Fetches all relevant suggestions for given text. |
13 | * |
14 | * @param string $sourceLanguage language code for the provide text |
15 | * @param string $targetLanguage language code for the suggestions |
16 | * @param string $text the text for which to search suggestions |
17 | * @return array List: unordered suggestions, which each has fields: |
18 | * - source: String: the original text of the suggestion |
19 | * - target: String: the suggestion |
20 | * - context: String: title of the page where the suggestion comes from |
21 | * - quality: Float: the quality of suggestion, 1 is perfect match |
22 | */ |
23 | public function query( string $sourceLanguage, string $targetLanguage, string $text ): array; |
24 | |
25 | /** |
26 | * Determines if the suggestion returned by this TtmServer comes |
27 | * from this wiki or any other wiki. |
28 | */ |
29 | public function isLocalSuggestion( array $suggestion ): bool; |
30 | |
31 | /** |
32 | * Given suggestion returned by this TtmServer, constructs fully |
33 | * qualified URL to the location of the translation. |
34 | * @return string URL |
35 | */ |
36 | public function expandLocation( array $suggestion ): string; |
37 | } |