Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
ConfigWrapper | |
0.00% |
0 / 6 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
get | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
has | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | declare( strict_types = 1 ); |
4 | |
5 | namespace MediaWiki\Babel\Config; |
6 | |
7 | use MediaWiki\Config\Config; |
8 | use MediaWiki\Extension\CommunityConfiguration\Access\MediaWikiConfigReader; |
9 | |
10 | class ConfigWrapper implements Config { |
11 | |
12 | private MediaWikiConfigReader $configReader; |
13 | |
14 | public function __construct( MediaWikiConfigReader $configReader ) { |
15 | $this->configReader = $configReader; |
16 | } |
17 | |
18 | /** |
19 | * @inheritDoc |
20 | */ |
21 | public function get( $name ) { |
22 | $value = $this->configReader->get( $name ); |
23 | if ( is_object( $value ) ) { |
24 | // Convert the BabelCategoryNames key to an array rather than an object. See T369608 |
25 | $value = wfObjectToArray( $value ); |
26 | } |
27 | return $value; |
28 | } |
29 | |
30 | /** |
31 | * @inheritDoc |
32 | */ |
33 | public function has( $name ): bool { |
34 | return $this->configReader->has( $name ); |
35 | } |
36 | } |