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   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 51
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getRecipients() 0 4 1
A processResponse() 0 17 3
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