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

GetQueueAttributeResponse   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Importance

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