These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace NotificationChannels\Facebook; |
||
4 | |||
5 | use GuzzleHttp\Exception\GuzzleException; |
||
6 | use Illuminate\Notifications\Notification; |
||
7 | use NotificationChannels\Facebook\Exceptions\CouldNotCreateMessage; |
||
8 | use NotificationChannels\Facebook\Exceptions\CouldNotSendNotification; |
||
9 | |||
10 | /** |
||
11 | * Class FacebookChannel. |
||
12 | */ |
||
13 | class FacebookChannel |
||
14 | { |
||
15 | /** @var Facebook */ |
||
16 | private $fb; |
||
17 | |||
18 | /** |
||
19 | * FacebookChannel constructor. |
||
20 | * |
||
21 | * @param Facebook $fb |
||
22 | */ |
||
23 | public function __construct(Facebook $fb) |
||
24 | { |
||
25 | $this->fb = $fb; |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Send the given notification. |
||
30 | * |
||
31 | * @param mixed $notifiable |
||
32 | * @param Notification $notification |
||
33 | * |
||
34 | * @throws CouldNotCreateMessage |
||
35 | * @throws CouldNotSendNotification |
||
36 | * @throws GuzzleException |
||
37 | */ |
||
38 | public function send($notifiable, Notification $notification): void |
||
39 | { |
||
40 | $message = $notification->toFacebook($notifiable); |
||
0 ignored issues
–
show
|
|||
41 | |||
42 | if (is_string($message)) { |
||
43 | $message = FacebookMessage::create($message); |
||
44 | } |
||
45 | |||
46 | if ($message->toNotGiven()) { |
||
47 | if (! $to = $notifiable->routeNotificationFor('facebook')) { |
||
48 | throw CouldNotCreateMessage::recipientNotProvided(); |
||
49 | } |
||
50 | |||
51 | $message->to($to); |
||
52 | } |
||
53 | |||
54 | $this->fb->send($message->toArray()); |
||
55 | } |
||
56 | } |
||
57 |
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.