From c8ab90b5d6b7ed698615325cdddc7e7dd54ebed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Alcal=C3=A1=20=C3=81lvarez?= Date: Sun, 3 Nov 2019 18:52:18 -0600 Subject: [PATCH 1/2] jsonSerialize working with multidimensional arrays --- src/Model/Message/PushNotification.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Model/Message/PushNotification.php b/src/Model/Message/PushNotification.php index 06bf8a9..2ed57a8 100644 --- a/src/Model/Message/PushNotification.php +++ b/src/Model/Message/PushNotification.php @@ -111,9 +111,16 @@ public function createMessage(array $options = [], array $auth = []): PushMessag */ public function jsonSerialize(): array { + $options = []; + foreach ($this->options as $key=>$option) { + if($option !== null){ + $options[$key] = $option; + } + } + return [ 'title' => $this->title, - 'options' => array_diff($this->options, array_filter($this->options, 'is_null')), + 'options' => $options ]; } From 504f814648a79066b3273f48a510f6fc77a52049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Alcal=C3=A1?= Date: Sat, 11 Apr 2020 14:43:34 -0500 Subject: [PATCH 2/2] Update WebPushTwigExtension.php --- src/Twig/WebPushTwigExtension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Twig/WebPushTwigExtension.php b/src/Twig/WebPushTwigExtension.php index 019d294..6539ac2 100644 --- a/src/Twig/WebPushTwigExtension.php +++ b/src/Twig/WebPushTwigExtension.php @@ -20,7 +20,7 @@ public function __construct(?string $publicKey) /** * @inheritDoc */ - public function getGlobals() + public function getGlobals():array { return [ 'bentools_webpush' => [