Job::getJobName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
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
}