Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 22
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3use CookieWarning\Decisions;
4use CookieWarning\HttpGeoLocation;
5use CookieWarning\NoopGeoLocation;
6use MediaWiki\MediaWikiServices;
7
8return [
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];