summaryrefslogtreecommitdiff
path: root/src/Support
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-09-24 13:40:25 +0200
committerDaniel Weipert <code@drogueronin.de>2023-09-24 13:40:25 +0200
commitfa00b957378a393f8edbfc98ef111d35d18ecb09 (patch)
tree654e7dc5414f7f2795dbe996d3e1570793a5b1b8 /src/Support
initial commit
Diffstat (limited to 'src/Support')
-rw-r--r--src/Support/ResourceType.php11
-rw-r--r--src/Support/RouteLoader.php24
-rw-r--r--src/Support/UnitType.php11
3 files changed, 46 insertions, 0 deletions
diff --git a/src/Support/ResourceType.php b/src/Support/ResourceType.php
new file mode 100644
index 0000000..96c0f2c
--- /dev/null
+++ b/src/Support/ResourceType.php
@@ -0,0 +1,11 @@
+<?php
+
+namespace App\Support;
+
+enum ResourceType: string
+{
+ case Wood = 'Wood';
+ case Clay = 'Clay';
+ case Iron = 'Iron';
+ case Food = 'Food';
+}
diff --git a/src/Support/RouteLoader.php b/src/Support/RouteLoader.php
new file mode 100644
index 0000000..ba124c5
--- /dev/null
+++ b/src/Support/RouteLoader.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace App\Support;
+
+use Symfony\Component\Routing\Loader\AnnotationClassLoader;
+use Symfony\Component\Routing\Route;
+
+class RouteLoader extends AnnotationClassLoader
+{
+ protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annotation) {
+ $route->setDefault('_', compact('class', 'method', 'annotation'));
+ }
+
+ protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method)
+ {
+ $name = parent::getDefaultRouteName($class, $method);
+
+ return str_replace(
+ '_',
+ '.',
+ str_replace('app_controller_', '', $name)
+ );
+ }
+}
diff --git a/src/Support/UnitType.php b/src/Support/UnitType.php
new file mode 100644
index 0000000..5a53f24
--- /dev/null
+++ b/src/Support/UnitType.php
@@ -0,0 +1,11 @@
+<?php
+
+namespace App\Support;
+
+enum UnitType: string
+{
+ case WoodCutter = 'WoodCutter';
+ case PitWorker = 'PitWorker';
+ case Miner = 'Miner';
+ case Farmer = 'Farmer';
+}