SqsEnvelope   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 72
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A unwrap() 0 4 1
A attempts() 0 4 1
A retry() 0 4 1
A getMessageId() 0 4 1
A getReceiptHandle() 0 4 1
1
<?php
2
namespace Spekkionu\PMG\Queue\Sqs\Envelope;
3
4
use PMG\Queue\Envelope;
5
6
class SqsEnvelope implements Envelope
7
{
8
    /**
9
     * @var string Message ID
10
     */
11
    private $message_id;
12
13
    /**
14
     * @var Envelope
15
     */
16
    private $wrapped;
17
18
    /**
19
     * @var string|null
20
     */
21
    private $receiptHandle;
22
23
    /**
24
     * @param string $message_id
25
     * @param Envelope $wrapped
26
     * @param string|null $receiptHandle
27
     */
28 8
    public function __construct($message_id, Envelope $wrapped, $receiptHandle = null)
29
    {
30 8
        $this->message_id = $message_id;
31 8
        $this->wrapped = $wrapped;
32 8
        $this->receiptHandle = $receiptHandle;
33 8
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38 1
    public function unwrap()
39
    {
40 1
        return $this->wrapped->unwrap();
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46 1
    public function attempts()
47
    {
48 1
        return $this->wrapped->attempts();
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     * Returns a clone of the wrapped envelope, not itself.
54
     */
55 1
    public function retry()
56
    {
57 1
        return $this->wrapped->retry();
58
    }
59
60
    /**
61
     * Returns message id
62
     * @return string
63
     */
64 3
    public function getMessageId()
65
    {
66 3
        return $this->message_id;
67
    }
68
69
    /**
70
     * Returns receipt handle
71
     * @return string|null
72
     */
73 2
    public function getReceiptHandle()
74
    {
75 2
        return $this->receiptHandle;
76
    }
77
}
78