Conditions | 5 |
Paths | 5 |
Total Lines | 23 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 5 |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | 4 | public function send($notifiable, Notification $notification) |
|
30 | { |
||
31 | 4 | if (! $userIds = $notifiable->routeNotificationFor('OneSignal')) { |
|
32 | 1 | return; |
|
33 | } |
||
34 | |||
35 | 3 | $payload = $notification->toOneSignal($notifiable)->toArray(); |
|
|
|||
36 | |||
37 | 3 | if (is_array($userIds) && array_key_exists('email', $userIds)) { |
|
38 | 1 | $payload['filters'] = collect([['field' => 'email', 'value' => $userIds['email']]]); |
|
39 | } else { |
||
40 | 2 | $payload['include_player_ids'] = collect($userIds); |
|
41 | } |
||
42 | |||
43 | /** @var ResponseInterface $response */ |
||
44 | 3 | $response = $this->oneSignal->sendNotificationCustom($payload); |
|
45 | |||
46 | 3 | if ($response->getStatusCode() !== 200) { |
|
47 | 1 | throw CouldNotSendNotification::serviceRespondedWithAnError($response); |
|
48 | } |
||
49 | |||
50 | 2 | return $response; |
|
51 | } |
||
52 | } |
||
53 |
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.