Automated PR provided by Codex via Gitea API. Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #481
41 lines
927 B
PHP
41 lines
927 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\TenantConfiguration;
|
|
|
|
enum CoverageLevel: string
|
|
{
|
|
case Detected = 'detected';
|
|
case ContentBacked = 'content_backed';
|
|
case Comparable = 'comparable';
|
|
case Renderable = 'renderable';
|
|
case Restorable = 'restorable';
|
|
case Certified = 'certified';
|
|
|
|
/**
|
|
* @return list<string>
|
|
*/
|
|
public static function values(): array
|
|
{
|
|
return array_map(static fn (self $case): string => $case->value, self::cases());
|
|
}
|
|
|
|
public function rank(): int
|
|
{
|
|
return match ($this) {
|
|
self::Detected => 10,
|
|
self::ContentBacked => 20,
|
|
self::Comparable => 30,
|
|
self::Renderable => 40,
|
|
self::Restorable => 50,
|
|
self::Certified => 60,
|
|
};
|
|
}
|
|
|
|
public function meets(self $minimum): bool
|
|
{
|
|
return $this->rank() >= $minimum->rank();
|
|
}
|
|
}
|