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

Topic   C

Complexity

Total Complexity 10

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 19

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 10
c 1
b 0
f 0
lcom 1
cbo 19
dl 0
loc 74
rs 6.875
1
<?php
2
namespace AliyunMNS;
3
4
use AliyunMNS\Http\HttpClient;
5
use AliyunMNS\AsyncCallback;
6
use AliyunMNS\Model\TopicAttributes;
7
use AliyunMNS\Model\SubscriptionAttributes;
8
use AliyunMNS\Model\UpdateSubscriptionAttributes;
9
use AliyunMNS\Requests\SetTopicAttributeRequest;
10
use AliyunMNS\Responses\SetTopicAttributeResponse;
11
use AliyunMNS\Requests\GetTopicAttributeRequest;
12
use AliyunMNS\Responses\GetTopicAttributeResponse;
13
use AliyunMNS\Requests\PublishMessageRequest;
14
use AliyunMNS\Responses\PublishMessageResponse;
15
use AliyunMNS\Requests\SubscribeRequest;
16
use AliyunMNS\Responses\SubscribeResponse;
17
use AliyunMNS\Requests\UnsubscribeRequest;
18
use AliyunMNS\Responses\UnsubscribeResponse;
19
use AliyunMNS\Requests\GetSubscriptionAttributeRequest;
20
use AliyunMNS\Responses\GetSubscriptionAttributeResponse;
21
use AliyunMNS\Requests\SetSubscriptionAttributeRequest;
22
use AliyunMNS\Responses\SetSubscriptionAttributeResponse;
23
use AliyunMNS\Requests\ListSubscriptionRequest;
24
use AliyunMNS\Responses\ListSubscriptionResponse;
25
26
class Topic
27
{
28
    private $topicName;
29
    private $client;
30
31
    public function __construct(HttpClient $client, $topicName)
32
    {
33
        $this->client = $client;
34
        $this->topicName = $topicName;
35
    }
36
37
    public function getTopicName()
38
    {
39
        return $this->topicName;
40
    }
41
42
    public function setAttribute(TopicAttributes $attributes)
43
    {
44
        $request = new SetTopicAttributeRequest($this->topicName, $attributes);
45
        $response = new SetTopicAttributeResponse();
46
        return $this->client->sendRequest($request, $response);
47
    }
48
49
    public function getAttribute()
50
    {
51
        $request = new GetTopicAttributeRequest($this->topicName);
52
        $response = new GetTopicAttributeResponse();
53
        return $this->client->sendRequest($request, $response);
54
    }
55
56
    public function publishMessage(PublishMessageRequest $request)
57
    {
58
        $request->setTopicName($this->topicName);
59
        $response = new PublishMessageResponse();
60
        return $this->client->sendRequest($request, $response);
61
    }
62
63
    public function subscribe(SubscriptionAttributes $attributes)
64
    {
65
        $attributes->setTopicName($this->topicName);
66
        $request = new SubscribeRequest($attributes);
67
        $response = new SubscribeResponse();
68
        return $this->client->sendRequest($request, $response);
69
    }
70
71
    public function unsubscribe($subscriptionName)
72
    {
73
        $request = new UnsubscribeRequest($this->topicName, $subscriptionName);
74
        $response = new UnsubscribeResponse();
75
        return $this->client->sendRequest($request, $response);
76
    }
77
78
    public function getSubscriptionAttribute($subscriptionName)
79
    {
80
        $request = new GetSubscriptionAttributeRequest($this->topicName, $subscriptionName);
81
        $response = new GetSubscriptionAttributeResponse();
82
        return $this->client->sendRequest($request, $response);
83
    }
84
85
    public function setSubscriptionAttribute(UpdateSubscriptionAttributes $attributes)
86
    {
87
        $attributes->setTopicName($this->topicName);
88
        $request = new SetSubscriptionAttributeRequest($attributes);
89
        $response = new SetSubscriptionAttributeResponse();
90
        return $this->client->sendRequest($request, $response);
91
    }
92
93
    public function listSubscription($retNum = NULL, $prefix = NULL, $marker = NULL)
94
    {
95
        $request = new ListSubscriptionRequest($this->topicName, $retNum, $prefix, $marker);
96
        $response = new ListSubscriptionResponse();
97
        return $this->client->sendRequest($request, $response);
98
    }
99
}
100
101
?>
102