diff options
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; + } } |