Feature branch PR for Spec 114. This branch contains the merged agent session work (see merge commit on branch). Tests - `vendor/bin/sail artisan test --compact tests/Feature/System/Spec114/` Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #139
26 lines
746 B
PHP
26 lines
746 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\Badges\Domains;
|
|
|
|
use App\Support\Badges\BadgeCatalog;
|
|
use App\Support\Badges\BadgeMapper;
|
|
use App\Support\Badges\BadgeSpec;
|
|
|
|
final class SystemHealthBadge implements BadgeMapper
|
|
{
|
|
public function spec(mixed $value): BadgeSpec
|
|
{
|
|
$state = BadgeCatalog::normalizeState($value);
|
|
|
|
return match ($state) {
|
|
'ok' => new BadgeSpec('OK', 'success', 'heroicon-m-check-circle'),
|
|
'warn' => new BadgeSpec('Warn', 'warning', 'heroicon-m-exclamation-triangle'),
|
|
'critical' => new BadgeSpec('Critical', 'danger', 'heroicon-m-x-circle'),
|
|
'unknown' => BadgeSpec::unknown(),
|
|
default => BadgeSpec::unknown(),
|
|
};
|
|
}
|
|
}
|