Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
JCTitle | |
0.00% |
0 / 5 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
getConfig | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | namespace JsonConfig; |
3 | |
4 | use InvalidArgumentException; |
5 | use MediaWiki\Title\TitleValue; |
6 | use stdClass; |
7 | |
8 | /** |
9 | * A value object class that contains namespace ID, title, and |
10 | * the corresponding jsonconfig configuration |
11 | * @package JsonConfig |
12 | */ |
13 | final class JCTitle extends TitleValue { |
14 | |
15 | /** |
16 | * @var stdClass |
17 | */ |
18 | private $config; |
19 | |
20 | /** |
21 | * JCTitle constructor. |
22 | * @param int $namespace Possibly belonging to a foreign wiki |
23 | * @param string $dbkey |
24 | * @param stdClass $config JsonConfig configuration object |
25 | */ |
26 | public function __construct( $namespace, $dbkey, stdClass $config ) { |
27 | if ( $namespace !== $config->namespace ) { |
28 | throw new InvalidArgumentException( 'Namespace does not match config' ); |
29 | } |
30 | parent::__construct( $namespace, $dbkey ); |
31 | $this->config = $config; |
32 | } |
33 | |
34 | public function getConfig() { |
35 | return $this->config; |
36 | } |
37 | } |