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.
Passed
Branch master (98970a)
by Alexander
02:59 queued 21s
created

MPNSRaw   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 2
A __get() 0 8 2
A __set() 0 4 1
A createPayload() 0 17 2
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\Message\Type;
11
12
use Zbox\UnifiedPush\Exception\InvalidArgumentException;
13
14
/**
15
 * Class MPNSRaw
16
 * @package Zbox\UnifiedPush\Message\Type
17
 */
18
class MPNSRaw extends MPNSBase
19
{
20
    const MESSAGE_TYPE = 'raw';
21
22
    const DELAY_INTERVAL_IMMEDIATE  = 3;
23
    const DELAY_INTERVAL_450        = 13;
24
    const DELAY_INTERVAL_900        = 23;
25
26
    /**
27
     * Custom payload parameters
28
     *
29
     * @var array
30
     */
31
    private $_payload;
32
33
    /**
34
     * @param array $data
35
     */
36
    public function __construct(array $data = array())
37
    {
38
        $this->setMessageIdentifier(uniqid());
39
        $this->recipientCollection = new \ArrayIterator();
40
41
        foreach ($data as $key => $value) {
42
            $this->$key = $value;
43
        }
44
45
        return $this;
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function createPayload()
52
    {
53
        $message      = new \DOMDocument("1.0", "utf-8");
54
        $baseElement  = $message->createElement("wp:Notification");
55
        $baseElement->setAttribute("xmlns:wp", "WPNotification");
56
        $message->appendChild($baseElement);
57
58
        $rootElement = $message->createElement("root");
59
        $baseElement->appendChild($rootElement);
60
61
        foreach ($this->_payload as $key => $value) {
62
            $element = $message->createElement($key, $value);
63
            $rootElement->appendChild($element);
64
        }
65
66
        return $message;
67
    }
68
69
    /**
70
     * @param string $name
71
     */
72
    public function __get($name)
73
    {
74
        if (empty($this->_payload[$name])) {
75
            throw new InvalidArgumentException(sprintf("Payload parameter '%s' is not defined", $name));
76
        }
77
78
        return $this->_payload[$name];
79
    }
80
81
    /**
82
     * @param string $name
83
     * @param mixed $value
84
     */
85
    public function __set($name, $value)
86
    {
87
        $this->_payload[$name] = htmlspecialchars($value);
88
    }
89
}
90