summaryrefslogtreecommitdiff
path: root/src/Task.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Task.php')
-rw-r--r--src/Task.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Task.php b/src/Task.php
index a5698ea..8bb68e8 100644
--- a/src/Task.php
+++ b/src/Task.php
@@ -6,6 +6,7 @@ use PHPIAC\Module\ModuleInterface;
class Task
{
+ public string $name = '';
public ModuleInterface $module;
/**
@@ -14,6 +15,34 @@ class Task
public function __construct() {}
/**
+ * @param string $name
+ *
+ * @return $this
+ */
+ public function setName(string $name): self
+ {
+ $this->name = $name;
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getName(): string
+ {
+ if (! empty($this->name)) {
+ return $this->name;
+ }
+
+ $moduleReflection = new \ReflectionClass($this->module);
+ $firstProperty = $moduleReflection->getProperties()[0];
+ $firstProperty->setAccessible(true);
+
+ return $moduleReflection->getShortName() . ' - ' . $firstProperty->getValue($this->module);
+ }
+
+ /**
* @param ModuleInterface $module
*
* @return $this