From 9ead5c2773f718149abd1a61f1d20ceba2dbe432 Mon Sep 17 00:00:00 2001 From: Alexander Timmermann Date: Mon, 20 Jul 2020 11:52:40 +0200 Subject: [PATCH 1/2] fix: revert "Created Recipients object rather than it being a stdClass (#103)" This reverts commit 0b39ffd64b2a0b5a57e1dc75584c9f9c456857cc. --- src/MessageBird/Objects/Message.php | 14 ++-- src/MessageBird/Objects/Recipient.php | 24 ------- src/MessageBird/Objects/Recipients.php | 97 -------------------------- 3 files changed, 10 insertions(+), 125 deletions(-) delete mode 100644 src/MessageBird/Objects/Recipients.php diff --git a/src/MessageBird/Objects/Message.php b/src/MessageBird/Objects/Message.php index f36b1b07..6873bff7 100644 --- a/src/MessageBird/Objects/Message.php +++ b/src/MessageBird/Objects/Message.php @@ -127,9 +127,9 @@ class Message extends Base /** * An array of recipients * - * @var Recipients + * @var array */ - public $recipients; + public $recipients = array (); /** * The URL to send status delivery reports for the message to @@ -225,8 +225,14 @@ public function loadFromArray ($object) { parent::loadFromArray($object); - $recipients = new Recipients(); - $this->recipients = $recipients->loadFromArray($this->recipients); + if (!empty($this->recipients->items)) { + foreach($this->recipients->items AS &$item) { + $Recipient = new Recipient(); + $Recipient->loadFromArray($item); + + $item = $Recipient; + } + } return $this; } diff --git a/src/MessageBird/Objects/Recipient.php b/src/MessageBird/Objects/Recipient.php index 44c86415..cf14d92d 100644 --- a/src/MessageBird/Objects/Recipient.php +++ b/src/MessageBird/Objects/Recipient.php @@ -35,28 +35,4 @@ class Recipient extends Base * @var string */ public $statusDatetime; - - /** - * @return int - */ - public function getRecipient() - { - return $this->recipient; - } - - /** - * @return string - */ - public function getStatus() - { - return $this->status; - } - - /** - * @return string - */ - public function getStatusDatetime() - { - return $this->statusDatetime; - } } diff --git a/src/MessageBird/Objects/Recipients.php b/src/MessageBird/Objects/Recipients.php deleted file mode 100644 index dc0fe88c..00000000 --- a/src/MessageBird/Objects/Recipients.php +++ /dev/null @@ -1,97 +0,0 @@ -totalCount; - } - - /** - * @return int - */ - public function getTotalSentCount() - { - return $this->totalSentCount; - } - - /** - * @return int - */ - public function getTotalDeliveredCount() - { - return $this->totalDeliveredCount; - } - - /** - * @return int - */ - public function getTotalDeliveryFailedCount() - { - return $this->totalDeliveryFailedCount; - } - - /** - * @return Recipient[] - */ - public function getItems() - { - return $this->items; - } - - /** - * @param $object - * - * @return $this|void - */ - public function loadFromArray($object) - { - parent::loadFromArray($object); - - if (!empty($this->items)) { - foreach ($this->items as &$item) { - $recipient = new Recipient(); - $recipient->loadFromArray($item); - - $item = $recipient; - } - } - - return $this; - } -} From d72563d9aa775a3ee5576eb3dea119be64637799 Mon Sep 17 00:00:00 2001 From: Alexander Timmermann Date: Mon, 20 Jul 2020 11:53:32 +0200 Subject: [PATCH 2/2] chore: bump version to 1.19.2 --- src/MessageBird/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MessageBird/Client.php b/src/MessageBird/Client.php index 1590ef37..62cf5065 100644 --- a/src/MessageBird/Client.php +++ b/src/MessageBird/Client.php @@ -19,7 +19,7 @@ class Client const ENABLE_CONVERSATIONSAPI_WHATSAPP_SANDBOX = 'ENABLE_CONVERSATIONSAPI_WHATSAPP_SANDBOX'; const CONVERSATIONSAPI_WHATSAPP_SANDBOX_ENDPOINT = 'https://whatsapp-sandbox.messagebird.com/v1'; - const CLIENT_VERSION = '1.19.1'; + const CLIENT_VERSION = '1.19.2'; /** * @var string