Completed
Pull Request — master (#13)
by Antonio
07:54
created

SqsMailJob::getReceiptHandle()   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 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
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
    public function isNewRecord()
45
    {
46
        return $this->getId() === null || $this->receiptHandle === null;
47
    }
48
49
    /**
50
     * @return string
51
     */
52
    public function getReceiptHandle()
53
    {
54
        return $this->receiptHandle;
55
    }
56
57
    /**
58
     * @param string $receiptHandle
59
     */
60
    public function setReceiptHandle($receiptHandle)
61
    {
62
        $this->receiptHandle = $receiptHandle;
63
    }
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
    public function getVisibilityTimeout()
88
    {
89
        return $this->visibilityTimeout;
90
    }
91
92
    /**
93
     * @param int $visibilityTimeout
94
     */
95
    public function setVisibilityTimeout($visibilityTimeout)
96
    {
97
        $this->visibilityTimeout = $visibilityTimeout;
98
    }
99
100
    /**
101
     * @return bool
102
     */
103
    public function getDeleted()
104
    {
105
        return $this->deleted;
106
    }
107
108
    /**
109
     * @param bool $deleted
110
     */
111
    public function setDeleted($deleted)
112
    {
113
        $this->deleted = $deleted;
114
    }
115
}
116