Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3use MediaWiki\Config\ServiceOptions;
4use MediaWiki\Extension\GlobalBlocking\GlobalBlockingServices;
5use MediaWiki\Extension\GlobalBlocking\Services\GlobalBlockingBlockPurger;
6use MediaWiki\Extension\GlobalBlocking\Services\GlobalBlockingConnectionProvider;
7use MediaWiki\Extension\GlobalBlocking\Services\GlobalBlockingLinkBuilder;
8use MediaWiki\Extension\GlobalBlocking\Services\GlobalBlockLocalStatusLookup;
9use MediaWiki\Extension\GlobalBlocking\Services\GlobalBlockLocalStatusManager;
10use MediaWiki\Extension\GlobalBlocking\Services\GlobalBlockLookup;
11use MediaWiki\Extension\GlobalBlocking\Services\GlobalBlockManager;
12use MediaWiki\Extension\GlobalBlocking\Services\GlobalBlockReasonFormatter;
13use MediaWiki\Logger\LoggerFactory;
14use MediaWiki\MediaWikiServices;
15
16// PHPUnit does not understand coverage for this file.
17// It is covered though, see GlobalBlockingServiceWiringTest.
18// @codeCoverageIgnoreStart
19
20return [
21    'GlobalBlocking.GlobalBlockReasonFormatter' => static function (
22        MediaWikiServices $services
23    ): GlobalBlockReasonFormatter {
24        return new GlobalBlockReasonFormatter(
25            new ServiceOptions(
26                GlobalBlockReasonFormatter::CONSTRUCTOR_OPTIONS,
27                $services->getMainConfig()
28            ),
29            $services->getMainWANObjectCache(),
30            $services->getHttpRequestFactory(),
31            LoggerFactory::getInstance( 'GlobalBlockReasonFormatter' )
32        );
33    },
34    'GlobalBlocking.GlobalBlockingConnectionProvider' => static function (
35        MediaWikiServices $services
36    ): GlobalBlockingConnectionProvider {
37        return new GlobalBlockingConnectionProvider( $services->getConnectionProvider() );
38    },
39    'GlobalBlocking.GlobalBlockingBlockPurger' => static function (
40        MediaWikiServices $services
41    ): GlobalBlockingBlockPurger {
42        $globalBlockingServices = GlobalBlockingServices::wrap( $services );
43        return new GlobalBlockingBlockPurger(
44            new ServiceOptions(
45                GlobalBlockingBlockPurger::CONSTRUCTOR_OPTIONS,
46                $services->getMainConfig()
47            ),
48            $globalBlockingServices->getGlobalBlockingConnectionProvider(),
49            $services->getDBLoadBalancerFactory(),
50            $services->getReadOnlyMode()
51        );
52    },
53    'GlobalBlocking.GlobalBlockLocalStatusLookup' => static function (
54        MediaWikiServices $services
55    ): GlobalBlockLocalStatusLookup {
56        return new GlobalBlockLocalStatusLookup(
57            $services->getConnectionProvider(),
58            $services->getCentralIdLookup()
59        );
60    },
61    'GlobalBlocking.GlobalBlockLocalStatusManager' => static function (
62        MediaWikiServices $services
63    ): GlobalBlockLocalStatusManager {
64        $globalBlockingServices = GlobalBlockingServices::wrap( $services );
65        return new GlobalBlockLocalStatusManager(
66            new ServiceOptions(
67                GlobalBlockLocalStatusManager::CONSTRUCTOR_OPTIONS,
68                $services->getMainConfig()
69            ),
70            $globalBlockingServices->getGlobalBlockLocalStatusLookup(),
71            $globalBlockingServices->getGlobalBlockLookup(),
72            $globalBlockingServices->getGlobalBlockingBlockPurger(),
73            $globalBlockingServices->getGlobalBlockingConnectionProvider(),
74            $services->getConnectionProvider(),
75            $services->getCentralIdLookup()
76        );
77    },
78    'GlobalBlocking.GlobalBlockLookup' => static function (
79        MediaWikiServices $services
80    ): GlobalBlockLookup {
81        $globalBlockingServices = GlobalBlockingServices::wrap( $services );
82        return new GlobalBlockLookup(
83            new ServiceOptions(
84                GlobalBlockLookup::CONSTRUCTOR_OPTIONS,
85                $services->getMainConfig()
86            ),
87            $globalBlockingServices->getGlobalBlockingConnectionProvider(),
88            $services->getStatsdDataFactory(),
89            $services->getHookContainer(),
90            $services->getCentralIdLookup(),
91            $services->getContentLanguage(),
92            $globalBlockingServices->getReasonFormatter(),
93            $globalBlockingServices->getGlobalBlockLocalStatusLookup(),
94            $globalBlockingServices->getGlobalBlockingLinkBuilder()
95        );
96    },
97    'GlobalBlocking.GlobalBlockManager' => static function (
98        MediaWikiServices $services
99    ): GlobalBlockManager {
100        $globalBlockingServices = GlobalBlockingServices::wrap( $services );
101        return new GlobalBlockManager(
102            new ServiceOptions(
103                GlobalBlockManager::CONSTRUCTOR_OPTIONS,
104                $services->getMainConfig()
105            ),
106            $globalBlockingServices->getGlobalBlockingBlockPurger(),
107            $globalBlockingServices->getGlobalBlockLookup(),
108            $globalBlockingServices->getGlobalBlockingConnectionProvider(),
109            $services->getCentralIdLookup(),
110            $services->getUserFactory()
111        );
112    },
113    'GlobalBlocking.GlobalBlockingLinkBuilder' => static function (
114        MediaWikiServices $services
115    ): GlobalBlockingLinkBuilder {
116        return new GlobalBlockingLinkBuilder(
117            new ServiceOptions(
118                GlobalBlockingLinkBuilder::CONSTRUCTOR_OPTIONS,
119                $services->getMainConfig()
120            ),
121            $services->getLinkRenderer(),
122            RequestContext::getMain(),
123            RequestContext::getMain()->getLanguage()
124        );
125    },
126];
127
128// @codeCoverageIgnoreEnd