Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
10 / 10 |
|
100.00% |
5 / 5 |
CRAP | |
100.00% |
1 / 1 |
CognateServices | |
100.00% |
10 / 10 |
|
100.00% |
5 / 5 |
10 | |
100.00% |
1 / 1 |
getLogger | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
getRepo | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
getStore | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
getPageHookHandler | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
getCacheInvalidator | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 |
1 | <?php |
2 | |
3 | declare( strict_types = 1 ); |
4 | |
5 | namespace Cognate; |
6 | |
7 | use Cognate\HookHandler\CognatePageHookHandler; |
8 | use MediaWiki\MediaWikiServices; |
9 | use Psr\Container\ContainerInterface; |
10 | use Psr\Log\LoggerInterface; |
11 | |
12 | /** |
13 | * @license GPL-2.0-or-later |
14 | * @author Addshore |
15 | */ |
16 | class CognateServices { |
17 | |
18 | public const VIRTUAL_DOMAIN = 'virtual-cognate'; |
19 | |
20 | public static function getLogger( ?ContainerInterface $services = null ): LoggerInterface { |
21 | return ( $services ?: MediaWikiServices::getInstance() ) |
22 | ->get( 'CognateLogger' ); |
23 | } |
24 | |
25 | public static function getRepo( ?ContainerInterface $services = null ): CognateRepo { |
26 | return ( $services ?: MediaWikiServices::getInstance() ) |
27 | ->get( 'CognateRepo' ); |
28 | } |
29 | |
30 | public static function getStore( ?ContainerInterface $services = null ): CognateStore { |
31 | return ( $services ?: MediaWikiServices::getInstance() ) |
32 | ->get( 'CognateStore' ); |
33 | } |
34 | |
35 | public static function getPageHookHandler( ?ContainerInterface $services = null ): CognatePageHookHandler { |
36 | return ( $services ?: MediaWikiServices::getInstance() ) |
37 | ->get( 'CognatePageHookHandler' ); |
38 | } |
39 | |
40 | public static function getCacheInvalidator( ?ContainerInterface $services = null ): CacheInvalidator { |
41 | return ( $services ?: MediaWikiServices::getInstance() ) |
42 | ->get( 'CognateCacheInvalidator' ); |
43 | } |
44 | |
45 | } |