MediaWiki
1.34.0
JSONReader.php
Go to the documentation of this file.
1
<?php
8
namespace
LocalisationUpdate
;
9
13
class
JSONReader
implements
Reader
{
15
protected
$code
;
16
17
public
function
__construct
( $code =
null
) {
18
$this->code = $code;
19
}
20
26
public
function
parse
( $contents ) {
27
$messages =
\FormatJson::decode
( $contents,
true
);
28
unset( $messages[
'@metadata'
] );
29
30
if
( $this->code ) {
31
return
[ $this->code => $messages ];
32
}
33
34
// Assuming that the array is keyed by language codes
35
return
$messages;
36
}
37
}
LocalisationUpdate\JSONReader\$code
$code
Definition:
JSONReader.php:15
LocalisationUpdate\JSONReader
Reads MediaWiki JSON i18n files.
Definition:
JSONReader.php:13
FormatJson\decode
static decode( $value, $assoc=false)
Decodes a JSON string.
Definition:
FormatJson.php:174
LocalisationUpdate\JSONReader\__construct
__construct( $code=null)
Definition:
JSONReader.php:17
LocalisationUpdate
Definition:
Fetcher.php:8
LocalisationUpdate\JSONReader\parse
parse( $contents)
Definition:
JSONReader.php:26
LocalisationUpdate\Reader
Interface for file readers.
Definition:
Reader.php:13
extensions
LocalisationUpdate
includes
reader
JSONReader.php
Generated on Thu Dec 19 2019 14:53:54 for MediaWiki by
1.8.16