Job   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 140
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 12
lcom 0
cbo 0
dl 0
loc 140
rs 10
c 0
b 0
f 0

12 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A setId() 0 4 1
A getAttempts() 0 4 1
A setAttempts() 0 4 1
A getQueue() 0 4 1
A setQueue() 0 4 1
A isReserved() 0 4 1
A setReserved() 0 4 1
A getReservedAt() 0 4 1
A setReservedAt() 0 4 1
A getPayload() 0 4 1
A setPayload() 0 4 1
1
<?php
2
3
namespace SfCod\QueueBundle\Entity;
4
5
/**
6
 * Class Job
7
 * Job entity, which represents data from any storage/database
8
 *
9
 * @author Virchenko Maksim <[email protected]>
10
 *
11
 * @package SfCod\QueueBundle\Entity
12
 */
13
class Job
14
{
15
    /**
16
     * Unique job id
17
     *
18
     * @var string|int
19
     */
20
    protected $id;
21
22
    /**
23
     * Job attempts
24
     *
25
     * @var int
26
     */
27
    protected $attempts;
28
29
    /**
30
     * Name of job's queue
31
     *
32
     * @var string
33
     */
34
    protected $queue;
35
36
    /**
37
     * Job reserved flag
38
     *
39
     * @var bool
40
     */
41
    protected $reserved;
42
43
    /**
44
     * Job reserved at time
45
     *
46
     * @var int
47
     */
48
    protected $reservedAt;
49
50
    /**
51
     * Job's payload data
52
     *
53
     * @var array
54
     */
55
    protected $payload = [];
56
57
    /**
58
     * @return int|string
59
     */
60
    public function getId()
61
    {
62
        return $this->id;
63
    }
64
65
    /**
66
     * @param int|string $id
67
     */
68
    public function setId($id)
69
    {
70
        $this->id = $id;
71
    }
72
73
    /**
74
     * @return int
75
     */
76
    public function getAttempts(): int
77
    {
78
        return $this->attempts;
79
    }
80
81
    /**
82
     * @param int $attempts
83
     */
84
    public function setAttempts(int $attempts)
85
    {
86
        $this->attempts = $attempts;
87
    }
88
89
    /**
90
     * @return string
91
     */
92
    public function getQueue(): string
93
    {
94
        return $this->queue;
95
    }
96
97
    /**
98
     * @param string $queue
99
     */
100
    public function setQueue(string $queue)
101
    {
102
        $this->queue = $queue;
103
    }
104
105
    /**
106
     * @return bool
107
     */
108
    public function isReserved(): bool
109
    {
110
        return $this->reserved;
111
    }
112
113
    /**
114
     * @param bool $reserved
115
     */
116
    public function setReserved(bool $reserved)
117
    {
118
        $this->reserved = $reserved;
119
    }
120
121
    /**
122
     * @return int|null
123
     */
124
    public function getReservedAt(): ?int
125
    {
126
        return $this->reservedAt;
127
    }
128
129
    /**
130
     * @param int|null $reservedAt
131
     */
132
    public function setReservedAt(?int $reservedAt)
133
    {
134
        $this->reservedAt = $reservedAt;
135
    }
136
137
    /**
138
     * @return array
139
     */
140
    public function getPayload(): array
141
    {
142
        return $this->payload;
143
    }
144
145
    /**
146
     * @param array $payload
147
     */
148
    public function setPayload(array $payload)
149
    {
150
        $this->payload = $payload;
151
    }
152
}
153