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

OneSignalPayloadFactory::isTargetingEmail()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 2
eloc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace NotificationChannels\OneSignal;
4
5
use Illuminate\Notifications\Notification;
6
7
class OneSignalPayloadFactory
8
{
9
    /**
10
     * Make a one signal notification payload.
11
     *
12
     * @param mixed $notifiable
13
     * @param \Illuminate\Notifications\Notification $notification
14
     * @param mixed $targeting
15
     *
16
     * @return array
17
     */
18 5
    public static function make($notifiable, Notification $notification, $targeting) : array
19
    {
20 5
        $payload = $notification->toOneSignal($notifiable)->toArray();
0 ignored issues
show
Bug introduced by
The method toOneSignal() 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...
21
22 5
        if (static::isTargetingEmail($targeting)) {
23 1
            $payload['filters'] = collect([['field' => 'email', 'value' => $targeting['email']]]);
24 4
        } elseif (static::isTargetingTags($targeting)) {
25 1
            $payload['tags'] = collect([$targeting['tags']]);
26
        } else {
27 3
            $payload['include_player_ids'] = collect($targeting);
28
        }
29
30 5
        return $payload;
31
    }
32
33
    /**
34
     * @param mixed $targeting
35
     *
36
     * @return bool
37
     */
38 5
    protected static function isTargetingEmail($targeting)
39
    {
40 5
        return is_array($targeting) && array_key_exists('email', $targeting);
41
    }
42
43 4
    protected static function isTargetingTags($targeting)
44
    {
45 4
        return is_array($targeting) && array_key_exists('tags', $targeting);
46
    }
47
}
48