Conditions | 5 |
Paths | 5 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 5.5069 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | 1 | public function send($notifiable, Notification $notification) |
|
29 | { |
||
30 | 1 | if (! $userIds = $notifiable->routeNotificationFor('OneSignal')) { |
|
31 | return; |
||
32 | } |
||
33 | |||
34 | 1 | $payload = $notification->toOneSignal($notifiable)->toArray(); |
|
|
|||
35 | |||
36 | 1 | if (is_array($userIds) && array_key_exists('email', $userIds)) { |
|
37 | $payload['filters'] = collect([['field' => 'email', 'value' => $userIds['email']]]); |
||
38 | } else { |
||
39 | 1 | $payload['include_player_ids'] = collect($userIds); |
|
40 | } |
||
41 | |||
42 | /** @var ResponseInterface $response */ |
||
43 | 1 | $response = $this->oneSignal->sendNotificationCustom($payload); |
|
44 | |||
45 | 1 | if ($response->getStatusCode() !== 200) { |
|
46 | 1 | throw CouldNotSendNotification::serviceRespondedWithAnError($response); |
|
47 | } |
||
48 | } |
||
49 | } |
||
50 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.