From 3983548e7c0f107fa7b7cc3c4c36aa009590b481 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Mon, 19 Apr 2021 11:02:48 +0200 Subject: Moves Modules to own package Removes phar Renames bin 'n' stuff --- src/Task.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/Task.php') 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; /** @@ -13,6 +14,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 * -- cgit v1.2.3