blob: 8bb68e8a8ee3e40f4bade5ccc234cc0c918e9c0d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
<?php
namespace PHPIAC;
use PHPIAC\Module\ModuleInterface;
class Task
{
public string $name = '';
public ModuleInterface $module;
/**
* Task constructor.
*/
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
*/
public function setModule(ModuleInterface $module): self
{
$this->module = $module;
return $this;
}
}
|