Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 16 |
|
0.00% |
0 / 7 |
CRAP | |
0.00% |
0 / 1 |
Suggestion | |
0.00% |
0 / 16 |
|
0.00% |
0 / 7 |
56 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
newFromRow | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
getListId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getTitle | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getSourceLanguage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getTargetLanguage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
__toString | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace ContentTranslation; |
4 | |
5 | use MediaWiki\Title\Title; |
6 | |
7 | class Suggestion { |
8 | protected $listId; |
9 | protected $title; |
10 | protected $sourceLanguage; |
11 | protected $targetLanguage; |
12 | |
13 | public function __construct( array $params ) { |
14 | $this->listId = (int)$params['listId']; |
15 | $this->title = (string)$params['title']; |
16 | $this->sourceLanguage = (string)$params['sourceLanguage']; |
17 | $this->targetLanguage = (string)$params['targetLanguage']; |
18 | } |
19 | |
20 | /** |
21 | * @param \stdClass $row |
22 | * @return Suggestion |
23 | */ |
24 | public static function newFromRow( $row ) { |
25 | $params = [ |
26 | 'listId' => $row->cxs_list_id, |
27 | 'title' => $row->cxs_title, |
28 | 'sourceLanguage' => $row->cxs_source_language, |
29 | 'targetLanguage' => $row->cxs_target_language, |
30 | ]; |
31 | |
32 | return new Suggestion( $params ); |
33 | } |
34 | |
35 | public function getListId() { |
36 | return $this->listId; |
37 | } |
38 | |
39 | public function getTitle() { |
40 | return Title::newFromText( $this->title ); |
41 | } |
42 | |
43 | public function getSourceLanguage() { |
44 | return $this->sourceLanguage; |
45 | } |
46 | |
47 | public function getTargetLanguage() { |
48 | return $this->targetLanguage; |
49 | } |
50 | |
51 | /** |
52 | * @return string |
53 | */ |
54 | public function __toString() { |
55 | return $this->title; |
56 | } |
57 | } |