Completed
Push — master ( 8a247e...4109b7 )
by Matthew
05:12
created

Job::setDeliveryTag()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Dtc\QueueBundle\RabbitMQ;
4
5
class Job extends \Dtc\QueueBundle\Model\MessageableJob
6
{
7
    protected $deliveryTag;
8
9
    /**
10
     * @return string
11
     */
12
    public function getDeliveryTag()
13
    {
14
        return $this->deliveryTag;
15
    }
16
17
    /**
18
     * @param mixed $deliveryTag
19
     */
20
    public function setDeliveryTag($deliveryTag)
21
    {
22
        $this->deliveryTag = $deliveryTag;
23
    }
24
25
    /**
26
     * @return string A json_encoded version of a queueable version of the object
27
     */
28
    public function toMessage()
29
    {
30
        $arr = $this->toMessageArray();
31
        $arr['id'] = $this->getId();
32
33
        return json_encode($arr);
34
    }
35
36
    /**
37
     * @param string $message a json_encoded version of the object
38
     */
39
    public function fromMessage($message)
40
    {
41
        $arr = json_decode($message, true);
42
        if (is_array($arr)) {
43
            $this->fromMessageArray($arr);
44
            if (isset($arr['id'])) {
45
                $this->setId($arr['id']);
46
            }
47
        }
48
    }
49
}
50