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

SetSubscriptionAttributeResponse   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 48
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\SubscriptionNotExistException;
7
use AliyunMNS\Exception\InvalidArgumentException;
8
use AliyunMNS\Responses\BaseResponse;
9
use AliyunMNS\Common\XMLParser;
10
11
class SetSubscriptionAttributeResponse 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::SUBSCRIPTION_NOT_EXIST)
39
            {
40
                throw new SubscriptionNotExistException($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
                throw $exception;
48
            }
49
            elseif ($e instanceof MnsException)
50
            {
51
                throw $e;
52
            }
53
            else
54
            {
55
                throw new MnsException($statusCode, $e->getMessage());
56
            }
57
        } catch (\Throwable $t) {
58
            throw new MnsException($statusCode, $t->getMessage());
59
        }
60
    }
61
}
62
63
?>
64