summaryrefslogtreecommitdiff
path: root/src/Task.php
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2021-04-19 11:02:48 +0200
committerDaniel Weipert <code@drogueronin.de>2021-04-19 11:02:48 +0200
commit3983548e7c0f107fa7b7cc3c4c36aa009590b481 (patch)
tree071513d1c25459cb81dbf56e5acc5942424a732e /src/Task.php
parent671e3f1540f3a683d548dafd64c068ad6a64ac2f (diff)
Moves Modules to own package
Removes phar Renames bin 'n' stuff
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