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 ( 741135...fdec78 )
by Lukas
02:19
created

OneSignalChannel::payload()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 3
crap 1
1
<?php
2
3
namespace NotificationChannels\OneSignal;
4
5
use Berkayk\OneSignal\OneSignalClient;
6
use Psr\Http\Message\ResponseInterface;
7
use Illuminate\Notifications\Notification;
8
use NotificationChannels\OneSignal\Exceptions\CouldNotSendNotification;
9
10
class OneSignalChannel
11
{
12
    /** @var OneSignalClient */
13
    protected $oneSignal;
14
15 6
    public function __construct(OneSignalClient $oneSignal)
16
    {
17 6
        $this->oneSignal = $oneSignal;
18 6
    }
19
20
    /**
21
     * Send the given notification.
22
     *
23
     * @param mixed $notifiable
24
     * @param \Illuminate\Notifications\Notification $notification
25
     *
26
     * @return \Psr\Http\Message\ResponseInterface
27
     * @throws \NotificationChannels\OneSignal\Exceptions\CouldNotSendNotification
28
     */
29 6
    public function send($notifiable, Notification $notification)
30
    {
31 6
        if (! $userIds = $notifiable->routeNotificationFor('OneSignal')) {
32 1
            return;
33
        }
34
35
        /** @var ResponseInterface $response */
36 5
        $response = $this->oneSignal->sendNotificationCustom(
37 5
            $this->payload($notifiable, $notification, $userIds)
38
        );
39
40 5
        if ($response->getStatusCode() !== 200) {
41 1
            throw CouldNotSendNotification::serviceRespondedWithAnError($response);
42
        }
43
44 4
        return $response;
45
    }
46
47
    /**
48
     * @param mixed $notifiable
49
     * @param \Illuminate\Notifications\Notification $notification
50
     * @param mixed $targeting
0 ignored issues
show
Bug introduced by
There is no parameter named $targeting. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
51
     *
52
     * @return array
53
     */
54 5
    protected function payload($notifiable, $notification, $userIds)
55
    {
56 5
        return OneSignalPayloadFactory::make($notifiable, $notification, $userIds);
57
    }
58
}
59