Completed
Push — master ( ec1ffe...1f9c3e )
by Ryota
02:11
created

Job   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

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
4
/**
5
 * Class Job
6
 * @package SQSJobQueue\Job
7
 */
8
abstract class Job implements JobInterface
9
{
10
    /**
11
     * @var array
12
     */
13
    protected $args;
14
15
    /**
16
     * @param array $args
17
     */
18
    public function __construct(array $args = array())
19
    {
20
        $this->args = $args;
21
    }
22
23
    /**
24
     * @return bool
25
     */
26
    public function execute()
27
    {
28
        return $this->run();
29
    }
30
31
    /**
32
     * @return boolean
33
     */
34
    abstract protected function run();
35
36
    /**
37
     * @return string
0 ignored issues
show
Documentation introduced by
Should the return type not be JobName?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
38
     */
39
    public function getJobName()
40
    {
41
        return new JobName($this->getName(), $this->getPrefix());
42
    }
43
44
    /**
45
     * get job name
46
     * @return string
47
     */
48
    public function getClassName()
49
    {
50
        return get_class($this);
51
    }
52
53
    /**
54
     * get args
55
     * @return array
56
     */
57
    public function getArgs()
58
    {
59
        return $this->args;
60
    }
61
}