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 ( 338b8a...0b0e53 )
by Dwight
14s queued 14s
created

ApnAdapter   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 73.68%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 3
dl 0
loc 44
ccs 14
cts 19
cp 0.7368
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B adapt() 0 35 7
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