GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 554576...c39576 )
by Irfaq
02:20
created

src/FacebookChannel.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

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
The method toFacebook() does not seem to exist on object<Illuminate\Notifications\Notification>.

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.

Loading history...
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