26 lines
545 B
PHP
26 lines
545 B
PHP
<?php
|
|
|
|
class Diagnostics
|
|
{
|
|
public static function message(string $severity, string $source, string $text, string $code = ''): array
|
|
{
|
|
return [
|
|
'timestamp' => time(),
|
|
'severity' => $severity,
|
|
'source' => $source,
|
|
'text' => $text,
|
|
'code' => $code
|
|
];
|
|
}
|
|
|
|
public static function statusFromFlags(bool $online, bool $fault): string
|
|
{
|
|
if ($fault) {
|
|
return 'Stoerung';
|
|
}
|
|
return $online ? 'Online' : 'Offline';
|
|
}
|
|
}
|
|
|
|
?>
|