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 ( 395778...35ff7e )
by Dwight
8s
created

ApnAdapter::adapt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 17
ccs 0
cts 13
cp 0
rs 9.4285
cc 1
eloc 13
nc 1
nop 2
crap 2
1
<?php
2
3
namespace NotificationChannels\Apn;
4
5
use ZendService\Apple\Apns\Message;
6
use ZendService\Apple\Apns\Message\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
     * @param  string  $token
15
     * @return \ZendService\Apple\Apns\Message
16
     */
17
    public function adapt(ApnMessage $message, $token)
18
    {
19
        $alert = new Alert();
20
        $alert->setTitle($message->title);
21
        $alert->setBody($message->body);
22
23
        $packet = new Message;
24
        $packet->setToken($token);
25
        $packet->setBadge($message->badge);
26
        $packet->setSound($message->sound);
27
        $packet->setCategory($message->category);
28
        $packet->setContentAvailable($message->contentAvailable);
29
        $packet->setAlert($alert);
30
        $packet->setCustom($message->custom);
31
32
        return $packet;
33
    }
34
}
35