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 ( 2c3c0a...15375f )
by Alexander
02:21
created

ResponseFeedback::getRecipients()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * (c) Alexander Zhukov <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Zbox\UnifiedPush\NotificationService\APNS;
11
12
use Zbox\UnifiedPush\NotificationService\ResponseInterface;
13
use Zbox\UnifiedPush\Message\RecipientDevice;
14
use Zbox\UnifiedPush\Message\Type\APNS as APNSMessage;
15
16
/**
17
 * Class ResponseFeedback
18
 * @package Zbox\UnifiedPush\NotificationService\APNS
19
 */
20
class ResponseFeedback implements ResponseInterface
21
{
22
    /**
23
     * @var string
24
     */
25
    protected $rawResponse;
26
27
    /**
28
     * @var \ArrayIterator
29
     */
30
    protected $recipients;
31
32
    /**
33
     * @param string $binaryData
34
     * @param \ArrayIterator $recipients
35
     */
36
    public function __construct($binaryData, \ArrayIterator $recipients)
37
    {
38
        $this->rawResponse = $binaryData;
39
        $this->recipients  = $recipients;
40
    }
41
42
    /**
43
     * @return \ArrayIterator
44
     */
45
    public function getRecipients()
46
    {
47
        return $this->recipients;
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function processResponse()
54
    {
55
        $rawResponse = $this->rawResponse;
56
57
        if (empty($rawResponse)) {
58
            return;
59
        }
60
61
        foreach (str_split($rawResponse, 38) as $item)
62
        {
63
            $deviceData = unpack('N1timestamp/n1length/H*token', $item);
64
65
            $this->recipients->append(
66
                new RecipientDevice($deviceData['token'], new APNSMessage())
67
            );
68
        }
69
    }
70
}
71