Skip to content

Commit

Permalink
Increase code coverage and reformat code.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgaillard committed Jun 17, 2017
1 parent 4228720 commit a4a2448
Show file tree
Hide file tree
Showing 11 changed files with 128 additions and 106 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function getNotifications()
{
return $this->notifications;
}

/**
* {@inheritDoc}
*/
Expand All @@ -118,24 +118,24 @@ public function jsonSerialize()
if (!isset($this->application) && !isset($this->applicationsGroup)) {
throw new PushwooshException('None of the \'application\' or \'applicationsGroup\' properties are set !');
}

// If the 'application' or 'applicationsGroup' parameters are both set this is an error
if (isset($this->application) && isset($this->applicationsGroup)) {
throw new PushwooshException('Both \'application\' and \'applicationsGroup\' properties are set !');
}

// The 'auth' parameter must have been set
if (!isset($this->auth)) {
throw new PushwooshException('The \'auth\' property is not set !');
}

$json = [
'application' => $this->application,
'applications_group' => $this->applicationsGroup,
'auth' => $this->auth,
'notifications' => []
];

// Adds the notifications
// Please note that the Pushwoosh REST API seems to authorize calls to the 'createMessage' service with a create
// message request which do not define any notification. This is authorized but has no effect.
Expand All @@ -144,7 +144,7 @@ public function jsonSerialize()
$json['notifications'][] = $notification->jsonSerialize();
}
}

return $json;
}

Expand Down

0 comments on commit a4a2448

Please sign in to comment.