chore: code cleanup
This commit is contained in:
1 parent
1a3640b15c
commit
5a01054b0e
65 files changed
+1046
-795
No files matched your search
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Enum;
|
||||
|
||||
/**
|
||||
* The kinds of thing that can be booked.
|
||||
*
|
||||
* **This enum is the extension point.** The dashboard builds one tile per case, the board route
|
||||
* accepts one backing value per case, and the floor plan is looked up by convention from that
|
||||
* same value. Adding a third bookable kind is therefore: a case here, a
|
||||
* `templates/board/plan/_<value>.html.twig` with its geometry, and rows in `app:seed`. Nothing
|
||||
* else needs editing — in particular no template lists the kinds by hand.
|
||||
*
|
||||
* The backing value is both what is persisted in `resource.type` and what appears in a URL, so
|
||||
* there is no slug mapping to keep in sync. The label, plural and description are the only
|
||||
* things here anyone sees, which is why they are the only German ones.
|
||||
*/
|
||||
enum ResourceType: string
|
||||
{
|
||||
case DESK = 'desk';
|
||||
case PARKING = 'parking';
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::DESK => 'Schreibtisch',
|
||||
self::PARKING => 'Parkplatz',
|
||||
};
|
||||
}
|
||||
|
||||
public function plural(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::DESK => 'Schreibtische',
|
||||
self::PARKING => 'Parkplätze',
|
||||
};
|
||||
}
|
||||
|
||||
public function description(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::DESK => 'Einen Platz im Büro reservieren.',
|
||||
self::PARKING => 'Einen Stellplatz reservieren.',
|
||||
};
|
||||
}
|
||||
|
||||
public function icon(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::DESK => 'lucide:armchair',
|
||||
self::PARKING => 'lucide:car',
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user