Completed
Push — master ( 9eae13...e56856 )
by Antonio
04:26
created

SqsMailJob::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace Da\Mailer\Queue\Backend\Sqs;
3
4
use BadMethodCallException;
5
use Da\Mailer\Event\EventHandlerTrait;
6
use Da\Mailer\Model\MailJob;
7
use Da\Mailer\Model\MailMessage;
8
9
class SqsMailJob extends MailJob
10
{
11
    use EventHandlerTrait;
12
    /**
13
     * @var string
14
     */
15
    private $receiptHandle;
16
    /**
17
     * @var MailMessage|string the message to store
18
     */
19
    private $message;
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $message is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
20
    /**
21
     * @var int
22
     */
23
    private $delaySeconds;
24
    /**
25
     * @var int between 0 and 900 seconds
26
     */
27
    private $visibilityTimeout;
28
    /**
29
     * @var bool
30
     */
31
    private $deleted = false;
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 4
    public function __construct(array $config = [])
37
    {
38 4
        parent::__construct($config);
39 4
    }
40
41
    /**
42
     * @return bool
43
     */
44 3
    public function isNewRecord()
45
    {
46 3
        return $this->getId() === null || $this->receiptHandle === null;
47
    }
48
49
    /**
50
     * @return string
51
     */
52 2
    public function getReceiptHandle()
53
    {
54 2
        return $this->receiptHandle;
55
    }
56
57
    /**
58
     * @param string $receiptHandle
59
     */
60 3
    public function setReceiptHandle($receiptHandle)
61
    {
62 3
        $this->receiptHandle = $receiptHandle;
63 3
    }
64
65
    /**
66
     * @return int
67
     */
68 4
    public function getDelaySeconds()
69
    {
70 4
        return $this->delaySeconds;
71
    }
72
73
    /**
74
     * @param int $delaySeconds
75
     */
76 1
    public function setDelaySeconds($delaySeconds)
77
    {
78 1
        if ($delaySeconds < 0 || $delaySeconds > 900) {
79 1
            throw new BadMethodCallException('Delay seconds must be between 0 and 900 seconds interval');
80
        }
81 1
        $this->delaySeconds = $delaySeconds;
82 1
    }
83
84
    /**
85
     * @return int
86
     */
87 2
    public function getVisibilityTimeout()
88
    {
89 2
        return $this->visibilityTimeout;
90
    }
91
92
    /**
93
     * @param int $visibilityTimeout
94
     */
95 1
    public function setVisibilityTimeout($visibilityTimeout)
96
    {
97 1
        $this->visibilityTimeout = $visibilityTimeout;
98 1
    }
99
100
    /**
101
     * @return bool
102
     */
103 3
    public function getDeleted()
104
    {
105 3
        return $this->deleted;
106
    }
107
108
    /**
109
     * @param bool $deleted
110
     */
111 1
    public function setDeleted($deleted)
112
    {
113 1
        $this->deleted = $deleted;
114 1
    }
115
}
116