Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
JCSlotDiffRenderer | |
0.00% |
0 / 9 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getTablePrefix | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
addModules | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getExtraCacheKeys | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getDiff | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | namespace JsonConfig; |
3 | |
4 | use Content; |
5 | use IContextSource; |
6 | use MediaWiki\Output\OutputPage; |
7 | use MediaWiki\Title\Title; |
8 | use SlotDiffRenderer; |
9 | use TextSlotDiffRenderer; |
10 | |
11 | class JCSlotDiffRenderer extends SlotDiffRenderer { |
12 | /** @var TextSlotDiffRenderer */ |
13 | private $textSlotDiffRenderer; |
14 | |
15 | public function __construct( |
16 | TextSlotDiffRenderer $textSlotDiffRenderer |
17 | ) { |
18 | $this->textSlotDiffRenderer = $textSlotDiffRenderer; |
19 | } |
20 | |
21 | public function getTablePrefix( IContextSource $context, Title $newTitle ): array { |
22 | return $this->textSlotDiffRenderer->getTablePrefix( $context, $newTitle ); |
23 | } |
24 | |
25 | public function addModules( OutputPage $output ) { |
26 | $this->textSlotDiffRenderer->addModules( $output ); |
27 | } |
28 | |
29 | public function getExtraCacheKeys() { |
30 | return $this->textSlotDiffRenderer->getExtraCacheKeys(); |
31 | } |
32 | |
33 | public function getDiff( Content $oldContent = null, Content $newContent = null ) { |
34 | $this->normalizeContents( $oldContent, $newContent, [ JCContent::class ] ); |
35 | $format = JCContentHandler::CONTENT_FORMAT_JSON_PRETTY; |
36 | |
37 | $oldText = $oldContent->serialize( $format ); |
38 | $newText = $newContent->serialize( $format ); |
39 | |
40 | return $this->textSlotDiffRenderer->getTextDiff( $oldText, $newText ); |
41 | } |
42 | } |