@@ 57-80 (lines=24) @@ | ||
54 | * @param $vhost |
|
55 | * @param $queues |
|
56 | */ |
|
57 | public function deleteQueues($vhost, $queues) |
|
58 | { |
|
59 | if ('*' === $queues) { |
|
60 | //so you want to destroy all queues, as you whish, let me time to list' em all |
|
61 | $queues = $this->queueManager->getAll(urlencode($vhost)); |
|
62 | } elseif (!$vhost) { |
|
63 | throw new \InvalidArgumentException('If you want to delete certain queue(s) you have to provide vhost'); |
|
64 | } else { |
|
65 | //few queues to delete, let stack them in array |
|
66 | $queues = explode(',', $queues); |
|
67 | array_walk($queues, function(&$item, $key, $vhost){ |
|
68 | $item = ['vhost' => $vhost, 'name' => trim($item)]; |
|
69 | }, $vhost); |
|
70 | } |
|
71 | ||
72 | if (0 == count($queues)) { |
|
73 | $this->logger->error('No queue found.'); |
|
74 | return; |
|
75 | } |
|
76 | ||
77 | foreach ($queues as $queue) { |
|
78 | $this->queueManager->delete(urlencode($queue['vhost']), $queue['name']); |
|
79 | } |
|
80 | } |
|
81 | ||
82 | /** |
|
83 | * Delete selected exchanges. |
|
@@ 121-144 (lines=24) @@ | ||
118 | } |
|
119 | } |
|
120 | ||
121 | public function deletePolicies($vhost, $policies) |
|
122 | { |
|
123 | if ('*' === $policies) { |
|
124 | //so you want to destroy all policies, as you whish, let me time to list'em all |
|
125 | $policies = $this->policyManager->getAll(urlencode($vhost)); |
|
126 | } elseif (!$vhost) { |
|
127 | throw new \InvalidArgumentException('If you want to delete certain policie(s) you have to provide vhost'); |
|
128 | } else { |
|
129 | //few policies to delete, let stack them in array |
|
130 | $policies = explode(',', $policies); |
|
131 | array_walk($policies, function(&$item, $key, $vhost){ |
|
132 | $item = ['vhost' => $vhost, 'name' => trim($item)]; |
|
133 | }, $vhost); |
|
134 | } |
|
135 | ||
136 | if (0 == count($policies)) { |
|
137 | $this->logger->error('No policy found.'); |
|
138 | return; |
|
139 | } |
|
140 | ||
141 | foreach ($policies as $policy) { |
|
142 | $this->policyManager->delete(urlencode($policy['vhost']), $policy['name']); |
|
143 | } |
|
144 | } |
|
145 | } |
|
146 |