Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
OskarStark committed Sep 2, 2024
1 parent 32b0318 commit 1975fc3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/Client/MessageClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function buildApiUrl(): string
/**
* Builds array for CURLOPT_POSTFIELDS curl argument.
*
* @return array<string, (null|\CURLFile|int|string)>
* @return array<string, (null|\CURLFile|string)>
*/
public function buildCurlPostFields(Notification $notification): array
{
Expand Down Expand Up @@ -68,11 +68,11 @@ public function buildCurlPostFields(Notification $notification): array
}

if (null !== $notification->getMessage()->getPriority()) {
$curlPostFields['priority'] = $notification->getMessage()->getPriority()->getPriority();
$curlPostFields['priority'] = (string) $notification->getMessage()->getPriority()->getPriority();

if (Priority::EMERGENCY === $notification->getMessage()->getPriority()->getPriority()) {
$curlPostFields['retry'] = $notification->getMessage()->getPriority()->getRetry();
$curlPostFields['expire'] = $notification->getMessage()->getPriority()->getExpire();
$curlPostFields['retry'] = (string) $notification->getMessage()->getPriority()->getRetry();
$curlPostFields['expire'] = (string) $notification->getMessage()->getPriority()->getExpire();

if (null !== $notification->getMessage()->getPriority()->getCallback()) {
$curlPostFields['callback'] = $notification->getMessage()->getPriority()->getCallback();
Expand All @@ -81,11 +81,11 @@ public function buildCurlPostFields(Notification $notification): array
}

if (true === $notification->getMessage()->getIsHtml()) {
$curlPostFields['html'] = 1;
$curlPostFields['html'] = '1';
}

if (null !== $notification->getMessage()->getTtl()) {
$curlPostFields['ttl'] = $notification->getMessage()->getTtl();
$curlPostFields['ttl'] = (string) $notification->getMessage()->getTtl();
}

if (null !== $notification->getSound()) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Client/MessageClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public function testBuildCurlPostFields(): void
$client = new MessageClient();
$curlPostFields = $client->buildCurlPostFields($notification);

$this->assertIsArray($curlPostFields);
$this->assertSame('cccc3333CCCC3333dddd4444DDDD44', $curlPostFields['token']);
$this->assertSame('aaaa1111AAAA1111bbbb2222BBBB22', $curlPostFields['user']);
$this->assertSame('This is a test message', $curlPostFields['message']);
$this->assertSame($message->getTimestamp(), $curlPostFields['timestamp']);
$this->assertSame('ios,android', $curlPostFields['device']);
$this->assertSame('This is a title of the message', $curlPostFields['title']);
$this->assertSame('https://www.example.com', $curlPostFields['url']);
Expand Down

0 comments on commit 1975fc3

Please sign in to comment.