Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
37 / 37
100.00% covered (success)
100.00%
37 / 37
CRAP
100.00% covered (success)
100.00%
1 / 1
AbuseFilterServices
100.00% covered (success)
100.00%
37 / 37
100.00% covered (success)
100.00%
37 / 37
37
100.00% covered (success)
100.00%
1 / 1
 getHookRunner
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getKeywordsManager
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getFilterProfiler
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getPermissionManager
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getChangeTagger
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getChangeTagsManager
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getChangeTagValidator
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getBlockAutopromoteStore
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getFilterUser
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getCentralDBManager
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getRuleCheckerFactory
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getFilterLookup
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getEmergencyCache
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getEmergencyWatcher
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getEchoNotifier
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getFilterValidator
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getFilterCompare
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getFilterImporter
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getFilterStore
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getConsequencesFactory
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getEditBoxBuilderFactory
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getConsequencesLookup
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getConsequencesRegistry
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getAbuseLoggerFactory
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getUpdateHitCountWatcher
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getVariablesBlobStore
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getConsequencesExecutorFactory
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getFilterRunnerFactory
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getSpecsFormatter
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getVariablesFormatter
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getLazyVariableComputer
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getTextExtractor
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getVariablesManager
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getVariableGeneratorFactory
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getEditRevUpdater
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getBlockedDomainStorage
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getBlockedDomainFilter
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace MediaWiki\Extension\AbuseFilter;
4
5use MediaWiki\Extension\AbuseFilter\ChangeTags\ChangeTagger;
6use MediaWiki\Extension\AbuseFilter\ChangeTags\ChangeTagsManager;
7use MediaWiki\Extension\AbuseFilter\ChangeTags\ChangeTagValidator;
8use MediaWiki\Extension\AbuseFilter\Consequences\ConsequencesExecutorFactory;
9use MediaWiki\Extension\AbuseFilter\Consequences\ConsequencesFactory;
10use MediaWiki\Extension\AbuseFilter\Consequences\ConsequencesLookup;
11use MediaWiki\Extension\AbuseFilter\Consequences\ConsequencesRegistry;
12use MediaWiki\Extension\AbuseFilter\EditBox\EditBoxBuilderFactory;
13use MediaWiki\Extension\AbuseFilter\Hooks\AbuseFilterHookRunner;
14use MediaWiki\Extension\AbuseFilter\Parser\RuleCheckerFactory;
15use MediaWiki\Extension\AbuseFilter\VariableGenerator\VariableGeneratorFactory;
16use MediaWiki\Extension\AbuseFilter\Variables\LazyVariableComputer;
17use MediaWiki\Extension\AbuseFilter\Variables\VariablesBlobStore;
18use MediaWiki\Extension\AbuseFilter\Variables\VariablesFormatter;
19use MediaWiki\Extension\AbuseFilter\Variables\VariablesManager;
20use MediaWiki\Extension\AbuseFilter\Watcher\EmergencyWatcher;
21use MediaWiki\Extension\AbuseFilter\Watcher\UpdateHitCountWatcher;
22use MediaWiki\MediaWikiServices;
23use Psr\Container\ContainerInterface;
24
25class AbuseFilterServices {
26
27    public static function getHookRunner( ?ContainerInterface $services = null ): AbuseFilterHookRunner {
28        return ( $services ?? MediaWikiServices::getInstance() )->get( AbuseFilterHookRunner::SERVICE_NAME );
29    }
30
31    /**
32     * @param ContainerInterface|null $services
33     * @return KeywordsManager
34     */
35    public static function getKeywordsManager( ?ContainerInterface $services = null ): KeywordsManager {
36        return ( $services ?? MediaWikiServices::getInstance() )->get( KeywordsManager::SERVICE_NAME );
37    }
38
39    /**
40     * @param ContainerInterface|null $services
41     * @return FilterProfiler
42     */
43    public static function getFilterProfiler( ?ContainerInterface $services = null ): FilterProfiler {
44        return ( $services ?? MediaWikiServices::getInstance() )->get( FilterProfiler::SERVICE_NAME );
45    }
46
47    /**
48     * @param ContainerInterface|null $services
49     * @return AbuseFilterPermissionManager
50     */
51    public static function getPermissionManager( ?ContainerInterface $services = null ): AbuseFilterPermissionManager {
52        return ( $services ?? MediaWikiServices::getInstance() )->get( AbuseFilterPermissionManager::SERVICE_NAME );
53    }
54
55    /**
56     * @param ContainerInterface|null $services
57     * @return ChangeTagger
58     */
59    public static function getChangeTagger( ?ContainerInterface $services = null ): ChangeTagger {
60        return ( $services ?? MediaWikiServices::getInstance() )->get( ChangeTagger::SERVICE_NAME );
61    }
62
63    /**
64     * @param ContainerInterface|null $services
65     * @return ChangeTagsManager
66     */
67    public static function getChangeTagsManager( ?ContainerInterface $services = null ): ChangeTagsManager {
68        return ( $services ?? MediaWikiServices::getInstance() )->get( ChangeTagsManager::SERVICE_NAME );
69    }
70
71    /**
72     * @param ContainerInterface|null $services
73     * @return ChangeTagValidator
74     */
75    public static function getChangeTagValidator( ?ContainerInterface $services = null ): ChangeTagValidator {
76        return ( $services ?? MediaWikiServices::getInstance() )->get( ChangeTagValidator::SERVICE_NAME );
77    }
78
79    /**
80     * @param ContainerInterface|null $services
81     * @return BlockAutopromoteStore
82     */
83    public static function getBlockAutopromoteStore( ?ContainerInterface $services = null ): BlockAutopromoteStore {
84        return ( $services ?? MediaWikiServices::getInstance() )->get( BlockAutopromoteStore::SERVICE_NAME );
85    }
86
87    /**
88     * @param ContainerInterface|null $services
89     * @return FilterUser
90     */
91    public static function getFilterUser( ?ContainerInterface $services = null ): FilterUser {
92        return ( $services ?? MediaWikiServices::getInstance() )->get( FilterUser::SERVICE_NAME );
93    }
94
95    /**
96     * @param ContainerInterface|null $services
97     * @return CentralDBManager
98     */
99    public static function getCentralDBManager( ?ContainerInterface $services = null ): CentralDBManager {
100        return ( $services ?? MediaWikiServices::getInstance() )->get( CentralDBManager::SERVICE_NAME );
101    }
102
103    /**
104     * @param ContainerInterface|null $services
105     * @return RuleCheckerFactory
106     */
107    public static function getRuleCheckerFactory( ?ContainerInterface $services = null ): RuleCheckerFactory {
108        return ( $services ?? MediaWikiServices::getInstance() )->get( RuleCheckerFactory::SERVICE_NAME );
109    }
110
111    /**
112     * @param ContainerInterface|null $services
113     * @return FilterLookup
114     */
115    public static function getFilterLookup( ?ContainerInterface $services = null ): FilterLookup {
116        return ( $services ?? MediaWikiServices::getInstance() )->get( FilterLookup::SERVICE_NAME );
117    }
118
119    /**
120     * @param ContainerInterface|null $services
121     * @return EmergencyCache
122     */
123    public static function getEmergencyCache( ?ContainerInterface $services = null ): EmergencyCache {
124        return ( $services ?? MediaWikiServices::getInstance() )->get( EmergencyCache::SERVICE_NAME );
125    }
126
127    /**
128     * @param ContainerInterface|null $services
129     * @return EmergencyWatcher
130     */
131    public static function getEmergencyWatcher( ?ContainerInterface $services = null ): EmergencyWatcher {
132        return ( $services ?? MediaWikiServices::getInstance() )->get( EmergencyWatcher::SERVICE_NAME );
133    }
134
135    /**
136     * @param ContainerInterface|null $services
137     * @return EchoNotifier
138     */
139    public static function getEchoNotifier( ?ContainerInterface $services = null ): EchoNotifier {
140        return ( $services ?? MediaWikiServices::getInstance() )->get( EchoNotifier::SERVICE_NAME );
141    }
142
143    /**
144     * @param ContainerInterface|null $services
145     * @return FilterValidator
146     */
147    public static function getFilterValidator( ?ContainerInterface $services = null ): FilterValidator {
148        return ( $services ?? MediaWikiServices::getInstance() )->get( FilterValidator::SERVICE_NAME );
149    }
150
151    /**
152     * @param ContainerInterface|null $services
153     * @return FilterCompare
154     */
155    public static function getFilterCompare( ?ContainerInterface $services = null ): FilterCompare {
156        return ( $services ?? MediaWikiServices::getInstance() )->get( FilterCompare::SERVICE_NAME );
157    }
158
159    /**
160     * @param ContainerInterface|null $services
161     * @return FilterImporter
162     */
163    public static function getFilterImporter( ?ContainerInterface $services = null ): FilterImporter {
164        return ( $services ?? MediaWikiServices::getInstance() )->get( FilterImporter::SERVICE_NAME );
165    }
166
167    /**
168     * @param ContainerInterface|null $services
169     * @return FilterStore
170     */
171    public static function getFilterStore( ?ContainerInterface $services = null ): FilterStore {
172        return ( $services ?? MediaWikiServices::getInstance() )->get( FilterStore::SERVICE_NAME );
173    }
174
175    /**
176     * @param ContainerInterface|null $services
177     * @return ConsequencesFactory
178     */
179    public static function getConsequencesFactory( ?ContainerInterface $services = null ): ConsequencesFactory {
180        return ( $services ?? MediaWikiServices::getInstance() )->get( ConsequencesFactory::SERVICE_NAME );
181    }
182
183    /**
184     * @param ContainerInterface|null $services
185     * @return EditBoxBuilderFactory
186     */
187    public static function getEditBoxBuilderFactory( ?ContainerInterface $services = null ): EditBoxBuilderFactory {
188        return ( $services ?? MediaWikiServices::getInstance() )->get( EditBoxBuilderFactory::SERVICE_NAME );
189    }
190
191    /**
192     * @param ContainerInterface|null $services
193     * @return ConsequencesLookup
194     */
195    public static function getConsequencesLookup( ?ContainerInterface $services = null ): ConsequencesLookup {
196        return ( $services ?? MediaWikiServices::getInstance() )->get( ConsequencesLookup::SERVICE_NAME );
197    }
198
199    /**
200     * @param ContainerInterface|null $services
201     * @return ConsequencesRegistry
202     */
203    public static function getConsequencesRegistry( ?ContainerInterface $services = null ): ConsequencesRegistry {
204        return ( $services ?? MediaWikiServices::getInstance() )->get( ConsequencesRegistry::SERVICE_NAME );
205    }
206
207    /**
208     * @param ContainerInterface|null $services
209     * @return AbuseLoggerFactory
210     */
211    public static function getAbuseLoggerFactory( ?ContainerInterface $services = null ): AbuseLoggerFactory {
212        return ( $services ?? MediaWikiServices::getInstance() )->get( AbuseLoggerFactory::SERVICE_NAME );
213    }
214
215    /**
216     * @param ContainerInterface|null $services
217     * @return UpdateHitCountWatcher
218     */
219    public static function getUpdateHitCountWatcher( ?ContainerInterface $services = null ): UpdateHitCountWatcher {
220        return ( $services ?? MediaWikiServices::getInstance() )->get( UpdateHitCountWatcher::SERVICE_NAME );
221    }
222
223    /**
224     * @param ContainerInterface|null $services
225     * @return VariablesBlobStore
226     */
227    public static function getVariablesBlobStore( ?ContainerInterface $services = null ): VariablesBlobStore {
228        return ( $services ?? MediaWikiServices::getInstance() )->get( VariablesBlobStore::SERVICE_NAME );
229    }
230
231    /**
232     * @param ContainerInterface|null $services
233     * @return ConsequencesExecutorFactory
234     */
235    public static function getConsequencesExecutorFactory(
236        ?ContainerInterface $services = null
237    ): ConsequencesExecutorFactory {
238        return ( $services ?? MediaWikiServices::getInstance() )->get( ConsequencesExecutorFactory::SERVICE_NAME );
239    }
240
241    /**
242     * @param ContainerInterface|null $services
243     * @return FilterRunnerFactory
244     */
245    public static function getFilterRunnerFactory( ?ContainerInterface $services = null ): FilterRunnerFactory {
246        return ( $services ?? MediaWikiServices::getInstance() )->get( FilterRunnerFactory::SERVICE_NAME );
247    }
248
249    /**
250     * @param ContainerInterface|null $services
251     * @return SpecsFormatter
252     */
253    public static function getSpecsFormatter( ?ContainerInterface $services = null ): SpecsFormatter {
254        return ( $services ?? MediaWikiServices::getInstance() )->get( SpecsFormatter::SERVICE_NAME );
255    }
256
257    /**
258     * @param ContainerInterface|null $services
259     * @return VariablesFormatter
260     */
261    public static function getVariablesFormatter( ?ContainerInterface $services = null ): VariablesFormatter {
262        return ( $services ?? MediaWikiServices::getInstance() )->get( VariablesFormatter::SERVICE_NAME );
263    }
264
265    /**
266     * @param ContainerInterface|null $services
267     * @return LazyVariableComputer
268     */
269    public static function getLazyVariableComputer( ?ContainerInterface $services = null ): LazyVariableComputer {
270        return ( $services ?? MediaWikiServices::getInstance() )->get( LazyVariableComputer::SERVICE_NAME );
271    }
272
273    /**
274     * @param ContainerInterface|null $services
275     * @return TextExtractor
276     */
277    public static function getTextExtractor( ?ContainerInterface $services = null ): TextExtractor {
278        return ( $services ?? MediaWikiServices::getInstance() )->get( TextExtractor::SERVICE_NAME );
279    }
280
281    /**
282     * @param ContainerInterface|null $services
283     * @return VariablesManager
284     */
285    public static function getVariablesManager( ?ContainerInterface $services = null ): VariablesManager {
286        return ( $services ?? MediaWikiServices::getInstance() )->get( VariablesManager::SERVICE_NAME );
287    }
288
289    /**
290     * @param ContainerInterface|null $services
291     * @return VariableGeneratorFactory
292     */
293    public static function getVariableGeneratorFactory(
294        ?ContainerInterface $services = null
295    ): VariableGeneratorFactory {
296        return ( $services ?? MediaWikiServices::getInstance() )->get( VariableGeneratorFactory::SERVICE_NAME );
297    }
298
299    /**
300     * @param ContainerInterface|null $services
301     * @return EditRevUpdater
302     */
303    public static function getEditRevUpdater( ?ContainerInterface $services = null ): EditRevUpdater {
304        return ( $services ?? MediaWikiServices::getInstance() )->get( EditRevUpdater::SERVICE_NAME );
305    }
306
307    /**
308     * @param ContainerInterface|null $services
309     * @return BlockedDomainStorage
310     */
311    public static function getBlockedDomainStorage( ?ContainerInterface $services = null ): BlockedDomainStorage {
312        return ( $services ?? MediaWikiServices::getInstance() )->get( BlockedDomainStorage::SERVICE_NAME );
313    }
314
315    /**
316     * @param ContainerInterface|null $services
317     * @return BlockedDomainFilter
318     */
319    public static function getBlockedDomainFilter( ?ContainerInterface $services = null ): BlockedDomainFilter {
320        return ( $services ?? MediaWikiServices::getInstance() )->get( BlockedDomainFilter::SERVICE_NAME );
321    }
322}