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 (b10c57)
by milkmeowo
02:58
created

SetTopicAttributeResponse   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 51
rs 10
c 0
b 0
f 0
wmc 10
1
<?php
2
namespace AliyunMNS\Responses;
3
4
use AliyunMNS\Constants;
5
use AliyunMNS\Exception\MnsException;
6
use AliyunMNS\Exception\TopicNotExistException;
7
use AliyunMNS\Exception\InvalidArgumentException;
8
use AliyunMNS\Responses\BaseResponse;
9
use AliyunMNS\Common\XMLParser;
10
11
class SetTopicAttributeResponse extends BaseResponse
12
{
13
    public function __construct()
14
    {
15
    }
16
17
    public function parseResponse($statusCode, $content)
18
    {
19
        $this->statusCode = $statusCode;
20
        if ($statusCode == 204) {
21
            $this->succeed = TRUE;
22
        } else {
23
            $this->parseErrorResponse($statusCode, $content);
24
        }
25
    }
26
27
    public function parseErrorResponse($statusCode, $content, MnsException $exception = NULL)
28
    {
29
        $this->succeed = FALSE;
30
        $xmlReader = $this->loadXmlContent($content);
31
        try {
32
            $result = XMLParser::parseNormalError($xmlReader);
33
34
            if ($result['Code'] == Constants::INVALID_ARGUMENT)
35
            {
36
                throw new InvalidArgumentException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
37
            }
38
            if ($result['Code'] == Constants::TOPIC_NOT_EXIST)
39
            {
40
                throw new TopicNotExistException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
41
            }
42
            throw new MnsException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
43
        }
44
        catch (\Exception $e)
45
        {
46
            if ($exception != NULL)
47
            {
48
                throw $exception;
49
            }
50
            elseif ($e instanceof MnsException)
51
            {
52
                throw $e;
53
            }
54
            else
55
            {
56
                throw new MnsException($statusCode, $e->getMessage());
57
            }
58
        }
59
        catch (\Throwable $t)
60
        {
61
            throw new MnsException($statusCode, $t->getMessage());
62
        }
63
    }
64
}
65
66
?>
67