Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
60.00% covered (warning)
60.00%
3 / 5
60.00% covered (warning)
60.00%
3 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
CirrusSearchServices
60.00% covered (warning)
60.00%
3 / 5
60.00% covered (warning)
60.00%
3 / 5
6.60
0.00% covered (danger)
0.00%
0 / 1
 wrap
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getCirrusSearch
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getCirrusCategoriesClient
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getWeightedTagsUpdater
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace CirrusSearch;
4
5use MediaWiki\MediaWikiServices;
6use MediaWiki\Sparql\SparqlClient;
7
8/**
9 * A simple wrapper for MediaWikiServices, to support type safety when accessing
10 * services defined by this extension.
11 */
12class CirrusSearchServices {
13
14    /** @var MediaWikiServices */
15    private MediaWikiServices $services;
16
17    public static function wrap( MediaWikiServices $services ): self {
18        return new self( $services );
19    }
20
21    public function __construct( MediaWikiServices $services ) {
22        $this->services = $services;
23    }
24
25    public function getCirrusSearch(): CirrusSearch {
26        return $this->services->get( 'CirrusSearch' );
27    }
28
29    public function getCirrusCategoriesClient(): SparqlClient {
30        return $this->services->get( 'CirrusCategoriesClient' );
31    }
32
33    public function getWeightedTagsUpdater(): WeightedTagsUpdater {
34        return $this->services->get( WeightedTagsUpdater::SERVICE );
35    }
36
37}