Completed
Push — master ( 23e91d...042a18 )
by Cody
02:22
created

QueueConfig::isDurable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Ccovey\RabbitMQ\Config;
4
5
use PhpAmqpLib\Wire\AMQPTable;
6
7
class QueueConfig
8
{
9
    /**
10
     * @var array
11
     */
12
    private $configuration;
13
14 1
    public function __construct(array $configuration)
15
    {
16 1
        $this->configuration = $configuration;
17 1
    }
18
19 1
    public function getExchange() : string
20
    {
21 1
        return $this->configuration['exchange'] ?? '';
22
    }
23
24
    /**
25
     * @return null|AMQPTable
26
     */
27 1
    public function getAmqpTable()
28
    {
29 1
        $amqpTable = null;
30 1
        if (isset($this->configuration['amqp_table'])) {
31
            $amqpTable = new AMQPTable();
32
            foreach ($this->configuration['aqmp_table'] as $key => $tableParam) {
33
                $amqpTable->set($key, $tableParam);
34
            }
35
        }
36
37 1
        return $amqpTable;
38
    }
39
40 1
    public function isDurable() : bool
41
    {
42 1
        return $this->configuration['durable'] ?? true;
43
    }
44
45 1
    public function isExclusive() : bool
46
    {
47 1
        return $this->configuration['exclusive'] ?? false;
48
    }
49
50 1
    public function isAutoDelete() : bool
51
    {
52 1
        return $this->configuration['autoDelete'] ?? false;
53
    }
54
55 1
    public function isNoWait() : bool
56
    {
57 1
        return $this->configuration['noWait'] ?? false;
58
    }
59
60 1
    public function getTicket()
61
    {
62 1
        return $this->configuration['ticket'] ?? null;
63
    }
64
}
65