Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
Insertable | |
0.00% |
0 / 6 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
getPreText | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getPostText | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getDisplayText | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | declare( strict_types = 1 ); |
3 | |
4 | namespace MediaWiki\Extension\Translate\TranslatorInterface\Insertable; |
5 | |
6 | /** |
7 | * Insertable is a string that usually does not need translation and is |
8 | * difficult to type manually. |
9 | * @author Niklas Laxström |
10 | * @license GPL-2.0-or-later |
11 | * @since 2020.12 |
12 | */ |
13 | class Insertable { |
14 | /** @var string What to show to the user */ |
15 | protected $display; |
16 | /** |
17 | * @var string What to insert before selection, or what to replace |
18 | * the selection with, if $post remains empty. |
19 | */ |
20 | protected $pre; |
21 | /** @var string What to insert after selection */ |
22 | protected $post; |
23 | |
24 | /** |
25 | * @param string $display What to show to the user |
26 | * @param string $pre What to insert before selection, or replace |
27 | * selection if $post remains empty |
28 | * @param string $post What to insert after selection. If it is not |
29 | * given, $pre will replace selection. |
30 | */ |
31 | public function __construct( string $display, string $pre = '', string $post = '' ) { |
32 | $this->display = $display; |
33 | $this->pre = $pre; |
34 | $this->post = $post; |
35 | } |
36 | |
37 | public function getPreText(): string { |
38 | return $this->pre; |
39 | } |
40 | |
41 | public function getPostText(): string { |
42 | return $this->post; |
43 | } |
44 | |
45 | public function getDisplayText(): string { |
46 | return $this->display; |
47 | } |
48 | } |