Update readme

This commit is contained in:
brabli
2025-02-26 11:41:21 +00:00
parent 62e279e0c9
commit f0c19dad5e

View File

@@ -20,21 +20,21 @@ Create badges from objects or as standalone elements.
Any object that you would like to be able to be turned into a badge must implement `BadgeableInterface`. Any object that you would like to be able to be turned into a badge must implement `BadgeableInterface`.
This interface specifies a single method `getBadgeColour()` and is used to determine what colour the badge should be rendered as. This interface specifies a single method `getBadgeColour()` which expects an instance of the enum `BadgeColour` to be returned and is used to determine the colour of the rendered badge.
This method can contain as much logic in it as you'd like to return different colours of badge under different circumstances. EG: This method can contain as much logic in it as you'd like to return different colours of badge under different circumstances. EG:
```php ```php
// Job.php // Job.php
public function getBadgeColour(): Badge public function getBadgeColour(): BadgeColour
{ {
return match ($this->getKind()) { return match ($this->getKind()) {
JobKind::Investigation => Badge::BLUE, JobKind::Investigation => BadgeColour::BLUE,
JobKind::Interrogation => Badge::RED, JobKind::Interrogation => BadgeColour::RED,
JobKind::Shootout => Badge::BLACK, JobKind::Shootout => BadgeColour::BLACK,
JobKind::SipWhiskey => Badge::FOREST, JobKind::SipWhiskey => BadgeColour::FOREST,
default => Badge::GREY default => BadgeColour::GREY
}; };
} }
``` ```