1 | <?php |
||
20 | class Task implements TaskInterface |
||
21 | { |
||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $uuid; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $taskName; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | private $key; |
||
36 | |||
37 | /** |
||
38 | * @var string|\Serializable |
||
39 | */ |
||
40 | private $workload; |
||
41 | |||
42 | /** |
||
43 | * @var \DateTime |
||
44 | */ |
||
45 | private $executionDate; |
||
46 | |||
47 | /** |
||
48 | * @var bool |
||
49 | */ |
||
50 | private $completed = false; |
||
51 | |||
52 | /** |
||
53 | * @var string|\Serializable |
||
54 | */ |
||
55 | private $result; |
||
56 | |||
57 | 9 | public function __construct($taskName, $workload, $uuid = null) |
|
58 | { |
||
59 | 9 | $this->uuid = $uuid ?: Uuid::uuid4()->toString(); |
|
60 | 9 | $this->taskName = $taskName; |
|
61 | 9 | $this->workload = $workload; |
|
62 | 9 | $this->executionDate = new \DateTime(); |
|
63 | 9 | } |
|
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | public function getUuid() |
||
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | */ |
||
76 | 7 | public function getTaskName() |
|
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | */ |
||
84 | 1 | public function getKey() |
|
88 | |||
89 | /** |
||
90 | * {@inheritdoc} |
||
91 | */ |
||
92 | 1 | public function setKey($key) |
|
93 | { |
||
94 | 1 | $this->key = $key; |
|
95 | |||
96 | 1 | return $this; |
|
97 | } |
||
98 | |||
99 | /** |
||
100 | * {@inheritdoc} |
||
101 | */ |
||
102 | 7 | public function getWorkload() |
|
106 | |||
107 | /** |
||
108 | * {@inheritdoc} |
||
109 | */ |
||
110 | public function isCompleted() |
||
114 | |||
115 | /** |
||
116 | * {@inheritdoc} |
||
117 | */ |
||
118 | public function setCompleted() |
||
122 | |||
123 | /** |
||
124 | * {@inheritdoc} |
||
125 | */ |
||
126 | public function getResult() |
||
130 | |||
131 | /** |
||
132 | * {@inheritdoc} |
||
133 | */ |
||
134 | public function setResult($result) |
||
138 | |||
139 | /** |
||
140 | * {@inheritdoc} |
||
141 | */ |
||
142 | 1 | public function getExecutionDate() |
|
146 | |||
147 | /** |
||
148 | * {@inheritdoc} |
||
149 | */ |
||
150 | 1 | public function setExecutionDate(\DateTime $executionDate) |
|
154 | } |
||
155 |