Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 7 |
CRAP | |
0.00% |
0 / 1 |
ORESServices | |
0.00% |
0 / 7 |
|
0.00% |
0 / 7 |
56 | |
0.00% |
0 / 1 |
getLogger | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getModelLookup | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getThresholdLookup | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getScoreStorage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getORESService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getScoreLookup | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getDatabaseQueryBuilder | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace ORES\Services; |
4 | |
5 | use MediaWiki\MediaWikiServices; |
6 | use ORES\ORESService; |
7 | use ORES\Storage\DatabaseQueryBuilder; |
8 | use ORES\Storage\ModelLookup; |
9 | use ORES\Storage\ScoreStorage; |
10 | use ORES\Storage\StorageScoreLookup; |
11 | use ORES\Storage\ThresholdLookup; |
12 | use Psr\Log\LoggerInterface; |
13 | |
14 | /** |
15 | * @license GPL-2.0-or-later |
16 | * @author Amir Sarabadani |
17 | */ |
18 | class ORESServices { |
19 | |
20 | /** |
21 | * @param MediaWikiServices|null $services |
22 | * @return LoggerInterface |
23 | */ |
24 | public static function getLogger( ?MediaWikiServices $services = null ) { |
25 | return ( $services ?? MediaWikiServices::getInstance() )->getService( 'ORESLogger' ); |
26 | } |
27 | |
28 | /** |
29 | * @param MediaWikiServices|null $services |
30 | * @return ModelLookup |
31 | */ |
32 | public static function getModelLookup( ?MediaWikiServices $services = null ) { |
33 | return ( $services ?? MediaWikiServices::getInstance() )->getService( 'ORESModelLookup' ); |
34 | } |
35 | |
36 | /** |
37 | * @param MediaWikiServices|null $services |
38 | * @return ThresholdLookup |
39 | */ |
40 | public static function getThresholdLookup( ?MediaWikiServices $services = null ) { |
41 | return ( $services ?? MediaWikiServices::getInstance() )->getService( 'ORESThresholdLookup' ); |
42 | } |
43 | |
44 | /** |
45 | * @param MediaWikiServices|null $services |
46 | * @return ScoreStorage |
47 | */ |
48 | public static function getScoreStorage( ?MediaWikiServices $services = null ) { |
49 | return ( $services ?? MediaWikiServices::getInstance() )->getService( 'ORESScoreStorage' ); |
50 | } |
51 | |
52 | /** |
53 | * @param MediaWikiServices|null $services |
54 | * @return ORESService |
55 | */ |
56 | public static function getORESService( ?MediaWikiServices $services = null ) { |
57 | return ( $services ?? MediaWikiServices::getInstance() )->getService( 'ORESService' ); |
58 | } |
59 | |
60 | /** |
61 | * @param MediaWikiServices|null $services |
62 | * @return StorageScoreLookup |
63 | */ |
64 | public static function getScoreLookup( ?MediaWikiServices $services = null ) { |
65 | return ( $services ?? MediaWikiServices::getInstance() )->getService( 'ORESScoreLookup' ); |
66 | } |
67 | |
68 | /** |
69 | * @param MediaWikiServices|null $services |
70 | * @return DatabaseQueryBuilder |
71 | */ |
72 | public static function getDatabaseQueryBuilder( ?MediaWikiServices $services = null ) { |
73 | return ( $services ?? MediaWikiServices::getInstance() )->getService( 'ORESDatabaseQueryBuilder' ); |
74 | } |
75 | |
76 | } |