Skip to content

Commit

Permalink
Merge pull request #51 from voyula/patch-3
Browse files Browse the repository at this point in the history
Quality Improvements
  • Loading branch information
benwilkins authored Dec 16, 2019
2 parents 381da9c + 2be00c1 commit 0fec9a7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
}
},
"scripts": {
"test": "vendor/bin/phpunit"
"test": "phpunit"
},
"config": {
"sort-packages": true,
Expand Down
10 changes: 5 additions & 5 deletions src/FcmChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ public function send($notifiable, Notification $notification)
$message = $notification->toFcm($notifiable);

if (is_null($message->getTo()) && is_null($message->getCondition())) {
if (!$to = $notifiable->routeNotificationFor('fcm', $notification)) {
if (! $to = $notifiable->routeNotificationFor('fcm', $notification)) {
return;
}

$message->to($to);
}

$response_array = [];

if (is_array($message->getTo())) {
$chunks = array_chunk($message->getTo(), 1000);

Expand All @@ -67,7 +67,7 @@ public function send($notifiable, Notification $notification)
],
'body' => $message->formatData(),
]);

array_push($response_array, \GuzzleHttp\json_decode($response->getBody(), true));
}
} else {
Expand All @@ -78,7 +78,7 @@ public function send($notifiable, Notification $notification)
],
'body' => $message->formatData(),
]);

array_push($response_array, \GuzzleHttp\json_decode($response->getBody(), true));
}

Expand Down
18 changes: 9 additions & 9 deletions src/FcmMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class FcmMessage
/**
* @var int
*/
private $timeToTive;
private $timeToLive;

/**
* @var bool
Expand Down Expand Up @@ -206,18 +206,18 @@ public function mutableContent($mutableContent)
/**
* @return int
*/
public function getTimeToTive()
public function getTimeToLive()
{
return $this->timeToTive;
return $this->timeToLive;
}

/**
* @param int $timeToTive
* @param int $timeToLive
* @return $this
*/
public function timeToTive($timeToTive)
public function timeToLive($timeToLive)
{
$this->timeToTive = $timeToTive;
$this->timeToLive = $timeToLive;

return $this;
}
Expand Down Expand Up @@ -271,7 +271,7 @@ public function formatData()

if (is_array($this->to)) {
$payload['registration_ids'] = $this->to;
} elseif (!empty($this->to)) {
} elseif (! empty($this->to)) {
$payload['to'] = $this->to;
}

Expand Down Expand Up @@ -299,8 +299,8 @@ public function formatData()
$payload['mutable_content'] = $this->mutableContent;
}

if (isset($this->timeToTive)) {
$payload['time_to_live'] = $this->timeToTive;
if (isset($this->timeToLive)) {
$payload['time_to_live'] = $this->timeToLive;
}

if (isset($this->dryRun)) {
Expand Down

0 comments on commit 0fec9a7

Please sign in to comment.