| 1 | <?php |
||
| 19 | class CronJob |
||
| 20 | { |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var string |
||
| 24 | */ |
||
| 25 | private $uid; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var int |
||
| 29 | */ |
||
| 30 | private $due; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @var callable |
||
| 34 | */ |
||
| 35 | private $func; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Constructor |
||
| 39 | * |
||
| 40 | * @param string $uid unique ID for cron job |
||
| 41 | * @param string $due due intervall |
||
| 42 | * @param callable $func cron job |
||
| 43 | */ |
||
| 44 | public function __construct(string $uid, string $due, callable $func) |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Get the value of uid |
||
| 59 | * |
||
| 60 | * @return string |
||
| 61 | */ |
||
| 62 | public function getUid(): string |
||
| 66 | |||
| 67 | /** |
||
| 68 | * When should the job be next executed |
||
| 69 | * |
||
| 70 | * @return int UNIX-timestamp |
||
| 71 | */ |
||
| 72 | public function getDue(): int |
||
| 76 | |||
| 77 | /** |
||
| 78 | * Execute cron job |
||
| 79 | * |
||
| 80 | * @return void |
||
| 81 | */ |
||
| 82 | public function execute(): void |
||
| 93 | } |
||
| 94 |