Queue::setAdapter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Corley\Queue;
4
5
class Queue
6
{
7
    private $name;
8
    private $adapter;
9
10 6
    public function __construct($queueName, QueueInterface $adapter)
11
    {
12 6
        $this->setName($queueName);
13 6
        $this->setAdapter($adapter);
14 6
    }
15
16 6
    protected function setName($name)
17
    {
18 6
        $this->name = $name;
19 6
        return $this;
20
    }
21
22 6
    protected function setAdapter(QueueInterface $adapter)
23
    {
24 6
        $this->adapter = $adapter;
25 6
        return $this;
26
    }
27
28 6
    public function getName()
29
    {
30 6
        return $this->name;
31
    }
32
33 6
    public function getAdapter()
34
    {
35 6
        return $this->adapter;
36
    }
37
38 2
    public function send($message, array $options = [])
39
    {
40 2
        return $this->getAdapter()->send($this->getName(), $message, $options);
41
    }
42
43 2
    public function receive(array $options = [])
44
    {
45 2
        return $this->getAdapter()->receive($this->getName(), $options);
46
    }
47
48 2
    public function delete($receipt, array $options = [])
49
    {
50 2
        return $this->getAdapter()->delete($this->getName(), $receipt, $options);
51
    }
52
53
}
54