Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 9
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * Services for CirrusSearch extensions
4 */
5
6use CirrusSearch\CirrusSearch;
7use CirrusSearch\Query\DeepcatFeature;
8use MediaWiki\MediaWikiServices;
9use MediaWiki\Sparql\SparqlClient;
10
11return [
12    'CirrusSearch' => static function ( MediaWikiServices $services ): CirrusSearch {
13        return new CirrusSearch();
14    },
15
16    // SPARQL client for deep category search
17    'CirrusCategoriesClient' => static function ( MediaWikiServices $services ) {
18        $config = $services->getMainConfig();
19        $client = new SparqlClient( $config->get( 'CirrusSearchCategoryEndpoint' ),
20            $services->getHttpRequestFactory() );
21        $client->setTimeout( DeepcatFeature::TIMEOUT );
22        $client->setClientOptions( [
23            'userAgent' => DeepcatFeature::USER_AGENT,
24        ] );
25        return $client;
26    },
27];