| Conditions | 4 |
| Paths | 3 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4.0092 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 4 | public function send($notifiable, Notification $notification) |
|
| 34 | { |
||
| 35 | 4 | if (! $url = $notifiable->routeNotificationFor('webhook')) { |
|
| 36 | return; |
||
| 37 | } |
||
| 38 | |||
| 39 | 4 | $webhookData = $notification->toWebhook($notifiable)->toArray(); |
|
|
|
|||
| 40 | |||
| 41 | 4 | $response = $this->client->post($url, [ |
|
| 42 | 4 | 'query' => Arr::get($webhookData, 'query'), |
|
| 43 | 4 | 'body' => json_encode(Arr::get($webhookData, 'data')), |
|
| 44 | 4 | 'verify' => Arr::get($webhookData, 'verify'), |
|
| 45 | 4 | 'headers' => Arr::get($webhookData, 'headers'), |
|
| 46 | ]); |
||
| 47 | |||
| 48 | 4 | if ($response->getStatusCode() >= 300 || $response->getStatusCode() < 200) { |
|
| 49 | 1 | throw CouldNotSendNotification::serviceRespondedWithAnError($response); |
|
| 50 | } |
||
| 51 | |||
| 52 | 3 | return $response; |
|
| 53 | } |
||
| 54 | } |
||
| 55 |
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.