Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
24 / 24 |
|
100.00% |
12 / 12 |
CRAP | |
100.00% |
1 / 1 |
EntitySchemaServices | |
100.00% |
24 / 24 |
|
100.00% |
12 / 12 |
24 | |
100.00% |
1 / 1 |
getAutocommentFormatter | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
getDescriptionLookup | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
getEntitySchemaExistsValidator | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
getEntitySchemaSearchHelperFactory | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
getFullViewSchemaDataLookup | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
getIdGenerator | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
getLabelLookup | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
getSchemaDataResolvingLabelLookup | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
getEntitySchemaIsRepo | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
getMediaWikiPageUpdaterFactory | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
getWatchlistUpdater | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
getHookRunner | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 |
1 | <?php |
2 | declare( strict_types = 1 ); |
3 | |
4 | namespace EntitySchema\MediaWiki; |
5 | |
6 | use EntitySchema\DataAccess\DescriptionLookup; |
7 | use EntitySchema\DataAccess\FullViewSchemaDataLookup; |
8 | use EntitySchema\DataAccess\LabelLookup; |
9 | use EntitySchema\DataAccess\MediaWikiPageUpdaterFactory; |
10 | use EntitySchema\DataAccess\SchemaDataResolvingLabelLookup; |
11 | use EntitySchema\DataAccess\WatchlistUpdater; |
12 | use EntitySchema\Domain\Storage\IdGenerator; |
13 | use EntitySchema\Presentation\AutocommentFormatter; |
14 | use EntitySchema\Wikibase\Search\EntitySchemaSearchHelperFactory; |
15 | use EntitySchema\Wikibase\Validators\EntitySchemaExistsValidator; |
16 | use MediaWiki\MediaWikiServices; |
17 | use Psr\Container\ContainerInterface; |
18 | |
19 | /** |
20 | * @license GPL-2.0-or-later |
21 | */ |
22 | class EntitySchemaServices { |
23 | public static function getAutocommentFormatter( ?ContainerInterface $services = null ): AutocommentFormatter { |
24 | return ( $services ?: MediaWikiServices::getInstance() ) |
25 | ->get( 'EntitySchema.AutocommentFormatter' ); |
26 | } |
27 | |
28 | public static function getDescriptionLookup( ?ContainerInterface $services = null ): DescriptionLookup { |
29 | return ( $services ?: MediaWikiServices::getInstance() ) |
30 | ->get( 'EntitySchema.DescriptionLookup' ); |
31 | } |
32 | |
33 | public static function getEntitySchemaExistsValidator( |
34 | ?ContainerInterface $services = null |
35 | ): EntitySchemaExistsValidator { |
36 | return ( $services ?: MediaWikiServices::getInstance() ) |
37 | ->get( 'EntitySchema.EntitySchemaExistsValidator' ); |
38 | } |
39 | |
40 | public static function getEntitySchemaSearchHelperFactory( |
41 | ?ContainerInterface $services = null |
42 | ): EntitySchemaSearchHelperFactory { |
43 | return ( $services ?: MediaWikiServices::getInstance() ) |
44 | ->get( 'EntitySchema.EntitySchemaSearchHelperFactory' ); |
45 | } |
46 | |
47 | public static function getFullViewSchemaDataLookup( |
48 | ?ContainerInterface $services = null |
49 | ): FullViewSchemaDataLookup { |
50 | return ( $services ?: MediaWikiServices::getInstance() ) |
51 | ->get( 'EntitySchema.FullViewSchemaDataLookup' ); |
52 | } |
53 | |
54 | public static function getIdGenerator( ?ContainerInterface $services = null ): IdGenerator { |
55 | return ( $services ?: MediaWikiServices::getInstance() ) |
56 | ->get( 'EntitySchema.IdGenerator' ); |
57 | } |
58 | |
59 | public static function getLabelLookup( ?ContainerInterface $services = null ): LabelLookup { |
60 | return ( $services ?: MediaWikiServices::getInstance() ) |
61 | ->get( 'EntitySchema.LabelLookup' ); |
62 | } |
63 | |
64 | public static function getSchemaDataResolvingLabelLookup( |
65 | ?ContainerInterface $services = null |
66 | ): SchemaDataResolvingLabelLookup { |
67 | return ( $services ?: MediaWikiServices::getInstance() ) |
68 | ->get( 'EntitySchema.SchemaDataResolvingLabelLookup' ); |
69 | } |
70 | |
71 | public static function getEntitySchemaIsRepo( ?ContainerInterface $services = null ): bool { |
72 | return ( $services ?: MediaWikiServices::getInstance() ) |
73 | ->get( 'EntitySchema.EntitySchemaIsRepo' ); |
74 | } |
75 | |
76 | public static function getMediaWikiPageUpdaterFactory( |
77 | ?ContainerInterface $services = null |
78 | ): MediaWikiPageUpdaterFactory { |
79 | return ( $services ?: MediaWikiServices::getInstance() ) |
80 | ->get( 'EntitySchema.MediaWikiPageUpdaterFactory' ); |
81 | } |
82 | |
83 | public static function getWatchlistUpdater( |
84 | ?ContainerInterface $services = null |
85 | ): WatchlistUpdater { |
86 | return ( $services ?: MediaWikiServices::getInstance() ) |
87 | ->get( 'EntitySchema.WatchlistUpdater' ); |
88 | } |
89 | |
90 | public static function getHookRunner( |
91 | ?ContainerInterface $services = null |
92 | ): HookRunner { |
93 | return ( $services ?: MediaWikiServices::getInstance() ) |
94 | ->get( 'EntitySchema.HookRunner' ); |
95 | } |
96 | |
97 | } |