Browse files

Fixed bug with supplying just a message body.

  • Loading branch information...
1 parent fd02b0a commit 0bca7719ae5d3d38256fce8b54ada89a6edca695 @paddyforan paddyforan committed Jan 10, 2012
Showing with 13 additions and 9 deletions.
  1. +13 −9 IronMQ.class.php
View
22 IronMQ.class.php
@@ -60,15 +60,19 @@ class IronMQ_Message {
* - expires_in: How long, in seconds, to keep the item on the queue before it is deleted. Defaults to 604800 (7 days). Maximum is 2592000 (30 days).
*/
function __construct($message) {
- $this->setBody($message['body']);
- if(array_key_exists("timeout", $message)) {
- $this->setTimeout($message['timeout']);
- }
- if(array_key_exists("delay", $message)) {
- $this->setDelay($message['delay']);
- }
- if(array_key_exists("expires_in", $message)) {
- $this->setExpiresIn($message['expires_in']);
+ if(is_string($message)) {
+ $this->setBody($message);
+ } elseif(is_array($message)) {
+ $this->setBody($message['body']);
+ if(array_key_exists("timeout", $message)) {
+ $this->setTimeout($message['timeout']);
+ }
+ if(array_key_exists("delay", $message)) {
+ $this->setDelay($message['delay']);
+ }
+ if(array_key_exists("expires_in", $message)) {
+ $this->setExpiresIn($message['expires_in']);
+ }
}
}

0 comments on commit 0bca771

Please sign in to comment.