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 ( 9a7ea4...53d770 )
by Yang
02:32
created

TopicAttributes   A

Complexity

Total Complexity 24

Size/Duplication

Total Lines 133
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 24
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 133
rs 10
1
<?php
2
namespace AliyunMNS\Model;
3
4
use AliyunMNS\Constants;
5
6
/**
7
 * Please refer to
8
 * https://docs.aliyun.com/?spm=#/pub/mns/api_reference/intro&intro
9
 * for more details
10
 */
11
class TopicAttributes
12
{
13
    private $maximumMessageSize;
14
    private $messageRetentionPeriod;
15
16
    # the following attributes cannot be changed
17
    private $topicName;
18
    private $createTime;
19
    private $lastModifyTime;
20
21
    public function __construct(
22
        $maximumMessageSize = NULL,
23
        $messageRetentionPeriod = NULL,
24
        $topicName = NULL,
25
        $createTime = NULL,
26
        $lastModifyTime = NULL)
27
    {
28
        $this->maximumMessageSize = $maximumMessageSize;
29
        $this->messageRetentionPeriod = $messageRetentionPeriod;
30
31
        $this->topicName = $topicName;
32
        $this->createTime = $createTime;
33
        $this->lastModifyTime = $lastModifyTime;
34
    }
35
36
    public function setMaximumMessageSize($maximumMessageSize)
37
    {
38
        $this->maximumMessageSize = $maximumMessageSize;
39
    }
40
41
    public function getMaximumMessageSize()
42
    {
43
        return $this->maximumMessageSize;
44
    }
45
46
    public function setMessageRetentionPeriod($messageRetentionPeriod)
47
    {
48
        $this->messageRetentionPeriod = $messageRetentionPeriod;
49
    }
50
51
    public function getMessageRetentionPeriod()
52
    {
53
        return $this->messageRetentionPeriod;
54
    }
55
56
    public function getTopicName()
57
    {
58
        return $this->topicName;
59
    }
60
61
    public function getCreateTime()
62
    {
63
        return $this->createTime;
64
    }
65
66
    public function getLastModifyTime()
67
    {
68
        return $this->lastModifyTime;
69
    }
70
71
    public function writeXML(\XMLWriter $xmlWriter)
72
    {
73
        if ($this->maximumMessageSize != NULL)
74
        {
75
            $xmlWriter->writeElement(Constants::MAXIMUM_MESSAGE_SIZE, $this->maximumMessageSize);
76
        }
77
        if ($this->messageRetentionPeriod != NULL)
78
        {
79
            $xmlWriter->writeElement(Constants::MESSAGE_RETENTION_PERIOD, $this->messageRetentionPeriod);
80
        }
81
    }
82
83
    static public function fromXML(\XMLReader $xmlReader)
84
    {
85
        $maximumMessageSize = NULL;
86
        $messageRetentionPeriod = NULL;
87
        $topicName = NULL;
88
        $createTime = NULL;
89
        $lastModifyTime = NULL;
90
91
        while ($xmlReader->read())
92
        {
93
            if ($xmlReader->nodeType == \XMLReader::ELEMENT)
94
            {
95
                switch ($xmlReader->name) {
96
                case 'MaximumMessageSize':
97
                    $xmlReader->read();
98
                    if ($xmlReader->nodeType == \XMLReader::TEXT)
99
                    {
100
                        $maximumMessageSize = $xmlReader->value;
101
                    }
102
                    break;
103
                case 'MessageRetentionPeriod':
104
                    $xmlReader->read();
105
                    if ($xmlReader->nodeType == \XMLReader::TEXT)
106
                    {
107
                        $messageRetentionPeriod = $xmlReader->value;
108
                    }
109
                    break;
110
                case 'TopicName':
111
                    $xmlReader->read();
112
                    if ($xmlReader->nodeType == \XMLReader::TEXT)
113
                    {
114
                        $topicName = $xmlReader->value;
115
                    }
116
                    break;
117
                case 'CreateTime':
118
                    $xmlReader->read();
119
                    if ($xmlReader->nodeType == \XMLReader::TEXT)
120
                    {
121
                        $createTime = $xmlReader->value;
122
                    }
123
                    break;
124
                case 'LastModifyTime':
125
                    $xmlReader->read();
126
                    if ($xmlReader->nodeType == \XMLReader::TEXT)
127
                    {
128
                        $lastModifyTime = $xmlReader->value;
129
                    }
130
                    break;
131
                }
132
            }
133
        }
134
135
        $attributes = new TopicAttributes(
136
            $maximumMessageSize,
137
            $messageRetentionPeriod,
138
            $topicName,
139
            $createTime,
140
            $lastModifyTime);
141
        return $attributes;
142
    }
143
}
144
145
?>
146