Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 33
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3namespace FileImporter;
4
5use FileImporter\Remote\MediaWiki\CentralAuthTokenProvider;
6use FileImporter\Remote\MediaWiki\HttpApiLookup;
7use FileImporter\Remote\MediaWiki\RemoteApiActionExecutor;
8use FileImporter\Remote\MediaWiki\RemoteApiRequestExecutor;
9use FileImporter\Remote\MediaWiki\SiteTableSiteLookup;
10use FileImporter\Services\Http\HttpRequestExecutor;
11use MediaWiki\Logger\LoggerFactory;
12use MediaWiki\MediaWikiServices;
13
14/**
15 * @codeCoverageIgnore
16 */
17return [
18
19    'FileImporterMediaWikiHttpApiLookup' =>
20        static function ( MediaWikiServices $services ): HttpApiLookup {
21            /** @var HttpRequestExecutor $httpRequestExecutor */
22            $httpRequestExecutor = $services->getService( 'FileImporterHttpRequestExecutor' );
23
24            $service = new HttpApiLookup( $httpRequestExecutor );
25            $service->setLogger( LoggerFactory::getInstance( 'FileImporter' ) );
26            return $service;
27        },
28
29    'FileImporterMediaWikiSiteTableSiteLookup' =>
30        static function ( MediaWikiServices $services ): SiteTableSiteLookup {
31            return new SiteTableSiteLookup(
32                $services->getSiteLookup(),
33                LoggerFactory::getInstance( 'FileImporter' )
34            );
35        },
36
37    'FileImporterMediaWikiRemoteApiRequestExecutor' =>
38        static function ( MediaWikiServices $services ): RemoteApiRequestExecutor {
39            /** @var HttpRequestExecutor $httpRequestExecutor */
40            $httpRequestExecutor = $services->getService( 'FileImporterHttpRequestExecutor' );
41
42            $service = new RemoteApiRequestExecutor(
43                new HttpApiLookup( $httpRequestExecutor ),
44                $httpRequestExecutor,
45                new CentralAuthTokenProvider(),
46                $services->getCentralIdLookupFactory()->getLookup()
47            );
48            $service->setLogger( LoggerFactory::getInstance( 'FileImporter' ) );
49            return $service;
50        },
51
52    'FileImporterMediaWikiRemoteApiActionExecutor' =>
53        static function ( MediaWikiServices $services ): RemoteApiActionExecutor {
54            /** @var RemoteApiRequestExecutor $remoteApiRequestExecutor */
55            $remoteApiRequestExecutor = $services->getService( 'FileImporterMediaWikiRemoteApiRequestExecutor' );
56
57            return new RemoteApiActionExecutor( $remoteApiRequestExecutor );
58        },
59
60];