Job   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 54
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 1

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A execute() 0 4 1
run() 0 1 ?
A getJobName() 0 4 1
A getClassName() 0 4 1
A getArgs() 0 4 1
1
<?php
2
namespace Tavii\SQSJobQueue\Job;
3
use Tavii\SQSJobQueue\Queue\QueueName;
4
5
/**
6
 * Class Job
7
 * @package SQSJobQueue\Job
8
 */
9
abstract class Job implements JobInterface
10
{
11
    /**
12
     * @var array
13
     */
14
    protected $args;
15
16
    /**
17
     * @param array $args
18
     */
19
    public function __construct(array $args = array())
20
    {
21
        $this->args = $args;
22
    }
23
24
    /**
25
     * @return bool
26
     */
27
    public function execute()
28
    {
29
        return $this->run();
30
    }
31
32
    /**
33
     * @return boolean
34
     */
35
    abstract protected function run();
36
37
    /**
38
     * @return QueueName
39
     */
40
    public function getJobName()
41
    {
42
        return new QueueName($this->getName(), $this->getPrefix());
43
    }
44
45
    /**
46
     * get job name
47
     * @return string
48
     */
49
    public function getClassName()
50
    {
51
        return get_class($this);
52
    }
53
54
    /**
55
     * get args
56
     * @return array
57
     */
58
    public function getArgs()
59
    {
60
        return $this->args;
61
    }
62
}