Maybe have colour override working
This commit is contained in:
@@ -28,12 +28,16 @@ final class Badge
|
||||
{
|
||||
if (null !== $colour) {
|
||||
|
||||
$cases = array_map(fn(EnumBadge $b) => $b->name, EnumBadge::cases());
|
||||
$cases = array_map(fn(EnumBadge $b) => strtolower($b->name), EnumBadge::cases());
|
||||
|
||||
if (!in_array($colour, $cases)) {
|
||||
throw new \RuntimeException(sprintf('"%s" is not a valid Badge colour. Available options are: %s', $colour, implode(", ", $cases)));
|
||||
$formattedCases = implode(", ", array_map(fn(string $s) => '"'.$s.'"', $cases));
|
||||
throw new \RuntimeException(sprintf('"%s" is not a valid Badge colour. Available options are: %s', $colour, $formattedCases));
|
||||
}
|
||||
|
||||
$colour = strtoupper($colour);
|
||||
$palette = Badge::{$colour}->getPalette();
|
||||
|
||||
} else {
|
||||
$palette = $object->getBadgeColour()->getPalette();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user