18 lines
419 B
PHP
18 lines
419 B
PHP
<?php
|
|
|
|
class Util
|
|
{
|
|
static function removeIllegalCharacters($string): string
|
|
{
|
|
return preg_replace("/[^a-zA-Z0-9_-]/", "", $string);
|
|
}
|
|
|
|
static function parseJsonFromFile($filename): mixed
|
|
{
|
|
$file = fopen($filename, "r") or die("Unable to open file!");
|
|
$fileContent = fread($file, filesize($filename));
|
|
fclose($file);
|
|
|
|
return json_decode($fileContent);
|
|
}
|
|
} |