Resque\Job::__construct PHP Method

__construct() public method

Create a new job
public __construct ( string $queue, string $id, string $class, array $data = null )
$queue string Queue to add job to
$id string Job id
$class string Job class to run
$data array Any Job data
    public function __construct($queue, $id, $class, array $data = null)
    {
        $this->redis = Redis::instance();
        if (!is_string($queue) or empty($queue)) {
            throw new \InvalidArgumentException('The Job queue "(' . gettype($queue) . ')' . $queue . '" must a non-empty string');
        }
        $this->queue = $queue;
        $this->id = $id;
        $this->data = $data;
        if ($class instanceof Closure) {
            $this->class = 'Resque\\Helpers\\ClosureJob';
            $this->data = $class;
        } else {
            $this->class = $class;
            if (strpos($this->class, '@')) {
                list($this->class, $this->method) = explode('@', $this->class, 2);
            }
            // Remove any spaces or back slashes
            $this->class = trim($this->class, '\\ ');
        }
        $this->payload = $this->createPayload();
        Event::fire(Event::JOB_INSTANCE, $this);
    }