Skip to content

Instantly share code, notes, and snippets.

@ermst4r
Created October 5, 2016 15:42
Show Gist options
  • Save ermst4r/4ccec079c9d209b563cf24d45fa18b48 to your computer and use it in GitHub Desktop.
Save ermst4r/4ccec079c9d209b563cf24d45fa18b48 to your computer and use it in GitHub Desktop.
taken
<?php
namespace tasks;
interface iTask {
/**
* Method to enqueue the task. This should take params and values from the class that implements the interface,
* given to the class by the constructor or other methods.
**/
public function enqueue();
/**
* Method needed for actually running, used by Resque
* Each job should be in it's own class, and include a `perform` method.
* class My_Job
* {
* public function perform()
* {
* // Work work work
* echo $this->args['name'];
* }
* }
*
* When the job is run, the class will be instantiated and any arguments
* will be set as an array on the instantiated object, and are accessible
* via `$this->args`.
*
* Any exception thrown by a job will result in the job failing - be
* careful here and make sure you handle the exceptions that shouldn't
* result in a job failing.
**/
public function perform();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment