JobTrait   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 50
ccs 0
cts 18
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A setId() 0 5 1
A getHeader() 0 4 1
A setHeader() 0 5 1
1
<?php
2
3
/**
4
 * @author    Flipbox Factory
5
 * @copyright Copyright (c) 2017, Flipbox Digital
6
 * @link      https://github.com/flipbox/queue/releases/latest
7
 * @license   https://github.com/flipbox/queue/blob/master/LICENSE
8
 */
9
10
namespace flipbox\queue\jobs\traits;
11
12
use yii\helpers\ArrayHelper;
13
14
/**
15
 * @author Flipbox Factory <[email protected]>
16
 * @since 1.0.0
17
 */
18
trait JobTrait
19
{
20
    /**
21
     * The ID of the message. This should be set on the job receive.
22
     * @var integer
23
     */
24
    protected $id;
25
26
    /**
27
     * Stores the header.
28
     * This can be different for each queue provider.
29
     *
30
     * @var mixed
31
     */
32
    protected $header = [];
33
34
    /**
35
     * @inheritdoc
36
     */
37
    public function getId()
38
    {
39
        return $this->id;
40
    }
41
42
    /**
43
     * @inheritdoc
44
     */
45
    public function setId($id)
46
    {
47
        $this->id = $id;
48
        return $this;
49
    }
50
51
    /**
52
     * @inheritdoc
53
     */
54
    public function getHeader($item, $default = null)
55
    {
56
        return ArrayHelper::getValue($this->header, $item, $default);
57
    }
58
59
    /**
60
     * @inheritdoc
61
     */
62
    public function setHeader($item, $value)
63
    {
64
        $this->header[$item] = $value;
65
        return $this;
66
    }
67
}
68