Skip to content

Commit 1a6a178

Browse files
committed
Following code style convention
1 parent ba013ab commit 1a6a178

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

src/OneSignalChannel.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
namespace NotificationChannels\OneSignal;
44

55
use Berkayk\OneSignal\OneSignalClient;
6-
use NotificationChannels\OneSignal\Exceptions\CouldNotSendNotification;
7-
use Illuminate\Notifications\Notification;
86
use Psr\Http\Message\ResponseInterface;
7+
use Illuminate\Notifications\Notification;
8+
use NotificationChannels\OneSignal\Exceptions\CouldNotSendNotification;
99

1010
class OneSignalChannel
1111
{
12-
1312
/** @var OneSignalClient */
1413
protected $oneSignal;
1514

@@ -21,26 +20,28 @@ public function __construct(OneSignalClient $oneSignal)
2120
/**
2221
* Send the given notification.
2322
*
24-
* @param mixed $notifiable
23+
* @param mixed $notifiable
2524
* @param \Illuminate\Notifications\Notification $notification
2625
*
2726
* @throws \NotificationChannels\OneSignal\Exceptions\CouldNotSendNotification
2827
*/
2928
public function send($notifiable, Notification $notification)
3029
{
31-
if (!$userIds = $notifiable->routeNotificationFor('OneSignal')) {
30+
if (! $userIds = $notifiable->routeNotificationFor('OneSignal')) {
3231
return;
3332
}
3433

3534
$payload = $notification->toOneSignal($notifiable)->toArray();
35+
3636
if (is_array($userIds) && array_key_exists('email', $userIds)) {
37-
$payload['filters'] = collect([["field" => "email", "value" => $userIds['email']]]);
37+
$payload['filters'] = collect([['field' => 'email', 'value' => $userIds['email']]]);
3838
} else {
3939
$payload['include_player_ids'] = collect($userIds);
4040
}
4141

4242
/** @var ResponseInterface $response */
4343
$response = $this->oneSignal->sendNotificationCustom($payload);
44+
4445
if ($response->getStatusCode() !== 200) {
4546
throw CouldNotSendNotification::serviceRespondedWithAnError($response);
4647
}

tests/ChannelTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
class ChannelTest extends TestCase
1313
{
14-
1514
/** @var Mockery\Mock */
1615
protected $oneSignal;
1716

@@ -101,11 +100,10 @@ public function it_can_send_a_notification_with_email()
101100
'chrome_icon' => 'Icon',
102101
'adm_small_icon' => 'Icon',
103102
'small_icon' => 'Icon',
104-
'filters' => collect([["field" => "email", "value" => '[email protected]']]),
103+
'filters' => collect([['field' => 'email', 'value' => '[email protected]']]),
105104
])
106105
->andReturn($response);
107106

108107
$this->channel->send(new NotifiableEmail(), new TestNotification());
109108
}
110-
111109
}

tests/NotifiableEmail.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
class NotifiableEmail
66
{
7-
87
use \Illuminate\Notifications\Notifiable;
98

109
/**

0 commit comments

Comments
 (0)