Passed
Branch master (74fab5)
by Kunal
03:19
created

RabbitMQExchange::getConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Kunnu\RabbitMQ;
4
5
use Illuminate\Support\Collection;
6
7
class RabbitMQExchange
8
{
9
    /**
10
     * Exchange name.
11
     *
12
     * @var string $name
13
     */
14
    protected string $name;
15
16
    /**
17
     * Exchange config.
18
     *
19
     * @var Collection $config
20
     */
21
    protected Collection $config;
22
23
    /**
24
     * Create a new RabbitMQ Exchange instance.
25
     *
26
     * @param string $name
27
     * @param array $config
28
     */
29
    public function __construct(string $name, array $config = [])
30
    {
31
        $this
32
            ->setName($name)
33
            ->setConfig($config);
34
    }
35
36
    /**
37
     * Get Exchange name.
38
     *
39
     * @return string
40
     */
41
    public function getName(): string
42
    {
43
        return $this->name;
44
    }
45
46
    /**
47
     * Set Exchange name.
48
     *
49
     * @param string $name
50
     *
51
     * @return RabbitMQExchange
52
     */
53
    public function setName(string $name): self
54
    {
55
        $this->name = $name;
56
57
        return $this;
58
    }
59
60
    /**
61
     * Get Exchange Config.
62
     *
63
     * @return Collection
64
     */
65
    public function getConfig(): Collection
66
    {
67
        return $this->config;
68
    }
69
70
    /**
71
     * Set Exchange config.
72
     *
73
     * @param array $config
74
     *
75
     * @return RabbitMQExchange
76
     */
77
    public function setConfig(array $config): self
78
    {
79
        $this->config = new Collection($config);
80
81
        return $this;
82
    }
83
}
84