Completed
Push — master ( ea8bb0...ac84ee )
by recca
32:09 queued 28:52
created

src/Every8dChannel.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 Recca0120\Every8d;
4
5
use Illuminate\Notifications\Notification;
6
7
class Every8dChannel
8
{
9
    /**
10
     * $client.
11
     *
12
     * @var \Recca0120\Every8d\Client
13
     */
14
    protected $client;
15
16
    /**
17
     * __construct.
18
     *
19
     * @param \Recca0120\Every8d\Client $client
20
     */
21
    public function __construct(Client $client)
22
    {
23
        $this->client = $client;
24
    }
25
26
    /**
27
     * Send the given notification.
28
     *
29
     * @param mixed $notifiable
30
     * @param \Illuminate\Notifications\Notification $notification
31
     *
32
     * @return \Recca0120\Every8d\Every8dMessage;
33
     */
34
    public function send($notifiable, Notification $notification)
35
    {
36
        if (! $to = $notifiable->routeNotificationFor('every8d')) {
37
            return;
38
        }
39
40
        $message = $notification->toEvery8d($notifiable);
0 ignored issues
show
The method toEvery8d() 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 = new Every8dMessage($message);
44
        }
45
46
        return $this->client->send([
47
            'subject' => $message->subject,
48
            'to' => $to,
49
            'text' => trim($message->content),
50
        ]);
51
    }
52
}
53