Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| WikibaseRepoEntityTypesHookHandler | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
3 | |
100.00% |
1 / 1 |
| onWikibaseRepoEntityTypes | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
3 | |||
| 1 | <?php |
| 2 | |
| 3 | declare( strict_types = 1 ); |
| 4 | |
| 5 | namespace Wikibase\Search\Elastic\Hooks; |
| 6 | |
| 7 | use Wikibase\Repo\Hooks\WikibaseRepoEntityTypesHook; |
| 8 | |
| 9 | /** |
| 10 | * Hooks for Wikibase search. |
| 11 | */ |
| 12 | class WikibaseRepoEntityTypesHookHandler extends CirrusSearchConfiguration |
| 13 | implements WikibaseRepoEntityTypesHook { |
| 14 | |
| 15 | /** @inheritDoc */ |
| 16 | public function onWikibaseRepoEntityTypes( array &$entityTypeDefinitions ): void { |
| 17 | if ( !CirrusSearchConfiguration::isWBCSEnabled() ) { |
| 18 | return; |
| 19 | } |
| 20 | $searchDefinitions = require __DIR__ . '/../../WikibaseSearch.entitytypes.php'; |
| 21 | foreach ( $searchDefinitions as $type => $definition ) { |
| 22 | $entityTypeDefinitions[$type] = $definition + ( $entityTypeDefinitions[$type] ?? [] ); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | } |