| 1 | <?php |
||
| 10 | trait QueueableTrait |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * The queue ID. |
||
| 14 | * |
||
| 15 | * @var mixed $queueId |
||
| 16 | */ |
||
| 17 | private $queueId; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Set the queue's ID. |
||
| 21 | * |
||
| 22 | * @param string|null $id The unique queue identifier. |
||
| 23 | * @throws InvalidArgumentException If the ID isn't a string. |
||
| 24 | * @return self |
||
| 25 | */ |
||
| 26 | public function setQueueId($id) |
||
| 27 | { |
||
| 28 | if ($id === null) { |
||
| 29 | $this->queueId = null; |
||
| 30 | return $this; |
||
| 31 | } |
||
| 32 | |||
| 33 | if (!is_string($id)) { |
||
| 34 | throw new InvalidArgumentException( |
||
| 35 | 'Queue ID must be a string' |
||
| 36 | ); |
||
| 37 | } |
||
| 38 | |||
| 39 | $this->queueId = $id; |
||
| 40 | |||
| 41 | return $this; |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Get the queue's ID. |
||
| 46 | * |
||
| 47 | * @return string|null $queueId |
||
| 48 | */ |
||
| 49 | public function queueId() |
||
| 50 | { |
||
| 51 | return $this->queueId; |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Set the date/time to process the queue. |
||
| 56 | * |
||
| 57 | * @param mixed $ts A date/time to initiate the queue processing. |
||
| 58 | * @return mixed |
||
| 59 | */ |
||
| 60 | abstract public function queue($ts = null); |
||
| 61 | } |
||
| 62 |