Completed
Push — master ( e15c58...b150a8 )
by Changwan
07:08
created

SqsJob   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 47
ccs 0
cts 18
cp 0
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A read() 0 4 1
A delete() 0 7 1
1
<?php
2
namespace Wandu\Q\Job;
3
4
use Aws\Sqs\SqsClient;
5
use Wandu\Q\Contracts\JobInterface;
6
7
class SqsJob implements JobInterface
8
{
9
    /** @var \Aws\Sqs\SqsClient */
10
    protected $client;
11
12
    /** @var string */
13
    protected $url;
14
15
    /** @var string */
16
    protected $body;
17
18
    /** @var string */
19
    protected $handle;
20
21
    /**
22
     * @param \Aws\Sqs\SqsClient $client
23
     * @param string $url
24
     * @param string $handle
25
     * @param string $body
26
     */
27
    public function __construct(SqsClient $client, $url, $handle, $body)
28
    {
29
        $this->client = $client;
30
        $this->url = $url;
31
        $this->handle = $handle;
32
        $this->body = $body;
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function read()
39
    {
40
        return $this->body;
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function delete()
47
    {
48
        return $this->client->deleteMessage([
49
            'QueueUrl'  => $this->url,
50
            'ReceiptHandle' => $this->handle,
51
        ]);
52
    }
53
}
54