From f5336749c1ff2b8e9af5d4ba15e0ca3ddb1285a6 Mon Sep 17 00:00:00 2001 From: drewm Date: Sat, 23 Apr 2016 13:37:45 +0100 Subject: [PATCH] Tightening error checking --- src/Webhook.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Webhook.php b/src/Webhook.php index 38a3b2e..be70133 100644 --- a/src/Webhook.php +++ b/src/Webhook.php @@ -42,7 +42,7 @@ public static function receive($input = null) } } - if ($input) { + if (!is_null($input) && $input != '') { return self::processWebhook($input); } @@ -55,16 +55,14 @@ public static function receive($input = null) * @return array|false An associative array containing the details of the received webhook */ private static function processWebhook($input) - { - if ($input) { - self::$receivedWebhook = $input; - parse_str($input, $result); - if ($result && isset($result['type'])) { - self::dispatchWebhookEvent($result['type'], $result['data']); - return $result; - } + { + self::$receivedWebhook = $input; + parse_str($input, $result); + if ($result && isset($result['type'])) { + self::dispatchWebhookEvent($result['type'], $result['data']); + return $result; } - + return false; }