Skip to content

Commit bb5c8d2

Browse files
committed
Add base Job class
1 parent 2b65f50 commit bb5c8d2

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

lib/Job/Job.php

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
3+
namespace Resque\Job;
4+
5+
use Resque\JobHandler;
6+
7+
/**
8+
* Base Resque Job class.
9+
*
10+
* @package Resque\Job
11+
* @author Heinz Wiesinger <[email protected]>
12+
* @license http://www.opensource.org/licenses/mit-license.php
13+
*/
14+
abstract class Job
15+
{
16+
/**
17+
* Job arguments
18+
* @var array
19+
*/
20+
public $args;
21+
22+
/**
23+
* Associated JobHandler instance
24+
* @var JobHandler
25+
*/
26+
public $job;
27+
28+
/**
29+
* Name of the queue the job was in
30+
* @var string
31+
*/
32+
public $queue;
33+
34+
/**
35+
* (Optional) Job setup
36+
*
37+
* @return void
38+
*/
39+
public function setUp(): void
40+
{
41+
// no-op
42+
}
43+
44+
/**
45+
* (Optional) Job teardown
46+
*
47+
* @return void
48+
*/
49+
public function tearDown(): void
50+
{
51+
// no-op
52+
}
53+
54+
/**
55+
* Main method of the Job
56+
*
57+
* @return mixed|void
58+
*/
59+
abstract public function perform();
60+
}

0 commit comments

Comments
 (0)