diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-01-11 13:15:02 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-01-11 13:15:02 +0100 |
commit | 09caff2b2a06d1f8ac8203567035a21c612165f9 (patch) | |
tree | 999be04ff0a418a33e438be9befc8c9297e383f4 /src/Support | |
parent | 6301f63bd348109b8693a922f02e16d49205a8fd (diff) |
send resources
Diffstat (limited to 'src/Support')
-rw-r--r-- | src/Support/ResourceType.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Support/ResourceType.php b/src/Support/ResourceType.php index 96c0f2c..3583824 100644 --- a/src/Support/ResourceType.php +++ b/src/Support/ResourceType.php @@ -8,4 +8,21 @@ enum ResourceType: string case Clay = 'Clay'; case Iron = 'Iron'; case Food = 'Food'; + + public static function asProperties(): array + { + return array_map(function (ResourceType $case) { + return strtolower($case->value); + }, self::cases()); + } + + public static function asPropertiesForBuildings(): array + { + $resourceTypes = self::asProperties(); + $resourceTypes = array_filter($resourceTypes, function ($resourceType) { + return $resourceType !== strtolower(self::Food->value); + }); + + return $resourceTypes; + } } |