SqsMailJob   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 105
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 105
ccs 27
cts 27
cp 1
rs 10
wmc 13

10 Methods

Rating   Name   Duplication   Size   Complexity  
A getDeleted() 0 3 1
A getReceiptHandle() 0 3 1
A __construct() 0 3 1
A getDelaySeconds() 0 3 1
A setDelaySeconds() 0 6 3
A setDeleted() 0 3 1
A setReceiptHandle() 0 3 1
A setVisibilityTimeout() 0 3 1
A isNewRecord() 0 3 2
A getVisibilityTimeout() 0 3 1
1
<?php
2
3
namespace Da\Mailer\Queue\Backend\Sqs;
4
5
use BadMethodCallException;
6
use Da\Mailer\Event\EventHandlerTrait;
7
use Da\Mailer\Model\MailJob;
8
use Da\Mailer\Model\MailMessage;
9
10
class SqsMailJob extends MailJob
11
{
12
    use EventHandlerTrait;
13
14
    /**
15
     * @var string
16
     */
17
    private $receiptHandle;
18
/**
19
     * @var MailMessage|string the message to store
20
     */
21
    private $message;
0 ignored issues
show
introduced by
The private property $message is not used, and could be removed.
Loading history...
22
/**
23
     * @var int
24
     */
25
    private $delaySeconds;
26
/**
27
     * @var int between 0 and 900 seconds
28
     */
29
    private $visibilityTimeout;
30
/**
31
     * @var bool
32
     */
33
    private $deleted = false;
34
/**
35
     * {@inheritdoc}
36 4
     */
37
    public function __construct(array $config = [])
38 4
    {
39 4
        parent::__construct($config);
40
    }
41
42
    /**
43
     * @return bool
44 3
     */
45
    public function isNewRecord()
46 3
    {
47
        return $this->getId() === null || $this->receiptHandle === null;
48
    }
49
50
    /**
51
     * @return string
52 2
     */
53
    public function getReceiptHandle()
54 2
    {
55
        return $this->receiptHandle;
56
    }
57
58
    /**
59
     * @param string $receiptHandle
60 3
     */
61
    public function setReceiptHandle($receiptHandle)
62 3
    {
63 3
        $this->receiptHandle = $receiptHandle;
64
    }
65
66
    /**
67
     * @return int
68 4
     */
69
    public function getDelaySeconds()
70 4
    {
71
        return $this->delaySeconds;
72
    }
73
74
    /**
75
     * @param int $delaySeconds
76 1
     */
77
    public function setDelaySeconds($delaySeconds)
78 1
    {
79 1
        if ($delaySeconds < 0 || $delaySeconds > 900) {
80
            throw new BadMethodCallException('Delay seconds must be between 0 and 900 seconds interval');
81 1
        }
82 1
        $this->delaySeconds = $delaySeconds;
83
    }
84
85
    /**
86
     * @return int
87 2
     */
88
    public function getVisibilityTimeout()
89 2
    {
90
        return $this->visibilityTimeout;
91
    }
92
93
    /**
94
     * @param int $visibilityTimeout
95 1
     */
96
    public function setVisibilityTimeout($visibilityTimeout)
97 1
    {
98 1
        $this->visibilityTimeout = $visibilityTimeout;
99
    }
100
101
    /**
102
     * @return bool
103 3
     */
104
    public function getDeleted()
105 3
    {
106
        return $this->deleted;
107
    }
108
109
    /**
110
     * @param bool $deleted
111 1
     */
112
    public function setDeleted($deleted)
113 1
    {
114 1
        $this->deleted = $deleted;
115
    }
116
}
117