Made minor clean-up
This commit is contained in:
@ -1,6 +1,10 @@
|
||||
<?PHP
|
||||
/**
|
||||
* Generic collection of functions used in CSVXML.
|
||||
*
|
||||
* @file
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
|
||||
@ -164,9 +168,9 @@ function generateHelpTooltip(string $identifier, string $title, string $explica,
|
||||
*
|
||||
* @param DOMDocument $xmlDoc XML object.
|
||||
*
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function printDOMDocToXML(DOMDocument $xmlDoc) {
|
||||
function printDOMDocToXML(DOMDocument $xmlDoc):string {
|
||||
|
||||
return '<?xml version="1.0" encoding="UTF-8"?>' . $xmlDoc->saveXML($xmlDoc->documentElement);
|
||||
|
||||
@ -187,9 +191,8 @@ function createTextDomElement(DOMDocument $xmlDoc, string $tag, string $content)
|
||||
$element = $xmlDoc->createElement($tag);
|
||||
}
|
||||
catch (DOMException $e) {
|
||||
print_r($e);
|
||||
print_r($tag);
|
||||
exit;
|
||||
echo "Error at " . __FILE__ . ", line #" . __LINE__;
|
||||
exit;
|
||||
}
|
||||
|
||||
$element->appendChild($xmlDoc->createTextNode($content));
|
||||
@ -213,7 +216,14 @@ function getBlankRecordChannel():array {
|
||||
|
||||
}
|
||||
|
||||
function rrmdir($dir) {
|
||||
/**
|
||||
* Function for removing a directory with all its contents.
|
||||
*
|
||||
* @param string $dir File path of the directory to remove.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function rrmdir(string $dir) {
|
||||
if (is_dir($dir)) {
|
||||
$objects = scandir($dir);
|
||||
foreach ($objects as $object) {
|
||||
@ -226,3 +236,18 @@ function rrmdir($dir) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for checking if two arrays have identical values / contents.
|
||||
*
|
||||
* @param array $arrayA First array to compare.
|
||||
* @param array $arrayB Second array to compare.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function identical_values(array $arrayA, array $arrayB):bool {
|
||||
sort($arrayA);
|
||||
sort($arrayB);
|
||||
return $arrayA == $arrayB;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user