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

UnsubscribeResponse   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 8
1
<?php
2
namespace AliyunMNS\Responses;
3
4
use AliyunMNS\Exception\MnsException;
5
use AliyunMNS\Responses\BaseResponse;
6
use AliyunMNS\Common\XMLParser;
7
8
class UnsubscribeResponse extends BaseResponse
9
{
10
    public function __construct()
11
    {
12
    }
13
14
    public function parseResponse($statusCode, $content)
15
    {
16
        $this->statusCode = $statusCode;
17
        if ($statusCode == 204)
18
        {
19
            $this->succeed = TRUE;
20
        }
21
        else
22
        {
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
            throw new MnsException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
34
        } catch (\Exception $e) {
35
            if ($exception != NULL) {
36
                throw $exception;
37
            } elseif($e instanceof MnsException) {
38
                throw $e;
39
            } else {
40
                throw new MnsException($statusCode, $e->getMessage());
41
            }
42
        } catch (\Throwable $t) {
43
            throw new MnsException($statusCode, $t->getMessage());
44
        }
45
    }
46
}
47
48
?>
49