Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 33 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | |
3 | use MediaWiki\MediaWikiServices; |
4 | use Wikibase\MediaInfo\Content\MediaInfoHandler; |
5 | use Wikibase\MediaInfo\Content\MissingMediaInfoHandler; |
6 | use Wikibase\MediaInfo\DataModel\MediaInfo; |
7 | use Wikibase\MediaInfo\Services\FilePageLookup; |
8 | use Wikibase\MediaInfo\Services\MediaInfoIdLookup; |
9 | use Wikibase\MediaInfo\Services\MediaInfoServices; |
10 | use Wikibase\Repo\WikibaseRepo; |
11 | |
12 | return [ |
13 | 'MediaInfoIdLookup' => static function ( MediaWikiServices $services ): MediaInfoIdLookup { |
14 | $nsLookup = WikibaseRepo::getEntityNamespaceLookup( $services ); |
15 | $entityIdComposer = WikibaseRepo::getEntityIdComposer( $services ); |
16 | $mediaInfoNamespace = $nsLookup->getEntityNamespace( MediaInfo::ENTITY_TYPE ); |
17 | |
18 | if ( !is_int( $mediaInfoNamespace ) ) { |
19 | throw new LogicException( 'No namespace configured for MediaInfo entities!' ); |
20 | } |
21 | |
22 | return new MediaInfoIdLookup( $entityIdComposer, $mediaInfoNamespace ); |
23 | }, |
24 | |
25 | 'MediaInfoFilePageLookup' => static function ( MediaWikiServices $services ): FilePageLookup { |
26 | return new FilePageLookup( $services->getTitleFactory() ); |
27 | }, |
28 | |
29 | 'MediaInfoHandler' => static function ( MediaWikiServices $services ): MediaInfoHandler { |
30 | return new MediaInfoHandler( |
31 | WikibaseRepo::getEntityContentDataCodec( $services ), |
32 | WikibaseRepo::getEntityConstraintProvider( $services ), |
33 | WikibaseRepo::getValidatorErrorLocalizer( $services ), |
34 | WikibaseRepo::getEntityIdParser( $services ), |
35 | new MissingMediaInfoHandler( |
36 | MediaInfoServices::getMediaInfoIdLookup( $services ), |
37 | MediaInfoServices::getFilePageLookup( $services ), |
38 | WikibaseRepo::getEntityParserOutputGeneratorFactory( $services ) |
39 | ), |
40 | MediaInfoServices::getMediaInfoIdLookup( $services ), |
41 | MediaInfoServices::getFilePageLookup( $services ), |
42 | WikibaseRepo::getFieldDefinitionsFactory( $services ) |
43 | ->getFieldDefinitionsByType( MediaInfo::ENTITY_TYPE ), |
44 | $services->getPageStore(), |
45 | $services->getTitleFactory(), |
46 | null |
47 | ); |
48 | } |
49 | ]; |