Completed
Push — master ( e91b2f...f5a28e )
by Phil
02:51
created

Job::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace ResqueBundle\Resque;
4
5
/**
6
 * Class Job
7
 * @package ResqueBundle\Resque
8
 */
9
abstract class Job
10
{
11
    /**
12
     * @var \Resque_Job
13
     */
14
    public $job;
15
16
    /**
17
     * @var string The queue name
18
     */
19
    public $queue = 'default';
20
21
    /**
22
     * @var array The job args
23
     */
24
    public $args = [];
25
26
    /**
27
     * Job constructor.
28
     * @param array $args The Job Arguments
29
     */
30
    public function __construct($args = [])
31
    {
32
        $this->args = $args;
33
    }
34
35
    /**
36
     * @return string
37
     */
38
    public function getName()
39
    {
40
        return \get_class($this);
41
    }
42
43
    /**
44
     * Default function used to set up, can be overloaded by individual Jobs
45
     * @todo test - I dont think this method is actually used?
46
     */
47
    public function setUp()
48
    {
49
50
    }
51
52
    /**
53
     * @todo test - I dont think this method is actually used?
54
     */
55
    public function perform()
56
    {
57
        $this->run($this->args);
58
    }
59
60
    /**
61
     * This is the method that is called when the job is run
62
     *
63
     * @param $args
64
     * @return mixed
65
     */
66
    abstract public function run($args);
67
68
    /**
69
     * Default function used to tear down, can be overloaded by individual Jobs
70
     * @todo test - I dont think this method is actually used?
71
     */
72
    public function tearDown()
73
    {
74
75
    }
76
}
77