From 8efee99448e7aeeb78378c46f33af1713ce69404 Mon Sep 17 00:00:00 2001 From: Eunus Hosen Date: Fri, 25 Sep 2020 18:52:14 +0600 Subject: [PATCH] Return empty array if there is no contact --- src/GooglePeople.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/GooglePeople.php b/src/GooglePeople.php index 05a6080..38a294d 100644 --- a/src/GooglePeople.php +++ b/src/GooglePeople.php @@ -65,6 +65,10 @@ public function all() $responseObj = json_decode($body); + if (empty($responseObj->connections) || ! is_array($responseObj->connections)) { + return []; + } + $contacts = []; foreach($responseObj->connections as $connection) {