| Total Complexity | 10 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | abstract class Task |
||
| 8 | { |
||
| 9 | use SerializesModels; |
||
|
|
|||
| 10 | |||
| 11 | /** |
||
| 12 | * The number of seconds before the task should be delayed. |
||
| 13 | * |
||
| 14 | * @var int|null |
||
| 15 | */ |
||
| 16 | protected $delay; |
||
| 17 | |||
| 18 | public function delay($delay) |
||
| 19 | { |
||
| 20 | if ($delay <= 0) { |
||
| 21 | throw new \InvalidArgumentException('The delay must be greater than 0'); |
||
| 22 | } |
||
| 23 | if ($delay >= 86400) { |
||
| 24 | throw new \InvalidArgumentException('The max delay is 86400s'); |
||
| 25 | } |
||
| 26 | $this->delay = $delay; |
||
| 27 | return $this; |
||
| 28 | } |
||
| 29 | |||
| 30 | public function getDelay() |
||
| 33 | } |
||
| 34 | |||
| 35 | abstract public function handle(); |
||
| 36 | |||
| 37 | public static function deliver(self $task, $bySendMessage = false) |
||
| 64 | } |