@@ -11,14 +11,14 @@ |
||
11 | 11 | class Meta extends AbstractMiscellaneous |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * Meta, provides information about GitHub.com, the service. |
|
16 | - * |
|
17 | - * @link https://developer.github.com/v3/meta/#meta |
|
18 | - * @return array |
|
19 | - */ |
|
20 | - public function get(): array |
|
21 | - { |
|
22 | - return $this->getApi()->request('/meta'); |
|
23 | - } |
|
14 | + /** |
|
15 | + * Meta, provides information about GitHub.com, the service. |
|
16 | + * |
|
17 | + * @link https://developer.github.com/v3/meta/#meta |
|
18 | + * @return array |
|
19 | + */ |
|
20 | + public function get(): array |
|
21 | + { |
|
22 | + return $this->getApi()->request('/meta'); |
|
23 | + } |
|
24 | 24 | } |
25 | 25 | \ No newline at end of file |
@@ -10,14 +10,14 @@ |
||
10 | 10 | class RateLimit extends AbstractMiscellaneous |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * Check your current rate limit status at any time using the Rate Limit API described below. |
|
15 | - * |
|
16 | - * @link https://developer.github.com/v3/rate_limit/#rate-limit |
|
17 | - * @return array |
|
18 | - */ |
|
19 | - public function get(): array |
|
20 | - { |
|
21 | - return $this->getApi()->request('/rate_limit'); |
|
22 | - } |
|
13 | + /** |
|
14 | + * Check your current rate limit status at any time using the Rate Limit API described below. |
|
15 | + * |
|
16 | + * @link https://developer.github.com/v3/rate_limit/#rate-limit |
|
17 | + * @return array |
|
18 | + */ |
|
19 | + public function get(): array |
|
20 | + { |
|
21 | + return $this->getApi()->request('/rate_limit'); |
|
22 | + } |
|
23 | 23 | } |
24 | 24 | \ No newline at end of file |
@@ -13,30 +13,30 @@ |
||
13 | 13 | class Licenses extends AbstractMiscellaneous |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * List all licenses |
|
18 | - * |
|
19 | - * @link https://developer.github.com/v3/licenses/#list-all-licenses |
|
20 | - * @return array |
|
21 | - */ |
|
22 | - public function listAllLicenses(): array |
|
23 | - { |
|
24 | - return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request('/licenses'); |
|
25 | - } |
|
16 | + /** |
|
17 | + * List all licenses |
|
18 | + * |
|
19 | + * @link https://developer.github.com/v3/licenses/#list-all-licenses |
|
20 | + * @return array |
|
21 | + */ |
|
22 | + public function listAllLicenses(): array |
|
23 | + { |
|
24 | + return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request('/licenses'); |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * Get an individual license |
|
29 | - * |
|
30 | - * @link https://developer.github.com/v3/licenses/#get-an-individual-license |
|
31 | - * |
|
32 | - * @param string $license |
|
33 | - * |
|
34 | - * @return array |
|
35 | - */ |
|
36 | - public function getIndividualLicense(string $license): array |
|
37 | - { |
|
38 | - return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request($this->getApi() |
|
39 | - ->sprintf('/licenses/:license', |
|
40 | - $license)); |
|
41 | - } |
|
27 | + /** |
|
28 | + * Get an individual license |
|
29 | + * |
|
30 | + * @link https://developer.github.com/v3/licenses/#get-an-individual-license |
|
31 | + * |
|
32 | + * @param string $license |
|
33 | + * |
|
34 | + * @return array |
|
35 | + */ |
|
36 | + public function getIndividualLicense(string $license): array |
|
37 | + { |
|
38 | + return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request($this->getApi() |
|
39 | + ->sprintf('/licenses/:license', |
|
40 | + $license)); |
|
41 | + } |
|
42 | 42 | } |
43 | 43 | \ No newline at end of file |
@@ -11,137 +11,137 @@ |
||
11 | 11 | class Events extends AbstractActivity |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * List public events |
|
16 | - * |
|
17 | - * @link https://developer.github.com/v3/activity/events/#list-public-events |
|
18 | - * @return array |
|
19 | - */ |
|
20 | - public function listPublicEvents(): array |
|
21 | - { |
|
22 | - return $this->getApi()->request(sprintf('/events')); |
|
23 | - } |
|
14 | + /** |
|
15 | + * List public events |
|
16 | + * |
|
17 | + * @link https://developer.github.com/v3/activity/events/#list-public-events |
|
18 | + * @return array |
|
19 | + */ |
|
20 | + public function listPublicEvents(): array |
|
21 | + { |
|
22 | + return $this->getApi()->request(sprintf('/events')); |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * List repository events |
|
27 | - * |
|
28 | - * @link https://developer.github.com/v3/activity/events/#list-repository-events |
|
29 | - * @return array |
|
30 | - */ |
|
31 | - public function listRepositoryEvents(): array |
|
32 | - { |
|
33 | - return $this->getApi()->request($this->getApi() |
|
34 | - ->sprintf('/repos/:owner/:repo/events', $this->getActivity()->getOwner(), |
|
35 | - $this->getActivity()->getRepo())); |
|
36 | - } |
|
25 | + /** |
|
26 | + * List repository events |
|
27 | + * |
|
28 | + * @link https://developer.github.com/v3/activity/events/#list-repository-events |
|
29 | + * @return array |
|
30 | + */ |
|
31 | + public function listRepositoryEvents(): array |
|
32 | + { |
|
33 | + return $this->getApi()->request($this->getApi() |
|
34 | + ->sprintf('/repos/:owner/:repo/events', $this->getActivity()->getOwner(), |
|
35 | + $this->getActivity()->getRepo())); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * List issue events for a repository |
|
40 | - * |
|
41 | - * @link https://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository |
|
42 | - * @return array |
|
43 | - */ |
|
44 | - public function listIssueEvents(): array |
|
45 | - { |
|
46 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events', |
|
47 | - $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
48 | - } |
|
38 | + /** |
|
39 | + * List issue events for a repository |
|
40 | + * |
|
41 | + * @link https://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository |
|
42 | + * @return array |
|
43 | + */ |
|
44 | + public function listIssueEvents(): array |
|
45 | + { |
|
46 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events', |
|
47 | + $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * List public events for a network of repositories |
|
52 | - * |
|
53 | - * @link https://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories |
|
54 | - * @return array |
|
55 | - */ |
|
56 | - public function listPublicNetworkEvents(): array |
|
57 | - { |
|
58 | - return $this->getApi()->request($this->getApi()->sprintf('/networks/:owner/:repo/events', |
|
59 | - $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
60 | - } |
|
50 | + /** |
|
51 | + * List public events for a network of repositories |
|
52 | + * |
|
53 | + * @link https://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories |
|
54 | + * @return array |
|
55 | + */ |
|
56 | + public function listPublicNetworkEvents(): array |
|
57 | + { |
|
58 | + return $this->getApi()->request($this->getApi()->sprintf('/networks/:owner/:repo/events', |
|
59 | + $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * List public events for an organization |
|
64 | - * |
|
65 | - * @link https://developer.github.com/v3/activity/events/#list-public-events-for-an-organization |
|
66 | - * |
|
67 | - * @param string $organization |
|
68 | - * |
|
69 | - * @return array |
|
70 | - */ |
|
71 | - public function listPublicOrganizationEvents(string $organization): array |
|
72 | - { |
|
73 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/events', $organization)); |
|
74 | - } |
|
62 | + /** |
|
63 | + * List public events for an organization |
|
64 | + * |
|
65 | + * @link https://developer.github.com/v3/activity/events/#list-public-events-for-an-organization |
|
66 | + * |
|
67 | + * @param string $organization |
|
68 | + * |
|
69 | + * @return array |
|
70 | + */ |
|
71 | + public function listPublicOrganizationEvents(string $organization): array |
|
72 | + { |
|
73 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/events', $organization)); |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * List events that a user has received |
|
78 | - * |
|
79 | - * @link https://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received |
|
80 | - * |
|
81 | - * @param string $username |
|
82 | - * |
|
83 | - * @return array |
|
84 | - */ |
|
85 | - public function listUserReceiveEvents(string $username): array |
|
86 | - { |
|
87 | - return $this->getApi()->request($this->getApi()->sprintf('/users/:username/received_events', $username)); |
|
88 | - } |
|
76 | + /** |
|
77 | + * List events that a user has received |
|
78 | + * |
|
79 | + * @link https://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received |
|
80 | + * |
|
81 | + * @param string $username |
|
82 | + * |
|
83 | + * @return array |
|
84 | + */ |
|
85 | + public function listUserReceiveEvents(string $username): array |
|
86 | + { |
|
87 | + return $this->getApi()->request($this->getApi()->sprintf('/users/:username/received_events', $username)); |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * List public events that a user has received |
|
92 | - * |
|
93 | - * @link https://developer.github.com/v3/activity/events/#list-public-events-that-a-user-has-received |
|
94 | - * |
|
95 | - * @param string $username |
|
96 | - * |
|
97 | - * @return array |
|
98 | - */ |
|
99 | - public function listPublicUserReceiveEvents(string $username): array |
|
100 | - { |
|
101 | - return $this->getApi()->request($this->getApi()->sprintf('/users/:username/received_events/public', $username)); |
|
102 | - } |
|
90 | + /** |
|
91 | + * List public events that a user has received |
|
92 | + * |
|
93 | + * @link https://developer.github.com/v3/activity/events/#list-public-events-that-a-user-has-received |
|
94 | + * |
|
95 | + * @param string $username |
|
96 | + * |
|
97 | + * @return array |
|
98 | + */ |
|
99 | + public function listPublicUserReceiveEvents(string $username): array |
|
100 | + { |
|
101 | + return $this->getApi()->request($this->getApi()->sprintf('/users/:username/received_events/public', $username)); |
|
102 | + } |
|
103 | 103 | |
104 | - /** |
|
105 | - * List events performed by a user |
|
106 | - * |
|
107 | - * @link https://developer.github.com/v3/activity/events/#list-events-performed-by-a-user |
|
108 | - * |
|
109 | - * @param string $username |
|
110 | - * |
|
111 | - * @return array |
|
112 | - */ |
|
113 | - public function listUserPerformedEvents(string $username): array |
|
114 | - { |
|
115 | - return $this->getApi()->request($this->getApi()->sprintf('/users/:username/events', $username)); |
|
116 | - } |
|
104 | + /** |
|
105 | + * List events performed by a user |
|
106 | + * |
|
107 | + * @link https://developer.github.com/v3/activity/events/#list-events-performed-by-a-user |
|
108 | + * |
|
109 | + * @param string $username |
|
110 | + * |
|
111 | + * @return array |
|
112 | + */ |
|
113 | + public function listUserPerformedEvents(string $username): array |
|
114 | + { |
|
115 | + return $this->getApi()->request($this->getApi()->sprintf('/users/:username/events', $username)); |
|
116 | + } |
|
117 | 117 | |
118 | - /** |
|
119 | - * List public events performed by a user |
|
120 | - * |
|
121 | - * @link https://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user |
|
122 | - * |
|
123 | - * @param string $username |
|
124 | - * |
|
125 | - * @return array |
|
126 | - */ |
|
127 | - public function listPublicUserPerformedEvents(string $username): array |
|
128 | - { |
|
129 | - return $this->getApi()->request($this->getApi()->sprintf('/users/:username/events/public', $username)); |
|
130 | - } |
|
118 | + /** |
|
119 | + * List public events performed by a user |
|
120 | + * |
|
121 | + * @link https://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user |
|
122 | + * |
|
123 | + * @param string $username |
|
124 | + * |
|
125 | + * @return array |
|
126 | + */ |
|
127 | + public function listPublicUserPerformedEvents(string $username): array |
|
128 | + { |
|
129 | + return $this->getApi()->request($this->getApi()->sprintf('/users/:username/events/public', $username)); |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * List events for an organization |
|
134 | - * |
|
135 | - * @link https://developer.github.com/v3/activity/events/#list-events-for-an-organization |
|
136 | - * |
|
137 | - * @param string $username |
|
138 | - * @param string $organization |
|
139 | - * |
|
140 | - * @return array |
|
141 | - */ |
|
142 | - public function listOrganizationEvents(string $username, string $organization): array |
|
143 | - { |
|
144 | - return $this->getApi()->request($this->getApi() |
|
145 | - ->sprintf('/users/:username/events/orgs/:org', $username, $organization)); |
|
146 | - } |
|
132 | + /** |
|
133 | + * List events for an organization |
|
134 | + * |
|
135 | + * @link https://developer.github.com/v3/activity/events/#list-events-for-an-organization |
|
136 | + * |
|
137 | + * @param string $username |
|
138 | + * @param string $organization |
|
139 | + * |
|
140 | + * @return array |
|
141 | + */ |
|
142 | + public function listOrganizationEvents(string $username, string $organization): array |
|
143 | + { |
|
144 | + return $this->getApi()->request($this->getApi() |
|
145 | + ->sprintf('/users/:username/events/orgs/:org', $username, $organization)); |
|
146 | + } |
|
147 | 147 | } |
148 | 148 | \ No newline at end of file |
@@ -14,167 +14,167 @@ |
||
14 | 14 | class Notifications extends AbstractActivity |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * List your notifications |
|
19 | - * |
|
20 | - * @link https://developer.github.com/v3/activity/notifications/#list-your-notifications |
|
21 | - * |
|
22 | - * @param bool $all |
|
23 | - * @param bool $participating |
|
24 | - * @param string $since |
|
25 | - * @param string $before |
|
26 | - * |
|
27 | - * @return array |
|
28 | - * @throws \Exception |
|
29 | - */ |
|
30 | - public function listNotifications(bool $all = false, bool $participating = false, string $since = 'now', |
|
31 | - string $before = null): array |
|
32 | - { |
|
33 | - return $this->getApi()->request($this->getApi()->sprintf('/notifications?:args', http_build_query([ |
|
34 | - 'all' => $all, |
|
35 | - 'participating' => $participating, |
|
36 | - 'since' => (new DateTime($since))->format(DateTime::ATOM), |
|
37 | - 'before' => (new DateTime($before))->format(DateTime::ATOM) |
|
38 | - ]))); |
|
39 | - } |
|
17 | + /** |
|
18 | + * List your notifications |
|
19 | + * |
|
20 | + * @link https://developer.github.com/v3/activity/notifications/#list-your-notifications |
|
21 | + * |
|
22 | + * @param bool $all |
|
23 | + * @param bool $participating |
|
24 | + * @param string $since |
|
25 | + * @param string $before |
|
26 | + * |
|
27 | + * @return array |
|
28 | + * @throws \Exception |
|
29 | + */ |
|
30 | + public function listNotifications(bool $all = false, bool $participating = false, string $since = 'now', |
|
31 | + string $before = null): array |
|
32 | + { |
|
33 | + return $this->getApi()->request($this->getApi()->sprintf('/notifications?:args', http_build_query([ |
|
34 | + 'all' => $all, |
|
35 | + 'participating' => $participating, |
|
36 | + 'since' => (new DateTime($since))->format(DateTime::ATOM), |
|
37 | + 'before' => (new DateTime($before))->format(DateTime::ATOM) |
|
38 | + ]))); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * List your notifications in a repository |
|
43 | - * |
|
44 | - * @link https://developer.github.com/v3/activity/notifications/#list-your-notifications-in-a-repository |
|
45 | - * |
|
46 | - * @param bool $all |
|
47 | - * @param bool $participating |
|
48 | - * @param string $since |
|
49 | - * @param string $before |
|
50 | - * |
|
51 | - * @return array |
|
52 | - * @throws \Exception |
|
53 | - */ |
|
54 | - public function listRepositoryNotifications(bool $all = false, bool $participating = false, string $since = 'now', |
|
55 | - string $before = null): array |
|
56 | - { |
|
57 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/notifications?:args', |
|
58 | - $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), http_build_query([ |
|
59 | - 'all' => $all, |
|
60 | - 'participating' => $participating, |
|
61 | - 'since' => (new DateTime($since))->format(DateTime::ATOM), |
|
62 | - 'before' => (new DateTime($before))->format(DateTime::ATOM) |
|
63 | - ]))); |
|
64 | - } |
|
41 | + /** |
|
42 | + * List your notifications in a repository |
|
43 | + * |
|
44 | + * @link https://developer.github.com/v3/activity/notifications/#list-your-notifications-in-a-repository |
|
45 | + * |
|
46 | + * @param bool $all |
|
47 | + * @param bool $participating |
|
48 | + * @param string $since |
|
49 | + * @param string $before |
|
50 | + * |
|
51 | + * @return array |
|
52 | + * @throws \Exception |
|
53 | + */ |
|
54 | + public function listRepositoryNotifications(bool $all = false, bool $participating = false, string $since = 'now', |
|
55 | + string $before = null): array |
|
56 | + { |
|
57 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/notifications?:args', |
|
58 | + $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), http_build_query([ |
|
59 | + 'all' => $all, |
|
60 | + 'participating' => $participating, |
|
61 | + 'since' => (new DateTime($since))->format(DateTime::ATOM), |
|
62 | + 'before' => (new DateTime($before))->format(DateTime::ATOM) |
|
63 | + ]))); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * Mark as read |
|
68 | - * |
|
69 | - * @link https://developer.github.com/v3/activity/notifications/#mark-as-read |
|
70 | - * |
|
71 | - * @param string $lastReadAt |
|
72 | - * |
|
73 | - * @return array |
|
74 | - */ |
|
75 | - public function markAsRead(string $lastReadAt = 'now'): array |
|
76 | - { |
|
77 | - return $this->getApi()->request($this->getApi()->sprintf('/notifications?:args', |
|
78 | - http_build_query(['last_read_at' => (new DateTime($lastReadAt))->format(DateTime::ATOM)])), |
|
79 | - Request::METHOD_PUT); |
|
80 | - } |
|
66 | + /** |
|
67 | + * Mark as read |
|
68 | + * |
|
69 | + * @link https://developer.github.com/v3/activity/notifications/#mark-as-read |
|
70 | + * |
|
71 | + * @param string $lastReadAt |
|
72 | + * |
|
73 | + * @return array |
|
74 | + */ |
|
75 | + public function markAsRead(string $lastReadAt = 'now'): array |
|
76 | + { |
|
77 | + return $this->getApi()->request($this->getApi()->sprintf('/notifications?:args', |
|
78 | + http_build_query(['last_read_at' => (new DateTime($lastReadAt))->format(DateTime::ATOM)])), |
|
79 | + Request::METHOD_PUT); |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * Mark notifications as read in a repository |
|
84 | - * |
|
85 | - * @link https://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository |
|
86 | - * |
|
87 | - * @param string $lastReadAt |
|
88 | - * |
|
89 | - * @return array |
|
90 | - */ |
|
91 | - public function markAsReadInRepository(string $lastReadAt = 'now'): array |
|
92 | - { |
|
93 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/notifications?:args', |
|
94 | - $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), |
|
95 | - http_build_query(['last_read_at' => (new DateTime($lastReadAt))->format(DateTime::ATOM)])), |
|
96 | - Request::METHOD_PUT); |
|
97 | - } |
|
82 | + /** |
|
83 | + * Mark notifications as read in a repository |
|
84 | + * |
|
85 | + * @link https://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository |
|
86 | + * |
|
87 | + * @param string $lastReadAt |
|
88 | + * |
|
89 | + * @return array |
|
90 | + */ |
|
91 | + public function markAsReadInRepository(string $lastReadAt = 'now'): array |
|
92 | + { |
|
93 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/notifications?:args', |
|
94 | + $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), |
|
95 | + http_build_query(['last_read_at' => (new DateTime($lastReadAt))->format(DateTime::ATOM)])), |
|
96 | + Request::METHOD_PUT); |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - *View a single thread |
|
101 | - * |
|
102 | - * @link https://developer.github.com/v3/activity/notifications/#view-a-single-thread |
|
103 | - * |
|
104 | - * @param int $id |
|
105 | - * |
|
106 | - * @return array |
|
107 | - */ |
|
108 | - public function viewThread(int $id): array |
|
109 | - { |
|
110 | - return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id', (string)$id)); |
|
111 | - } |
|
99 | + /** |
|
100 | + *View a single thread |
|
101 | + * |
|
102 | + * @link https://developer.github.com/v3/activity/notifications/#view-a-single-thread |
|
103 | + * |
|
104 | + * @param int $id |
|
105 | + * |
|
106 | + * @return array |
|
107 | + */ |
|
108 | + public function viewThread(int $id): array |
|
109 | + { |
|
110 | + return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id', (string)$id)); |
|
111 | + } |
|
112 | 112 | |
113 | - /** |
|
114 | - * Mark a thread as read |
|
115 | - * |
|
116 | - * @link https://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read |
|
117 | - * |
|
118 | - * @param int $id |
|
119 | - * |
|
120 | - * @return array |
|
121 | - */ |
|
122 | - public function markThreadAsRead(int $id): array |
|
123 | - { |
|
124 | - return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id', (string)$id), |
|
125 | - Request::METHOD_PATCH); |
|
126 | - } |
|
113 | + /** |
|
114 | + * Mark a thread as read |
|
115 | + * |
|
116 | + * @link https://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read |
|
117 | + * |
|
118 | + * @param int $id |
|
119 | + * |
|
120 | + * @return array |
|
121 | + */ |
|
122 | + public function markThreadAsRead(int $id): array |
|
123 | + { |
|
124 | + return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id', (string)$id), |
|
125 | + Request::METHOD_PATCH); |
|
126 | + } |
|
127 | 127 | |
128 | - /** |
|
129 | - * Get a Thread Subscription |
|
130 | - * |
|
131 | - * @link https://developer.github.com/v3/activity/notifications/#get-a-thread-subscription |
|
132 | - * |
|
133 | - * @param int $id |
|
134 | - * |
|
135 | - * @return array |
|
136 | - */ |
|
137 | - public function getThreadSubscription(int $id): array |
|
138 | - { |
|
139 | - return $this->getApi()->request($this->getApi() |
|
140 | - ->sprintf('/notifications/threads/:id/subscription', (string)$id)); |
|
141 | - } |
|
128 | + /** |
|
129 | + * Get a Thread Subscription |
|
130 | + * |
|
131 | + * @link https://developer.github.com/v3/activity/notifications/#get-a-thread-subscription |
|
132 | + * |
|
133 | + * @param int $id |
|
134 | + * |
|
135 | + * @return array |
|
136 | + */ |
|
137 | + public function getThreadSubscription(int $id): array |
|
138 | + { |
|
139 | + return $this->getApi()->request($this->getApi() |
|
140 | + ->sprintf('/notifications/threads/:id/subscription', (string)$id)); |
|
141 | + } |
|
142 | 142 | |
143 | - /** |
|
144 | - * Set a Thread Subscription |
|
145 | - * |
|
146 | - * @link https://developer.github.com/v3/activity/notifications/#set-a-thread-subscription |
|
147 | - * |
|
148 | - * @param int $id |
|
149 | - * @param bool $subscribed |
|
150 | - * @param bool $ignored |
|
151 | - * |
|
152 | - * @return array |
|
153 | - */ |
|
154 | - public function setThreadSubscription(int $id, bool $subscribed = false, bool $ignored = false): array |
|
155 | - { |
|
156 | - return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id/subscription?:args', $id, |
|
157 | - http_build_query(['subscribed' => $subscribed, 'ignored' => $ignored])), Request::METHOD_PUT); |
|
158 | - } |
|
143 | + /** |
|
144 | + * Set a Thread Subscription |
|
145 | + * |
|
146 | + * @link https://developer.github.com/v3/activity/notifications/#set-a-thread-subscription |
|
147 | + * |
|
148 | + * @param int $id |
|
149 | + * @param bool $subscribed |
|
150 | + * @param bool $ignored |
|
151 | + * |
|
152 | + * @return array |
|
153 | + */ |
|
154 | + public function setThreadSubscription(int $id, bool $subscribed = false, bool $ignored = false): array |
|
155 | + { |
|
156 | + return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id/subscription?:args', $id, |
|
157 | + http_build_query(['subscribed' => $subscribed, 'ignored' => $ignored])), Request::METHOD_PUT); |
|
158 | + } |
|
159 | 159 | |
160 | - /** |
|
161 | - * Delete a Thread Subscription |
|
162 | - * |
|
163 | - * @link https://developer.github.com/v3/activity/notifications/#delete-a-thread-subscription |
|
164 | - * |
|
165 | - * @param int $id |
|
166 | - * |
|
167 | - * @return bool |
|
168 | - */ |
|
169 | - public function deleteThreadSubscription(int $id): bool |
|
170 | - { |
|
171 | - $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id/subscription', (string)$id), |
|
172 | - Request::METHOD_DELETE); |
|
160 | + /** |
|
161 | + * Delete a Thread Subscription |
|
162 | + * |
|
163 | + * @link https://developer.github.com/v3/activity/notifications/#delete-a-thread-subscription |
|
164 | + * |
|
165 | + * @param int $id |
|
166 | + * |
|
167 | + * @return bool |
|
168 | + */ |
|
169 | + public function deleteThreadSubscription(int $id): bool |
|
170 | + { |
|
171 | + $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id/subscription', (string)$id), |
|
172 | + Request::METHOD_DELETE); |
|
173 | 173 | |
174 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
175 | - return true; |
|
176 | - } |
|
174 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
175 | + return true; |
|
176 | + } |
|
177 | 177 | |
178 | - return false; |
|
179 | - } |
|
178 | + return false; |
|
179 | + } |
|
180 | 180 | } |
181 | 181 | \ No newline at end of file |
@@ -10,14 +10,14 @@ |
||
10 | 10 | class Feeds extends AbstractActivity |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * List Feeds |
|
15 | - * |
|
16 | - * @link https://developer.github.com/v3/activity/feeds/#list-feeds |
|
17 | - * @return array |
|
18 | - */ |
|
19 | - public function listFeeds(): array |
|
20 | - { |
|
21 | - return $this->getApi()->request(sprintf('/feeds')); |
|
22 | - } |
|
13 | + /** |
|
14 | + * List Feeds |
|
15 | + * |
|
16 | + * @link https://developer.github.com/v3/activity/feeds/#list-feeds |
|
17 | + * @return array |
|
18 | + */ |
|
19 | + public function listFeeds(): array |
|
20 | + { |
|
21 | + return $this->getApi()->request(sprintf('/feeds')); |
|
22 | + } |
|
23 | 23 | } |
24 | 24 | \ No newline at end of file |
@@ -13,143 +13,143 @@ |
||
13 | 13 | class Watching extends AbstractActivity |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * List watchers |
|
18 | - * |
|
19 | - * @link https://developer.github.com/v3/activity/watching/#list-watchers |
|
20 | - * @return array |
|
21 | - */ |
|
22 | - public function listWatchers(): array |
|
23 | - { |
|
24 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/subscribers', |
|
25 | - $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
26 | - } |
|
27 | - |
|
28 | - /** |
|
29 | - * List repositories being watched |
|
30 | - * |
|
31 | - * @link https://developer.github.com/v3/activity/watching/#list-repositories-being-watched |
|
32 | - * |
|
33 | - * @param string $username |
|
34 | - * |
|
35 | - * @return array |
|
36 | - */ |
|
37 | - public function listSubscriptions(string $username = null): array |
|
38 | - { |
|
39 | - if (null !== $username) { |
|
40 | - return $this->getApi()->request($this->getApi()->sprintf('/users/:username/subscriptions', |
|
41 | - $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), $username)); |
|
42 | - } |
|
43 | - |
|
44 | - return $this->getApi()->request($this->getApi() |
|
45 | - ->sprintf('/user/subscriptions', $this->getActivity()->getOwner(), |
|
46 | - $this->getActivity()->getRepo())); |
|
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * Get a Repository Subscription |
|
51 | - * |
|
52 | - * @link https://developer.github.com/v3/activity/watching/#get-a-repository-subscription |
|
53 | - * @return array |
|
54 | - */ |
|
55 | - public function getRepositorySubscription(): array |
|
56 | - { |
|
57 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/subscription', |
|
58 | - $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * Set a Repository Subscription |
|
63 | - * |
|
64 | - * @link https://developer.github.com/v3/activity/watching/#set-a-repository-subscription |
|
65 | - * |
|
66 | - * @param bool $subscribed |
|
67 | - * @param bool $ignored |
|
68 | - * |
|
69 | - * @return array |
|
70 | - */ |
|
71 | - public function setRepositorySubscription(bool $subscribed = false, bool $ignored = false): array |
|
72 | - { |
|
73 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/subscription?:args', |
|
74 | - $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), http_build_query([ |
|
75 | - 'subscribed' => $subscribed, |
|
76 | - 'ignored' => $ignored |
|
77 | - ])), Request::METHOD_PUT); |
|
78 | - } |
|
79 | - |
|
80 | - /** |
|
81 | - * Delete a Repository Subscription |
|
82 | - * |
|
83 | - * @link https://developer.github.com/v3/activity/watching/#delete-a-repository-subscription |
|
84 | - * @return bool |
|
85 | - */ |
|
86 | - public function deleteRepositorySubscription(): bool |
|
87 | - { |
|
88 | - $this->getApi()->request($this->getApi() |
|
89 | - ->sprintf('/repos/:owner/:repo/subscription', $this->getActivity()->getOwner(), |
|
90 | - $this->getActivity()->getRepo()), Request::METHOD_DELETE); |
|
91 | - |
|
92 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
93 | - return true; |
|
94 | - } |
|
95 | - |
|
96 | - return false; |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * Check if you are watching a repository (LEGACY) |
|
101 | - * |
|
102 | - * @link https://developer.github.com/v3/activity/watching/#check-if-you-are-watching-a-repository-legacy |
|
103 | - * @return bool |
|
104 | - */ |
|
105 | - public function userSubscriptions(): bool |
|
106 | - { |
|
107 | - $this->getApi()->request($this->getApi() |
|
108 | - ->sprintf('/user/subscriptions/:owner/:repo', $this->getActivity()->getOwner(), |
|
109 | - $this->getActivity()->getRepo())); |
|
110 | - |
|
111 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
112 | - return true; |
|
113 | - } |
|
114 | - |
|
115 | - return false; |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * Watch a repository (LEGACY) |
|
120 | - * |
|
121 | - * @link https://developer.github.com/v3/activity/watching/#watch-a-repository-legacy |
|
122 | - * @return bool |
|
123 | - */ |
|
124 | - public function watchRepository(): bool |
|
125 | - { |
|
126 | - $this->getApi()->request($this->getApi() |
|
127 | - ->sprintf('/user/subscriptions/:owner/:repo', $this->getActivity()->getOwner(), |
|
128 | - $this->getActivity()->getRepo()), Request::METHOD_PUT); |
|
129 | - |
|
130 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
131 | - return true; |
|
132 | - } |
|
133 | - |
|
134 | - return false; |
|
135 | - } |
|
136 | - |
|
137 | - /** |
|
138 | - * Stop watching a repository (LEGACY) |
|
139 | - * |
|
140 | - * @link https://developer.github.com/v3/activity/watching/#stop-watching-a-repository-legacy |
|
141 | - * @return bool |
|
142 | - */ |
|
143 | - public function stopWatchingRepository(): bool |
|
144 | - { |
|
145 | - $this->getApi()->request($this->getApi() |
|
146 | - ->sprintf('/user/subscriptions/:owner/:repo', $this->getActivity()->getOwner(), |
|
147 | - $this->getActivity()->getRepo()), Request::METHOD_DELETE); |
|
148 | - |
|
149 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
150 | - return true; |
|
151 | - } |
|
152 | - |
|
153 | - return false; |
|
154 | - } |
|
16 | + /** |
|
17 | + * List watchers |
|
18 | + * |
|
19 | + * @link https://developer.github.com/v3/activity/watching/#list-watchers |
|
20 | + * @return array |
|
21 | + */ |
|
22 | + public function listWatchers(): array |
|
23 | + { |
|
24 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/subscribers', |
|
25 | + $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
26 | + } |
|
27 | + |
|
28 | + /** |
|
29 | + * List repositories being watched |
|
30 | + * |
|
31 | + * @link https://developer.github.com/v3/activity/watching/#list-repositories-being-watched |
|
32 | + * |
|
33 | + * @param string $username |
|
34 | + * |
|
35 | + * @return array |
|
36 | + */ |
|
37 | + public function listSubscriptions(string $username = null): array |
|
38 | + { |
|
39 | + if (null !== $username) { |
|
40 | + return $this->getApi()->request($this->getApi()->sprintf('/users/:username/subscriptions', |
|
41 | + $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), $username)); |
|
42 | + } |
|
43 | + |
|
44 | + return $this->getApi()->request($this->getApi() |
|
45 | + ->sprintf('/user/subscriptions', $this->getActivity()->getOwner(), |
|
46 | + $this->getActivity()->getRepo())); |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * Get a Repository Subscription |
|
51 | + * |
|
52 | + * @link https://developer.github.com/v3/activity/watching/#get-a-repository-subscription |
|
53 | + * @return array |
|
54 | + */ |
|
55 | + public function getRepositorySubscription(): array |
|
56 | + { |
|
57 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/subscription', |
|
58 | + $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * Set a Repository Subscription |
|
63 | + * |
|
64 | + * @link https://developer.github.com/v3/activity/watching/#set-a-repository-subscription |
|
65 | + * |
|
66 | + * @param bool $subscribed |
|
67 | + * @param bool $ignored |
|
68 | + * |
|
69 | + * @return array |
|
70 | + */ |
|
71 | + public function setRepositorySubscription(bool $subscribed = false, bool $ignored = false): array |
|
72 | + { |
|
73 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/subscription?:args', |
|
74 | + $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), http_build_query([ |
|
75 | + 'subscribed' => $subscribed, |
|
76 | + 'ignored' => $ignored |
|
77 | + ])), Request::METHOD_PUT); |
|
78 | + } |
|
79 | + |
|
80 | + /** |
|
81 | + * Delete a Repository Subscription |
|
82 | + * |
|
83 | + * @link https://developer.github.com/v3/activity/watching/#delete-a-repository-subscription |
|
84 | + * @return bool |
|
85 | + */ |
|
86 | + public function deleteRepositorySubscription(): bool |
|
87 | + { |
|
88 | + $this->getApi()->request($this->getApi() |
|
89 | + ->sprintf('/repos/:owner/:repo/subscription', $this->getActivity()->getOwner(), |
|
90 | + $this->getActivity()->getRepo()), Request::METHOD_DELETE); |
|
91 | + |
|
92 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
93 | + return true; |
|
94 | + } |
|
95 | + |
|
96 | + return false; |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * Check if you are watching a repository (LEGACY) |
|
101 | + * |
|
102 | + * @link https://developer.github.com/v3/activity/watching/#check-if-you-are-watching-a-repository-legacy |
|
103 | + * @return bool |
|
104 | + */ |
|
105 | + public function userSubscriptions(): bool |
|
106 | + { |
|
107 | + $this->getApi()->request($this->getApi() |
|
108 | + ->sprintf('/user/subscriptions/:owner/:repo', $this->getActivity()->getOwner(), |
|
109 | + $this->getActivity()->getRepo())); |
|
110 | + |
|
111 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
112 | + return true; |
|
113 | + } |
|
114 | + |
|
115 | + return false; |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * Watch a repository (LEGACY) |
|
120 | + * |
|
121 | + * @link https://developer.github.com/v3/activity/watching/#watch-a-repository-legacy |
|
122 | + * @return bool |
|
123 | + */ |
|
124 | + public function watchRepository(): bool |
|
125 | + { |
|
126 | + $this->getApi()->request($this->getApi() |
|
127 | + ->sprintf('/user/subscriptions/:owner/:repo', $this->getActivity()->getOwner(), |
|
128 | + $this->getActivity()->getRepo()), Request::METHOD_PUT); |
|
129 | + |
|
130 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
131 | + return true; |
|
132 | + } |
|
133 | + |
|
134 | + return false; |
|
135 | + } |
|
136 | + |
|
137 | + /** |
|
138 | + * Stop watching a repository (LEGACY) |
|
139 | + * |
|
140 | + * @link https://developer.github.com/v3/activity/watching/#stop-watching-a-repository-legacy |
|
141 | + * @return bool |
|
142 | + */ |
|
143 | + public function stopWatchingRepository(): bool |
|
144 | + { |
|
145 | + $this->getApi()->request($this->getApi() |
|
146 | + ->sprintf('/user/subscriptions/:owner/:repo', $this->getActivity()->getOwner(), |
|
147 | + $this->getActivity()->getRepo()), Request::METHOD_DELETE); |
|
148 | + |
|
149 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
150 | + return true; |
|
151 | + } |
|
152 | + |
|
153 | + return false; |
|
154 | + } |
|
155 | 155 | } |
156 | 156 | \ No newline at end of file |
@@ -13,95 +13,95 @@ |
||
13 | 13 | class Starring extends AbstractActivity |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * List Stargazers |
|
18 | - * |
|
19 | - * @link https://developer.github.com/v3/activity/starring/#list-stargazers |
|
20 | - * @return array |
|
21 | - */ |
|
22 | - public function listStargazers(): array |
|
23 | - { |
|
24 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stargazers', |
|
25 | - $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
26 | - } |
|
16 | + /** |
|
17 | + * List Stargazers |
|
18 | + * |
|
19 | + * @link https://developer.github.com/v3/activity/starring/#list-stargazers |
|
20 | + * @return array |
|
21 | + */ |
|
22 | + public function listStargazers(): array |
|
23 | + { |
|
24 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stargazers', |
|
25 | + $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * List repositories being starred |
|
30 | - * |
|
31 | - * @link https://developer.github.com/v3/activity/starring/#list-repositories-being-starred |
|
32 | - * |
|
33 | - * @param string $sort |
|
34 | - * @param string $direction |
|
35 | - * @param string $username |
|
36 | - * |
|
37 | - * @return array |
|
38 | - */ |
|
39 | - public function listRepositories(string $sort = AbstractApi::SORT_CREATED, |
|
40 | - string $direction = AbstractApi::DIRECTION_DESC, string $username = null): array |
|
41 | - { |
|
42 | - if (null !== $username) { |
|
43 | - return $this->getApi()->request($this->getApi()->sprintf('/users/:username/starred?:args', $username, |
|
44 | - http_build_query(['sort' => $sort, 'direction' => $direction]))); |
|
45 | - } |
|
28 | + /** |
|
29 | + * List repositories being starred |
|
30 | + * |
|
31 | + * @link https://developer.github.com/v3/activity/starring/#list-repositories-being-starred |
|
32 | + * |
|
33 | + * @param string $sort |
|
34 | + * @param string $direction |
|
35 | + * @param string $username |
|
36 | + * |
|
37 | + * @return array |
|
38 | + */ |
|
39 | + public function listRepositories(string $sort = AbstractApi::SORT_CREATED, |
|
40 | + string $direction = AbstractApi::DIRECTION_DESC, string $username = null): array |
|
41 | + { |
|
42 | + if (null !== $username) { |
|
43 | + return $this->getApi()->request($this->getApi()->sprintf('/users/:username/starred?:args', $username, |
|
44 | + http_build_query(['sort' => $sort, 'direction' => $direction]))); |
|
45 | + } |
|
46 | 46 | |
47 | - return $this->getApi()->request($this->getApi()->sprintf('/user/starred?:args', |
|
48 | - http_build_query(['sort' => $sort, 'direction' => $direction]))); |
|
49 | - } |
|
47 | + return $this->getApi()->request($this->getApi()->sprintf('/user/starred?:args', |
|
48 | + http_build_query(['sort' => $sort, 'direction' => $direction]))); |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Check if you are starring a repository |
|
53 | - * |
|
54 | - * @link https://developer.github.com/v3/activity/starring/#check-if-you-are-starring-a-repository |
|
55 | - * @return bool |
|
56 | - */ |
|
57 | - public function checkYouAreStarringRepository(): bool |
|
58 | - { |
|
59 | - $this->getApi()->request($this->getApi() |
|
60 | - ->sprintf('/user/starred/:owner/:repo', $this->getActivity()->getOwner(), |
|
61 | - $this->getActivity()->getRepo())); |
|
51 | + /** |
|
52 | + * Check if you are starring a repository |
|
53 | + * |
|
54 | + * @link https://developer.github.com/v3/activity/starring/#check-if-you-are-starring-a-repository |
|
55 | + * @return bool |
|
56 | + */ |
|
57 | + public function checkYouAreStarringRepository(): bool |
|
58 | + { |
|
59 | + $this->getApi()->request($this->getApi() |
|
60 | + ->sprintf('/user/starred/:owner/:repo', $this->getActivity()->getOwner(), |
|
61 | + $this->getActivity()->getRepo())); |
|
62 | 62 | |
63 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
64 | - return true; |
|
65 | - } |
|
63 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
64 | + return true; |
|
65 | + } |
|
66 | 66 | |
67 | - return false; |
|
68 | - } |
|
67 | + return false; |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * Star a repository |
|
72 | - * |
|
73 | - * @link https://developer.github.com/v3/activity/starring/#star-a-repository |
|
74 | - * @return bool |
|
75 | - */ |
|
76 | - public function starRepository(): bool |
|
77 | - { |
|
78 | - $this->getApi()->request($this->getApi() |
|
79 | - ->sprintf('/user/starred/:owner/:repo', $this->getActivity()->getOwner(), |
|
80 | - $this->getActivity()->getRepo()), Request::METHOD_PUT); |
|
70 | + /** |
|
71 | + * Star a repository |
|
72 | + * |
|
73 | + * @link https://developer.github.com/v3/activity/starring/#star-a-repository |
|
74 | + * @return bool |
|
75 | + */ |
|
76 | + public function starRepository(): bool |
|
77 | + { |
|
78 | + $this->getApi()->request($this->getApi() |
|
79 | + ->sprintf('/user/starred/:owner/:repo', $this->getActivity()->getOwner(), |
|
80 | + $this->getActivity()->getRepo()), Request::METHOD_PUT); |
|
81 | 81 | |
82 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
83 | - return true; |
|
84 | - } |
|
82 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
83 | + return true; |
|
84 | + } |
|
85 | 85 | |
86 | - return false; |
|
87 | - } |
|
86 | + return false; |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * Unstar a repository |
|
91 | - * |
|
92 | - * @link https://developer.github.com/v3/activity/starring/#unstar-a-repository |
|
93 | - * @return bool |
|
94 | - */ |
|
95 | - public function unStarRepository(): bool |
|
96 | - { |
|
97 | - $this->getApi()->request($this->getApi() |
|
98 | - ->sprintf('/user/starred/:owner/:repo', $this->getActivity()->getOwner(), |
|
99 | - $this->getActivity()->getRepo()), Request::METHOD_DELETE); |
|
89 | + /** |
|
90 | + * Unstar a repository |
|
91 | + * |
|
92 | + * @link https://developer.github.com/v3/activity/starring/#unstar-a-repository |
|
93 | + * @return bool |
|
94 | + */ |
|
95 | + public function unStarRepository(): bool |
|
96 | + { |
|
97 | + $this->getApi()->request($this->getApi() |
|
98 | + ->sprintf('/user/starred/:owner/:repo', $this->getActivity()->getOwner(), |
|
99 | + $this->getActivity()->getRepo()), Request::METHOD_DELETE); |
|
100 | 100 | |
101 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
102 | - return true; |
|
103 | - } |
|
101 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
102 | + return true; |
|
103 | + } |
|
104 | 104 | |
105 | - return false; |
|
106 | - } |
|
105 | + return false; |
|
106 | + } |
|
107 | 107 | } |
108 | 108 | \ No newline at end of file |
@@ -14,126 +14,126 @@ |
||
14 | 14 | class ReviewComments extends AbstractPullRequests |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * List comments on a pull request |
|
19 | - * |
|
20 | - * @link https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request |
|
21 | - * |
|
22 | - * @param int $number |
|
23 | - * |
|
24 | - * @return array |
|
25 | - * @throws \Exception |
|
26 | - */ |
|
27 | - public function listCommentsPullRequest(int $number): array |
|
28 | - { |
|
29 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number/comments', |
|
30 | - $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number)); |
|
31 | - } |
|
17 | + /** |
|
18 | + * List comments on a pull request |
|
19 | + * |
|
20 | + * @link https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request |
|
21 | + * |
|
22 | + * @param int $number |
|
23 | + * |
|
24 | + * @return array |
|
25 | + * @throws \Exception |
|
26 | + */ |
|
27 | + public function listCommentsPullRequest(int $number): array |
|
28 | + { |
|
29 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number/comments', |
|
30 | + $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number)); |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * List comments in a repository |
|
35 | - * |
|
36 | - * @link https://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository |
|
37 | - * |
|
38 | - * @param string $sort |
|
39 | - * @param string $direction |
|
40 | - * @param string $since |
|
41 | - * |
|
42 | - * @return array |
|
43 | - * @throws \Exception |
|
44 | - */ |
|
45 | - public function listCommentsRepository(string $sort = AbstractApi::SORT_CREATED, |
|
46 | - string $direction = AbstractApi::DIRECTION_DESC, |
|
47 | - string $since = 'now'): array |
|
48 | - { |
|
49 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/comments?:args', |
|
50 | - $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), http_build_query([ |
|
51 | - 'sort' => $sort, |
|
52 | - 'direction' => $direction, |
|
53 | - 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
54 | - ]))); |
|
55 | - } |
|
33 | + /** |
|
34 | + * List comments in a repository |
|
35 | + * |
|
36 | + * @link https://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository |
|
37 | + * |
|
38 | + * @param string $sort |
|
39 | + * @param string $direction |
|
40 | + * @param string $since |
|
41 | + * |
|
42 | + * @return array |
|
43 | + * @throws \Exception |
|
44 | + */ |
|
45 | + public function listCommentsRepository(string $sort = AbstractApi::SORT_CREATED, |
|
46 | + string $direction = AbstractApi::DIRECTION_DESC, |
|
47 | + string $since = 'now'): array |
|
48 | + { |
|
49 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/comments?:args', |
|
50 | + $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), http_build_query([ |
|
51 | + 'sort' => $sort, |
|
52 | + 'direction' => $direction, |
|
53 | + 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
54 | + ]))); |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * Get a single comment |
|
59 | - * |
|
60 | - * @link https://developer.github.com/v3/pulls/comments/#get-a-single-comment |
|
61 | - * |
|
62 | - * @param int $number |
|
63 | - * |
|
64 | - * @return array |
|
65 | - * @throws \Exception |
|
66 | - */ |
|
67 | - public function getSingleComment(int $number): array |
|
68 | - { |
|
69 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/comments/:number', |
|
70 | - $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number)); |
|
71 | - } |
|
57 | + /** |
|
58 | + * Get a single comment |
|
59 | + * |
|
60 | + * @link https://developer.github.com/v3/pulls/comments/#get-a-single-comment |
|
61 | + * |
|
62 | + * @param int $number |
|
63 | + * |
|
64 | + * @return array |
|
65 | + * @throws \Exception |
|
66 | + */ |
|
67 | + public function getSingleComment(int $number): array |
|
68 | + { |
|
69 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/comments/:number', |
|
70 | + $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number)); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Create a comment |
|
75 | - * |
|
76 | - * @link https://developer.github.com/v3/pulls/comments/#create-a-comment |
|
77 | - * |
|
78 | - * @param int $number |
|
79 | - * @param string $body |
|
80 | - * @param string $commitId |
|
81 | - * @param string $path |
|
82 | - * @param int $position |
|
83 | - * |
|
84 | - * @return array |
|
85 | - * @throws \Exception |
|
86 | - */ |
|
87 | - public function createComment(int $number, string $body, string $commitId, string $path, int $position): array |
|
88 | - { |
|
89 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number/comments', |
|
90 | - $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number), Request::METHOD_POST, [ |
|
91 | - 'body' => $body, |
|
92 | - 'commit_id' => $commitId, |
|
93 | - 'path' => $path, |
|
94 | - 'position' => $position |
|
95 | - ]); |
|
96 | - } |
|
73 | + /** |
|
74 | + * Create a comment |
|
75 | + * |
|
76 | + * @link https://developer.github.com/v3/pulls/comments/#create-a-comment |
|
77 | + * |
|
78 | + * @param int $number |
|
79 | + * @param string $body |
|
80 | + * @param string $commitId |
|
81 | + * @param string $path |
|
82 | + * @param int $position |
|
83 | + * |
|
84 | + * @return array |
|
85 | + * @throws \Exception |
|
86 | + */ |
|
87 | + public function createComment(int $number, string $body, string $commitId, string $path, int $position): array |
|
88 | + { |
|
89 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number/comments', |
|
90 | + $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number), Request::METHOD_POST, [ |
|
91 | + 'body' => $body, |
|
92 | + 'commit_id' => $commitId, |
|
93 | + 'path' => $path, |
|
94 | + 'position' => $position |
|
95 | + ]); |
|
96 | + } |
|
97 | 97 | |
98 | - /** |
|
99 | - * Edit a comment |
|
100 | - * |
|
101 | - * @link https://developer.github.com/v3/pulls/comments/#edit-a-comment |
|
102 | - * |
|
103 | - * @param int $number |
|
104 | - * @param string $body |
|
105 | - * |
|
106 | - * @return array |
|
107 | - * @throws \Exception |
|
108 | - */ |
|
109 | - public function editComment(int $number, string $body): array |
|
110 | - { |
|
111 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/comments/:number', |
|
112 | - $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number), Request::METHOD_PATCH, |
|
113 | - [ |
|
114 | - 'body' => $body |
|
115 | - ]); |
|
116 | - } |
|
98 | + /** |
|
99 | + * Edit a comment |
|
100 | + * |
|
101 | + * @link https://developer.github.com/v3/pulls/comments/#edit-a-comment |
|
102 | + * |
|
103 | + * @param int $number |
|
104 | + * @param string $body |
|
105 | + * |
|
106 | + * @return array |
|
107 | + * @throws \Exception |
|
108 | + */ |
|
109 | + public function editComment(int $number, string $body): array |
|
110 | + { |
|
111 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/comments/:number', |
|
112 | + $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number), Request::METHOD_PATCH, |
|
113 | + [ |
|
114 | + 'body' => $body |
|
115 | + ]); |
|
116 | + } |
|
117 | 117 | |
118 | - /** |
|
119 | - * Delete a comment |
|
120 | - * |
|
121 | - * @link https://developer.github.com/v3/pulls/comments/#delete-a-comment |
|
122 | - * |
|
123 | - * @param int $number |
|
124 | - * |
|
125 | - * @return bool |
|
126 | - * @throws \Exception |
|
127 | - */ |
|
128 | - public function deleteComment(int $number): bool |
|
129 | - { |
|
130 | - $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/comments/:number', |
|
131 | - $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number)); |
|
118 | + /** |
|
119 | + * Delete a comment |
|
120 | + * |
|
121 | + * @link https://developer.github.com/v3/pulls/comments/#delete-a-comment |
|
122 | + * |
|
123 | + * @param int $number |
|
124 | + * |
|
125 | + * @return bool |
|
126 | + * @throws \Exception |
|
127 | + */ |
|
128 | + public function deleteComment(int $number): bool |
|
129 | + { |
|
130 | + $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/comments/:number', |
|
131 | + $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number)); |
|
132 | 132 | |
133 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
134 | - return true; |
|
135 | - } |
|
133 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
134 | + return true; |
|
135 | + } |
|
136 | 136 | |
137 | - return false; |
|
138 | - } |
|
137 | + return false; |
|
138 | + } |
|
139 | 139 | } |
140 | 140 | \ No newline at end of file |