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 ( 9fd22a...23ffaf )
by Dwight
03:21 queued 12s
created

FacebookPosterChannel::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace NotificationChannels\FacebookPoster;
4
5
use Facebook\Facebook;
6
use Illuminate\Notifications\Notification;
7
8
class FacebookPosterChannel
9
{
10
    /**
11
     * The Facebook client.
12
     *
13
     * @var \Facebook\Facebook
14
     */
15
    protected $facebook;
16
17
    /**
18
     * Create a new channel instance.
19
     *
20
     * @param  \Facebook\Facebook  $facebook
21
     */
22 4
    public function __construct(Facebook $facebook)
23
    {
24 4
        $this->facebook = $facebook;
25 4
    }
26
27
    /**
28
     * Send the given notification.
29
     *
30
     * @param  mixed  $notifiable
31
     * @param  \Illuminate\Notifications\Notification $notification
32
     */
33 4
    public function send($notifiable, Notification $notification)
34
    {
35 4
        if ($facebookSettings = $notifiable->routeNotificationFor('facebookPoster')) {
36
            $this->switchSettings($facebookSettings);
37
        }
38
39 4
        $post = $notification->toFacebookPoster($notifiable);
0 ignored issues
show
Bug introduced by
The method toFacebookPoster() 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...
40
41 4
        $body = $post->getBody();
42
43 4
        if ($media = $post->getMedia()) {
44 2
            $body['source'] = $this->facebook->{$media::API_METHOD}($media->getPath());
45
        }
46
47 4
        $this->facebook->post($post->getEndpoint(), $body);
48 4
    }
49
50
    /**
51
     * Use per user settings instead of default ones.
52
     *
53
     * @param  array  $config
54
     * @return void
55
     */
56
    protected function switchSettings(array $config)
57
    {
58
        $this->facebook = new Facebook($config);
59
    }
60
}
61