Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
12 / 12 |
|
100.00% |
6 / 6 |
CRAP | |
100.00% |
1 / 1 |
EntitySchemaServices | |
100.00% |
12 / 12 |
|
100.00% |
6 / 6 |
12 | |
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 | |||
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 |
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\Domain\Storage\IdGenerator; |
10 | use EntitySchema\Presentation\AutocommentFormatter; |
11 | use EntitySchema\Wikibase\Validators\EntitySchemaExistsValidator; |
12 | use MediaWiki\MediaWikiServices; |
13 | use Psr\Container\ContainerInterface; |
14 | |
15 | /** |
16 | * @license GPL-2.0-or-later |
17 | */ |
18 | class EntitySchemaServices { |
19 | public static function getAutocommentFormatter( ContainerInterface $services = null ): AutocommentFormatter { |
20 | return ( $services ?: MediaWikiServices::getInstance() ) |
21 | ->get( 'EntitySchema.AutocommentFormatter' ); |
22 | } |
23 | |
24 | public static function getDescriptionLookup( ContainerInterface $services = null ): DescriptionLookup { |
25 | return ( $services ?: MediaWikiServices::getInstance() ) |
26 | ->get( 'EntitySchema.DescriptionLookup' ); |
27 | } |
28 | |
29 | public static function getEntitySchemaExistsValidator( |
30 | ContainerInterface $services = null |
31 | ): EntitySchemaExistsValidator { |
32 | return ( $services ?: MediaWikiServices::getInstance() ) |
33 | ->get( 'EntitySchema.EntitySchemaExistsValidator' ); |
34 | } |
35 | |
36 | public static function getFullViewSchemaDataLookup( |
37 | ContainerInterface $services = null |
38 | ): FullViewSchemaDataLookup { |
39 | return ( $services ?: MediaWikiServices::getInstance() ) |
40 | ->get( 'EntitySchema.FullViewSchemaDataLookup' ); |
41 | } |
42 | |
43 | public static function getIdGenerator( ContainerInterface $services = null ): IdGenerator { |
44 | return ( $services ?: MediaWikiServices::getInstance() ) |
45 | ->get( 'EntitySchema.IdGenerator' ); |
46 | } |
47 | |
48 | public static function getLabelLookup( ContainerInterface $services = null ): LabelLookup { |
49 | return ( $services ?: MediaWikiServices::getInstance() ) |
50 | ->get( 'EntitySchema.LabelLookup' ); |
51 | } |
52 | } |