| 1 | <?php |
||
| 8 | class Task implements Message |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var string |
||
| 12 | */ |
||
| 13 | private $name; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var array |
||
| 17 | */ |
||
| 18 | private $body; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var int |
||
| 22 | */ |
||
| 23 | private $delay; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Task constructor. |
||
| 27 | * @param string $name |
||
| 28 | * @param array $body |
||
| 29 | * @param int $delay |
||
| 30 | */ |
||
| 31 | public function __construct($name, array $body, $delay=0) |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @return string |
||
| 41 | */ |
||
| 42 | public function getName() |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @return array |
||
| 49 | */ |
||
| 50 | public function getBody() |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @return int |
||
| 57 | */ |
||
| 58 | public function getDelay() |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @param $name |
||
| 65 | * @return $this |
||
| 66 | * @throws TaskException |
||
| 67 | */ |
||
| 68 | protected function setName($name) |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @param $delay |
||
| 79 | * @return $this |
||
| 80 | * @throws TaskException |
||
| 81 | */ |
||
| 82 | protected function setDelay($delay) |
||
| 90 | |||
| 91 | |||
| 92 | /** |
||
| 93 | * @return array |
||
| 94 | */ |
||
| 95 | public function jsonSerialize() |
||
| 103 | } |