mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-12-18 02:20:46 +00:00
Merge "Remove unused return values from MMLTestUtil"
This commit is contained in:
commit
4f39420988
|
@ -16,40 +16,22 @@ class MMLTestUtil {
|
||||||
if ( !file_exists( $filePath ) ) {
|
if ( !file_exists( $filePath ) ) {
|
||||||
throw new InvalidArgumentException( "No testfile found at specified path: " . $filePath );
|
throw new InvalidArgumentException( "No testfile found at specified path: " . $filePath );
|
||||||
}
|
}
|
||||||
$file = file_get_contents( $filePath );
|
return json_decode( file_get_contents( $filePath ) );
|
||||||
return json_decode( $file );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createJSONstartEnd( $start, $file ) {
|
public static function createJSONstartEnd( $start, $file ) {
|
||||||
if ( $start ) {
|
file_put_contents( $file, $start ? "[\n" : "\n]", FILE_APPEND );
|
||||||
$generated = "[\n";
|
|
||||||
} else {
|
|
||||||
$generated = "\n]";
|
|
||||||
}
|
|
||||||
if ( file_put_contents( $file, $generated, FILE_APPEND ) !== false ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function appendToJSONFile( $dataArray, $file ) {
|
public static function appendToJSONFile( $dataArray, $file ) {
|
||||||
$jsonData = json_encode( $dataArray, JSON_PRETTY_PRINT ) . ",";
|
$jsonData = json_encode( $dataArray, JSON_PRETTY_PRINT ) . ",";
|
||||||
|
file_put_contents( $file, $jsonData, FILE_APPEND );
|
||||||
if ( file_put_contents( $file, $jsonData, FILE_APPEND ) !== false ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function deleteFile( $file ) {
|
public static function deleteFile( $file ): void {
|
||||||
if ( file_exists( $file ) ) {
|
if ( file_exists( $file ) ) {
|
||||||
if ( unlink( $file ) ) {
|
unlink( $file );
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function prettifyXML( $xml, $replaceHeader = true ) {
|
public static function prettifyXML( $xml, $replaceHeader = true ) {
|
||||||
|
|
Loading…
Reference in a new issue