1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is part of PHP-Task library. |
4
|
|
|
* |
5
|
|
|
* (c) php-task |
6
|
|
|
* |
7
|
|
|
* This source file is subject to the MIT license that is bundled |
8
|
|
|
* with this source code in the file LICENSE. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Task\FrequentTask; |
12
|
|
|
|
13
|
|
|
use Task\TaskInterface; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Extends Event with frequent operations. |
17
|
|
|
* |
18
|
|
|
* @author @wachterjohannes <[email protected]> |
19
|
|
|
*/ |
20
|
|
|
abstract class FrequentTask implements FrequentTaskInterface |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* @var TaskInterface |
24
|
|
|
*/ |
25
|
|
|
private $task; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var \DateTime |
29
|
|
|
*/ |
30
|
|
|
protected $start; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var \DateTime |
34
|
|
|
*/ |
35
|
|
|
protected $end; |
36
|
|
|
|
37
|
16 |
|
public function __construct(TaskInterface $task, \DateTime $start, \DateTime $end = null) |
38
|
|
|
{ |
39
|
16 |
|
$this->task = $task; |
40
|
16 |
|
$this->start = $start; |
41
|
16 |
|
$this->end = $end; |
42
|
16 |
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* {@inheritdoc} |
46
|
|
|
*/ |
47
|
4 |
|
public function getTaskName() |
48
|
|
|
{ |
49
|
4 |
|
return $this->task->getTaskName(); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* {@inheritdoc} |
54
|
|
|
*/ |
55
|
4 |
|
public function getKey() |
56
|
|
|
{ |
57
|
4 |
|
return $this->task->getKey(); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* {@inheritdoc} |
62
|
|
|
*/ |
63
|
2 |
|
public function setKey($key) |
64
|
|
|
{ |
65
|
2 |
|
$this->task->setKey($key); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* {@inheritdoc} |
70
|
|
|
*/ |
71
|
1 |
|
public function getWorkload() |
72
|
|
|
{ |
73
|
1 |
|
return $this->task->getWorkload(); |
74
|
1 |
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* {@inheritdoc} |
78
|
|
|
*/ |
79
|
1 |
|
public function isCompleted() |
80
|
|
|
{ |
81
|
1 |
|
return $this->task->isCompleted(); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* {@inheritdoc} |
86
|
|
|
*/ |
87
|
1 |
|
public function setCompleted() |
88
|
|
|
{ |
89
|
1 |
|
$this->task->setCompleted(); |
90
|
1 |
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* {@inheritdoc} |
94
|
|
|
*/ |
95
|
1 |
|
public function getResult() |
96
|
|
|
{ |
97
|
1 |
|
return $this->task->getResult(); |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* {@inheritdoc} |
102
|
|
|
*/ |
103
|
1 |
|
public function setResult($result) |
104
|
|
|
{ |
105
|
1 |
|
$this->task->setResult($result); |
106
|
1 |
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* {@inheritdoc} |
110
|
|
|
*/ |
111
|
1 |
|
public function getExecutionDate() |
112
|
|
|
{ |
113
|
1 |
|
return $this->task->getExecutionDate(); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* {@inheritdoc} |
118
|
|
|
*/ |
119
|
2 |
|
public function setExecutionDate(\DateTime $executionDate) |
120
|
|
|
{ |
121
|
2 |
|
$this->task->setExecutionDate($executionDate); |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* {@inheritdoc} |
126
|
|
|
*/ |
127
|
2 |
|
public function getUuid() |
128
|
|
|
{ |
129
|
2 |
|
return $this->task->getUuid(); |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* {@inheritdoc} |
134
|
|
|
*/ |
135
|
|
|
public function getStart() |
136
|
|
|
{ |
137
|
|
|
return $this->start; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* {@inheritdoc} |
142
|
|
|
*/ |
143
|
|
|
public function getEnd() |
144
|
|
|
{ |
145
|
|
|
return $this->end; |
146
|
|
|
} |
147
|
|
|
} |
148
|
|
|
|