1 | <?php |
||
2 | |||
3 | namespace Ola\RabbitMqAdminToolkitBundle; |
||
4 | |||
5 | use RabbitMq\ManagementApi\Client; |
||
6 | |||
7 | class VhostConfiguration |
||
8 | { |
||
9 | /** |
||
10 | * @var Client |
||
11 | */ |
||
12 | private $client; |
||
13 | |||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | private $name; |
||
18 | |||
19 | /** |
||
20 | * @var array |
||
21 | */ |
||
22 | private $configuration; |
||
23 | |||
24 | /** |
||
25 | * @var boolean |
||
26 | */ |
||
27 | private $deleteAllowed; |
||
28 | |||
29 | /** |
||
30 | * @param Client $client |
||
31 | * @param string $name |
||
32 | * @param array $configuration |
||
33 | * @param boolean $deleteAllowed |
||
34 | */ |
||
35 | 6 | public function __construct(Client $client, $name, array $configuration, $deleteAllowed) |
|
36 | { |
||
37 | 6 | $this->client = $client; |
|
38 | 6 | $this->name = $name; |
|
39 | 6 | $this->configuration = $configuration; |
|
40 | 6 | $this->deleteAllowed = $deleteAllowed; |
|
41 | 6 | } |
|
42 | |||
43 | /** |
||
44 | * @return Client |
||
45 | */ |
||
46 | 1 | public function getClient() |
|
47 | { |
||
48 | 1 | return $this->client; |
|
49 | } |
||
50 | |||
51 | /** |
||
52 | * @return string |
||
53 | */ |
||
54 | 1 | public function getName() |
|
55 | { |
||
56 | 1 | return $this->name; |
|
57 | } |
||
58 | |||
59 | /** |
||
60 | * @return array |
||
61 | */ |
||
62 | 2 | public function getConfiguration($key = null) |
|
63 | { |
||
64 | 2 | if (null !== $key && isset($this->configuration[$key])) { |
|
65 | 1 | return $this->configuration[$key]; |
|
66 | } |
||
67 | |||
68 | 1 | return $this->configuration; |
|
69 | } |
||
70 | |||
71 | /** |
||
72 | * @return boolean |
||
73 | */ |
||
74 | 2 | public function isDeleteAllowed() |
|
75 | { |
||
76 | 2 | if (isset($this->configuration['delete_allowed'])) { |
|
77 | 1 | return $this->configuration['delete_allowed']; |
|
78 | } |
||
79 | |||
80 | 1 | return $this->deleteAllowed; |
|
81 | } |
||
82 | } |
||
83 |