forked from Topface/schEDUler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SchedulerTask.php
72 lines (63 loc) · 1.37 KB
/
SchedulerTask.php
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
namespace Scheduler\Task;
class SchedulerTask implements SchedulerTaskInterface {
/**
* @var int
*/
private $runTime;
/**
* @var string
*/
private $taskId;
/**
* @var int
*/
private $typeId;
/**
* @var array
*/
private $context;
public function __construct(int $runTime, string $taskId, int $typeId, array $context = []) {
$this->runTime = $runTime;
$this->taskId = $taskId;
$this->typeId = $typeId;
$this->context = $context;
}
/**
* @inheritdoc
*/
public function getRunTime(): int {
return $this->runTime;
}
/**
* @inheritdoc
*/
public function getTaskId(): string {
return $this->taskId;
}
/**
* @inheritdoc
*/
public function getTypeId(): int {
return $this->typeId;
}
/**
* @inheritdoc
*/
public function getContext(): array {
return $this->context;
}
/**
* Возвращает массив с данными объекта (для десереализации)
*
* @return array
*/
public function toArray(): array {
return [
'run_time' => $this->runTime,
'task_id' => $this->taskId,
'type_id' => $this->typeId,
'context' => $this->context,
];
}
}