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
Pull Request — master (#67)
by Dwight
05:27 queued 02:27
created

ApnAdapter::adapt()   B

Complexity

Conditions 7
Paths 64

Size

Total Lines 35

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 56

Importance

Changes 0
Metric Value
dl 0
loc 35
ccs 0
cts 15
cp 0
rs 8.4266
c 0
b 0
f 0
cc 7
nc 64
nop 1
crap 56
1
<?php
2
3
namespace NotificationChannels\Apn;
4
5
use Pushok\Payload;
6
use Pushok\Payload\Alert;
7
8
class ApnAdapter
9
{
10
    /**
11
     * Convert an ApnMessage instance into a Zend Apns Message.
12
     *
13
     * @param  \NotificationChannels\Apn\ApnMessage  $message
14
     * @return \Pushok\Payload
15
     */
16
    public function adapt(ApnMessage $message)
17
    {
18
        $alert = Alert::create();
19
20
        if ($title = $message->title) {
21
            $alert->setTitle($title);
22
        }
23
24
        if ($body = $message->body) {
25
            $alert->setBody($body);
26
        }
27
28
        $payload = Payload::create()
29
            ->setAlert($alert)
30
            ->setContentAvailability((bool) $message->contentAvailable)
31
            ->setMutableContent((bool) $message->mutableContent);
32
33
        if ($badge = $message->badge) {
34
            $payload->setBadge($badge);
35
        }
36
37
        if ($sound = $message->sound) {
38
            $payload->setSound($sound);
39
        }
40
41
        if ($category = $message->category) {
42
            $payload->setCategory($category);
43
        }
44
45
        foreach ($message->custom as $key => $value) {
46
            $payload->setCustomValue($key, $value);
47
        }
48
49
        return $payload;
50
    }
51
}
52