Skip to content

Commit 8a17fd1

Browse files
Merge pull request #9 from pmill/add-support-for-flags-when-deleting-queue
Added support for setting flags when deleting a queue
2 parents 0e62e8b + 6a9799a commit 8a17fd1

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/Api/Queue.php

+14-2
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,23 @@ public function create($vhost, $name, array $queue)
6565
/**
6666
* @param string $vhost
6767
* @param string $name
68+
* @param bool $ifEmpty
69+
* @param bool $ifUnused
6870
* @return array
6971
*/
70-
public function delete($vhost, $name)
72+
public function delete($vhost, $name, $ifEmpty = false, $ifUnused = false)
7173
{
72-
return $this->client->send(sprintf('/api/queues/%s/%s', urlencode($vhost), urlencode($name)), 'DELETE');
74+
$queryString = [];
75+
76+
if ($ifEmpty) {
77+
$queryString['if-empty'] = 'true';
78+
}
79+
80+
if ($ifUnused) {
81+
$queryString['if-unused'] = 'true';
82+
}
83+
84+
return $this->client->send(sprintf('/api/queues/%s/%s?%s', urlencode($vhost), urlencode($name), http_build_query($queryString)), 'DELETE');
7385
}
7486

7587
/**

0 commit comments

Comments
 (0)