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
04:02
created

ApnAdapter::adapt()   B

Complexity

Conditions 7
Paths 64

Size

Total Lines 35

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 7.8934

Importance

Changes 0
Metric Value
dl 0
loc 35
ccs 14
cts 19
cp 0.7368
rs 8.4266
c 0
b 0
f 0
cc 7
nc 64
nop 1
crap 7.8934
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 1
    public function adapt(ApnMessage $message)
17
    {
18 1
        $alert = Alert::create();
19
20 1
        if ($title = $message->title) {
21 1
            $alert->setTitle($title);
22
        }
23
24 1
        if ($body = $message->body) {
25
            $alert->setBody($body);
26
        }
27
28 1
        $payload = Payload::create()
29 1
            ->setAlert($alert)
30 1
            ->setContentAvailability((bool) $message->contentAvailable)
31 1
            ->setMutableContent((bool) $message->mutableContent);
32
33 1
        if ($badge = $message->badge) {
34
            $payload->setBadge($badge);
35
        }
36
37 1
        if ($sound = $message->sound) {
38
            $payload->setSound($sound);
39
        }
40
41 1
        if ($category = $message->category) {
42
            $payload->setCategory($category);
43
        }
44
45 1
        foreach ($message->custom as $key => $value) {
46
            $payload->setCustomValue($key, $value);
47
        }
48
49 1
        return $payload;
50
    }
51
}
52