Dokumentation für Util.php hinzugefügt
This commit is contained in:
@@ -2,12 +2,22 @@
|
||||
|
||||
class Util
|
||||
{
|
||||
static function removeIllegalCharacters($string): string
|
||||
/**
|
||||
* Entfernt alle Zeichen außer A-Z, a-z, 0-9 sowie - und _
|
||||
* @param string $string Eingabe mit möglicherweise ungültigen Zeichen
|
||||
* @return string Eingabestring mit allen ungültigen Zeichen entfernt
|
||||
*/
|
||||
static function removeIllegalCharacters(string $string): string
|
||||
{
|
||||
return preg_replace("/[^a-zA-Z0-9_-]/", "", $string);
|
||||
}
|
||||
|
||||
static function parseJsonFromFile($filename): mixed
|
||||
/**
|
||||
* Öffnet eine Datei und gibt JSON-Inhalte als Array zurück
|
||||
* @param string $filename Dateipfad
|
||||
* @return mixed Array mit Key-Value Paaren
|
||||
*/
|
||||
static function parseJsonFromFile(string $filename): mixed
|
||||
{
|
||||
$file = fopen($filename, "r") or die("Unable to open file!");
|
||||
$fileContent = fread($file, filesize($filename));
|
||||
|
||||
Reference in New Issue
Block a user