Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 63 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 1 | <?php |
| 2 | |
| 3 | use MediaWiki\Extension\WikibaseManifest\ConceptNamespaces; |
| 4 | use MediaWiki\Extension\WikibaseManifest\ConfigEquivEntitiesFactory; |
| 5 | use MediaWiki\Extension\WikibaseManifest\ConfigExternalServicesFactory; |
| 6 | use MediaWiki\Extension\WikibaseManifest\ConfigMaxLagFactory; |
| 7 | use MediaWiki\Extension\WikibaseManifest\EmptyValueCleaner; |
| 8 | use MediaWiki\Extension\WikibaseManifest\LocalSourceEntityNamespacesFactory; |
| 9 | use MediaWiki\Extension\WikibaseManifest\ManifestGenerator; |
| 10 | use MediaWiki\Extension\WikibaseManifest\OAuthUrlFactory; |
| 11 | use MediaWiki\Extension\WikibaseManifest\TitleFactoryMainPageUrl; |
| 12 | use MediaWiki\Extension\WikibaseManifest\WbManifest; |
| 13 | use MediaWiki\MediaWikiServices; |
| 14 | use Wikibase\Repo\WikibaseRepo; |
| 15 | |
| 16 | return [ |
| 17 | WbManifest::WIKIBASE_MANIFEST_GENERATOR => static function ( MediaWikiServices $services ) { |
| 18 | $mainPageUrl = |
| 19 | $services->getService( WbManifest::WIKIBASE_MANIFEST_TITLE_FACTORY_MAIN_PAGE_URL ); |
| 20 | |
| 21 | $equivEntitiesFactory = |
| 22 | $services->getService( WbManifest::WIKIBASE_MANIFEST_CONFIG_EQUIV_ENTITIES_FACTORY ); |
| 23 | |
| 24 | $conceptNamespaces = $services->getService( WbManifest::WIKIBASE_MANIFEST_CONCEPT_NAMESPACES ); |
| 25 | |
| 26 | $externalServicesFactory = $services->getService( WbManifest::WIKIBASE_MANIFEST_CONFIG_EXTERNAL_SERVICES_FACTORY ); |
| 27 | |
| 28 | $entityNamespacesFactory = $services->getService( WbManifest::WIKIBASE_MANIFEST_LOCAL_SOURCE_ENTITY_NAMESPACES_FACTORY ); |
| 29 | |
| 30 | $maxLagFactory = $services->getService( WbManifest::WIKIBASE_MANIFEST_CONFIG_MAX_LAG_FACTORY ); |
| 31 | |
| 32 | $oauthUrlFactory = $services->getService( WbManifest::OAUTH_URL_FACTORY ); |
| 33 | |
| 34 | return new ManifestGenerator( |
| 35 | $services->getMainConfig(), |
| 36 | $mainPageUrl, |
| 37 | $equivEntitiesFactory, |
| 38 | $conceptNamespaces, |
| 39 | $externalServicesFactory, |
| 40 | $entityNamespacesFactory, |
| 41 | $maxLagFactory, |
| 42 | $oauthUrlFactory |
| 43 | ); |
| 44 | }, |
| 45 | WbManifest::WIKIBASE_MANIFEST_CONFIG_EQUIV_ENTITIES_FACTORY => static function ( MediaWikiServices $services ) { |
| 46 | return new ConfigEquivEntitiesFactory( |
| 47 | $services->getMainConfig(), WbManifest::ENTITY_MAPPING_CONFIG |
| 48 | ); |
| 49 | }, |
| 50 | WbManifest::WIKIBASE_MANIFEST_CONFIG_EXTERNAL_SERVICES_FACTORY => static function ( MediaWikiServices $services ) { |
| 51 | return new ConfigExternalServicesFactory( |
| 52 | $services->getMainConfig(), WbManifest::EXTERNAL_SERVICES_CONFIG |
| 53 | ); |
| 54 | }, |
| 55 | WbManifest::WIKIBASE_MANIFEST_CONCEPT_NAMESPACES => static function ( MediaWikiServices $services ) { |
| 56 | $rdfVocabulary = WikibaseRepo::getRdfVocabulary( $services ); |
| 57 | $localEntitySource = WikibaseRepo::getLocalEntitySource( $services ); |
| 58 | // TODO: Get Canonical Document URLS from a service not straight from remote |
| 59 | return new ConceptNamespaces( $localEntitySource, $rdfVocabulary ); |
| 60 | }, |
| 61 | WbManifest::EMPTY_VALUE_CLEANER => static function () { |
| 62 | return new EmptyValueCleaner(); |
| 63 | }, |
| 64 | WbManifest::WIKIBASE_MANIFEST_LOCAL_SOURCE_ENTITY_NAMESPACES_FACTORY => static function ( MediaWikiServices $services |
| 65 | ) { |
| 66 | $localEntitySource = WikibaseRepo::getLocalEntitySource( $services ); |
| 67 | |
| 68 | return new LocalSourceEntityNamespacesFactory( |
| 69 | $localEntitySource, $services->getNamespaceInfo() |
| 70 | ); |
| 71 | }, |
| 72 | WbManifest::WIKIBASE_MANIFEST_TITLE_FACTORY_MAIN_PAGE_URL => static function ( MediaWikiServices $services ) { |
| 73 | return new TitleFactoryMainPageUrl( $services->getTitleFactory() ); |
| 74 | }, |
| 75 | WbManifest::WIKIBASE_MANIFEST_CONFIG_MAX_LAG_FACTORY => static function ( MediaWikiServices $services ) { |
| 76 | return new ConfigMaxLagFactory( |
| 77 | $services->getMainConfig(), WbManifest::MAX_LAG_CONFIG |
| 78 | ); |
| 79 | }, |
| 80 | WbManifest::OAUTH_URL_FACTORY => static function ( MediaWikiServices $services ) { |
| 81 | return new OAuthUrlFactory( |
| 82 | $services->getMainConfig(), |
| 83 | ExtensionRegistry::getInstance(), |
| 84 | $services->getSpecialPageFactory() |
| 85 | ); |
| 86 | } |
| 87 | ]; |