Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
DescriptionsProviderFieldDefinitions | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getFields | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace Wikibase\Search\Elastic\Fields; |
4 | |
5 | use Wikibase\Repo\Search\Fields\FieldDefinitions; |
6 | use Wikibase\Repo\Search\Fields\WikibaseIndexField; |
7 | |
8 | /** |
9 | * Definitions for any entity that has descriptions. |
10 | * |
11 | * @license GPL-2.0-or-later |
12 | * @author Stas Malyshev |
13 | */ |
14 | class DescriptionsProviderFieldDefinitions implements FieldDefinitions { |
15 | |
16 | /** |
17 | * @var string[] |
18 | */ |
19 | private $languageCodes; |
20 | /** |
21 | * @var array |
22 | */ |
23 | private $stemmingSettings; |
24 | |
25 | /** |
26 | * @param string[] $languageCodes |
27 | * @param array $stemmingSettings |
28 | */ |
29 | public function __construct( array $languageCodes, array $stemmingSettings ) { |
30 | $this->languageCodes = $languageCodes; |
31 | $this->stemmingSettings = $stemmingSettings; |
32 | } |
33 | |
34 | /** |
35 | * @return WikibaseIndexField[] |
36 | */ |
37 | public function getFields() { |
38 | return [ |
39 | DescriptionsField::NAME => new DescriptionsField( $this->languageCodes, $this->stemmingSettings ), |
40 | ]; |
41 | } |
42 | |
43 | } |