Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 22 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | |
3 | use CookieWarning\Decisions; |
4 | use CookieWarning\HttpGeoLocation; |
5 | use CookieWarning\NoopGeoLocation; |
6 | use MediaWiki\MediaWikiServices; |
7 | |
8 | return [ |
9 | 'CookieWarning.Config' => static function ( MediaWikiServices $services ) { |
10 | return $services->getService( 'ConfigFactory' ) |
11 | ->makeConfig( 'cookiewarning' ); |
12 | }, |
13 | 'GeoLocation' => static function ( MediaWikiServices $services ) { |
14 | $geoIPServiceURL = $services |
15 | ->getService( 'CookieWarning.Config' ) |
16 | ->get( 'CookieWarningGeoIPServiceURL' ); |
17 | |
18 | if ( !is_string( $geoIPServiceURL ) || !$geoIPServiceURL ) { |
19 | return new NoopGeoLocation(); |
20 | } |
21 | return new HttpGeoLocation( $geoIPServiceURL, $services->getHttpRequestFactory() ); |
22 | }, |
23 | 'CookieWarning.Decisions' => static function ( MediaWikiServices $services ) { |
24 | return new Decisions( |
25 | $services->getService( 'CookieWarning.Config' ), |
26 | $services->getService( 'GeoLocation' ), |
27 | $services->getMainWANObjectCache(), |
28 | $services->getUserOptionsLookup() |
29 | ); |
30 | }, |
31 | ]; |