Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
AutoModeratorServices | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
wrap | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
getAutoModeratorConfig | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
getAutoModeratorWikiConfig | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
getWikiPageConfig | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
getWikiPageConfigLoader | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
getWikiPageConfigValidatorFactory | n/a |
0 / 0 |
n/a |
0 / 0 |
1 |
1 | <?php |
2 | |
3 | namespace AutoModerator; |
4 | |
5 | use AutoModerator\Config\Validation\ConfigValidatorFactory; |
6 | use AutoModerator\Config\WikiPageConfig; |
7 | use AutoModerator\Config\WikiPageConfigLoader; |
8 | use MediaWiki\Config\Config; |
9 | use MediaWiki\MediaWikiServices; |
10 | |
11 | /** |
12 | * A simple wrapper for MediaWikiServices, to support type safety when accessing |
13 | * services defined by this extension. |
14 | */ |
15 | class AutoModeratorServices { |
16 | |
17 | private MediaWikiServices $coreServices; |
18 | |
19 | /** |
20 | * @param MediaWikiServices $coreServices |
21 | */ |
22 | public function __construct( MediaWikiServices $coreServices ) { |
23 | $this->coreServices = $coreServices; |
24 | } |
25 | |
26 | /** |
27 | * Static version of the constructor, for nicer syntax. |
28 | * @param MediaWikiServices $coreServices |
29 | * @codeCoverageIgnore |
30 | * @return static |
31 | */ |
32 | public static function wrap( MediaWikiServices $coreServices ) { |
33 | return new static( $coreServices ); |
34 | } |
35 | |
36 | // Service aliases |
37 | // phpcs:disable MediaWiki.Commenting.FunctionComment |
38 | |
39 | /** |
40 | * @codeCoverageIgnore |
41 | */ |
42 | public function getAutoModeratorConfig(): Config { |
43 | return $this->coreServices->get( 'AutoModeratorConfig' ); |
44 | } |
45 | |
46 | /** |
47 | * @codeCoverageIgnore |
48 | */ |
49 | public function getAutoModeratorWikiConfig(): Config { |
50 | return $this->coreServices->get( 'AutoModeratorWikiConfigLoader' ); |
51 | } |
52 | |
53 | /** |
54 | * @codeCoverageIgnore |
55 | */ |
56 | public function getWikiPageConfig(): WikiPageConfig { |
57 | return $this->coreServices->get( 'AutoModeratorWikiPageConfig' ); |
58 | } |
59 | |
60 | /** |
61 | * @codeCoverageIgnore |
62 | */ |
63 | public function getWikiPageConfigLoader(): WikiPageConfigLoader { |
64 | return $this->coreServices->get( 'AutoModeratorWikiPageConfigLoader' ); |
65 | } |
66 | |
67 | /** |
68 | * @codeCoverageIgnore |
69 | */ |
70 | public function getWikiPageConfigValidatorFactory(): ConfigValidatorFactory { |
71 | return $this->coreServices->get( 'AutoModeratorConfigValidatorFactory' ); |
72 | } |
73 | } |