1 | <?php |
||
2 | |||
3 | namespace Kunnu\RabbitMQ; |
||
4 | |||
5 | use Illuminate\Support\Collection; |
||
6 | |||
7 | class ConnectionConfig extends Collection |
||
8 | { |
||
9 | /** |
||
10 | * Create a new ConnectionConfig instance. |
||
11 | * |
||
12 | * @param array $config |
||
13 | */ |
||
14 | public function __construct(array $config = null) |
||
15 | { |
||
16 | parent::__construct($config); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
17 | } |
||
18 | |||
19 | /** |
||
20 | * Get connection host. |
||
21 | * |
||
22 | * @return string|null |
||
23 | */ |
||
24 | public function getHost(): ?string |
||
25 | { |
||
26 | return $this->get('host', '127.0.0.1'); |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Get connection port. |
||
31 | * |
||
32 | * @return int|null |
||
33 | */ |
||
34 | public function getPort(): ?int |
||
35 | { |
||
36 | return $this->get('port', 5672); |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * Get connection user. |
||
41 | * |
||
42 | * @return string|null |
||
43 | */ |
||
44 | public function getUser(): ?string |
||
45 | { |
||
46 | return $this->get('username', ''); |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * Get connection password. |
||
51 | * |
||
52 | * @return string|null |
||
53 | */ |
||
54 | public function getPassword(): ?string |
||
55 | { |
||
56 | return $this->get('password', ''); |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * Get connection vhost. |
||
61 | * |
||
62 | * @return string|null |
||
63 | */ |
||
64 | public function getVhost(): ?string |
||
65 | { |
||
66 | return $this->get('vhost', '/'); |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * Get connection SSL options. |
||
71 | * |
||
72 | * @return array|null |
||
73 | */ |
||
74 | public function getSSLOptions(): ?array |
||
75 | { |
||
76 | return $this->get('ssl_options', []); |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * Get connection options. |
||
81 | * |
||
82 | * @return array|null |
||
83 | */ |
||
84 | public function getOptions(): ?array |
||
85 | { |
||
86 | return $this->get('options', []); |
||
87 | } |
||
88 | |||
89 | /** |
||
90 | * Get connection SSL protocol. |
||
91 | * |
||
92 | * @return string|null |
||
93 | */ |
||
94 | public function getSSLProtocol(): ?string |
||
95 | { |
||
96 | return $this->get('ssl_protocol', 'ssl'); |
||
97 | } |
||
98 | } |
||
99 |