From 543f042a845569e26680b7204076240c8f61785a Mon Sep 17 00:00:00 2001 From: berkayk Date: Fri, 22 Sep 2017 12:52:00 +0300 Subject: [PATCH] Fixed app_id bug in parameters. --- src/OneSignalClient.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/OneSignalClient.php b/src/OneSignalClient.php index 8512094..db676de 100644 --- a/src/OneSignalClient.php +++ b/src/OneSignalClient.php @@ -11,12 +11,12 @@ class OneSignalClient const ENDPOINT_NOTIFICATIONS = "/notifications"; const ENDPOINT_PLAYERS = "/players"; - private $client; - private $headers; - private $appId; - private $restApiKey; - private $userAuthKey; - private $additionalParams; + protected $client; + protected $headers; + protected $appId; + protected $restApiKey; + protected $userAuthKey; + protected $additionalParams; /** * @var bool @@ -217,12 +217,13 @@ public function sendNotificationToSegment($message, $segment, $url = null, $data public function sendNotificationCustom($parameters = []){ $this->requiresAuth(); $this->usesJSON(); - // By Sucipto + if (isset($parameters['api_key'])) { $this->headers['headers']['Authorization'] = 'Basic '.$parameters['api_key']; } + // Make sure to use app_id - if (!$parameters['app_id']) { + if (!isset($parameters['app_id'])) { $parameters['app_id'] = $this->appId; }