Skip to content

Commit d602af7

Browse files
committed
📦 Add set_queue method to directly set queue data
1 parent cdd700a commit d602af7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

‎src/Task.php‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,26 @@ public function push_to_queue( $data ) {
123123
return $this;
124124
}
125125

126+
/**
127+
* Set the data for queue.
128+
*
129+
* Use this only if you have the data in correct format.
130+
* CAUTION: You should call Task::save() right after this
131+
* because this will replace the data in current queue.
132+
*
133+
* @param mixed $data Data to process.
134+
*
135+
* @since 1.0.2
136+
* @access public
137+
*
138+
* @return Task $this
139+
*/
140+
public function set_queue( $data ) {
141+
$this->data = $data;
142+
143+
return $this;
144+
}
145+
126146
/**
127147
* Save the process queue.
128148
*

0 commit comments

Comments
 (0)