@@ -10,17 +10,17 @@ |
||
10 | 10 | class AdminStats extends AbstractEnterprise |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * Get statistics |
|
15 | - * |
|
16 | - * @link https://developer.github.com/v3/enterprise/admin_stats/#get-statistics |
|
17 | - * |
|
18 | - * @param string $type |
|
19 | - * |
|
20 | - * @return array |
|
21 | - */ |
|
22 | - public function getStatistics(string $type): array |
|
23 | - { |
|
24 | - return $this->getApi()->request($this->getApi()->sprintf('/enterprise/stats/:type', $type)); |
|
25 | - } |
|
13 | + /** |
|
14 | + * Get statistics |
|
15 | + * |
|
16 | + * @link https://developer.github.com/v3/enterprise/admin_stats/#get-statistics |
|
17 | + * |
|
18 | + * @param string $type |
|
19 | + * |
|
20 | + * @return array |
|
21 | + */ |
|
22 | + public function getStatistics(string $type): array |
|
23 | + { |
|
24 | + return $this->getApi()->request($this->getApi()->sprintf('/enterprise/stats/:type', $type)); |
|
25 | + } |
|
26 | 26 | } |
27 | 27 | \ No newline at end of file |
@@ -14,206 +14,206 @@ |
||
14 | 14 | class Issues extends AbstractReceiver |
15 | 15 | { |
16 | 16 | |
17 | - /** Available sub-Receiver */ |
|
18 | - const ASSIGNEES = 'Assignees'; |
|
19 | - const COMMENTS = 'Comments'; |
|
20 | - const EVENTS = 'Events'; |
|
21 | - const LABELS = 'Labels'; |
|
22 | - const MILESTONES = 'Milestones'; |
|
17 | + /** Available sub-Receiver */ |
|
18 | + const ASSIGNEES = 'Assignees'; |
|
19 | + const COMMENTS = 'Comments'; |
|
20 | + const EVENTS = 'Events'; |
|
21 | + const LABELS = 'Labels'; |
|
22 | + const MILESTONES = 'Milestones'; |
|
23 | 23 | |
24 | - /** |
|
25 | - * List issues |
|
26 | - * |
|
27 | - * @link https://developer.github.com/v3/issues/#list-issues |
|
28 | - * |
|
29 | - * @param string $filter |
|
30 | - * @param string $state |
|
31 | - * @param string $labels |
|
32 | - * @param string $sort |
|
33 | - * @param string $direction |
|
34 | - * @param string $since |
|
35 | - * |
|
36 | - * @return array |
|
37 | - */ |
|
38 | - public function listIssues(string $filter = AbstractApi::FILTER_ASSIGNED, string $state = AbstractApi::STATE_OPEN, |
|
39 | - string $labels = '', string $sort = AbstractApi::SORT_CREATED, |
|
40 | - string $direction = AbstractApi::DIRECTION_DESC, string $since = '1970-01-01'): array |
|
41 | - { |
|
42 | - return $this->getApi()->request($this->getApi()->sprintf('/issues?:args', http_build_query([ |
|
43 | - 'filter' => $filter, |
|
44 | - 'state' => $state, |
|
45 | - 'labels' => $labels, |
|
46 | - 'sort' => $sort, |
|
47 | - 'direction' => $direction, |
|
48 | - 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
49 | - ]))); |
|
50 | - } |
|
24 | + /** |
|
25 | + * List issues |
|
26 | + * |
|
27 | + * @link https://developer.github.com/v3/issues/#list-issues |
|
28 | + * |
|
29 | + * @param string $filter |
|
30 | + * @param string $state |
|
31 | + * @param string $labels |
|
32 | + * @param string $sort |
|
33 | + * @param string $direction |
|
34 | + * @param string $since |
|
35 | + * |
|
36 | + * @return array |
|
37 | + */ |
|
38 | + public function listIssues(string $filter = AbstractApi::FILTER_ASSIGNED, string $state = AbstractApi::STATE_OPEN, |
|
39 | + string $labels = '', string $sort = AbstractApi::SORT_CREATED, |
|
40 | + string $direction = AbstractApi::DIRECTION_DESC, string $since = '1970-01-01'): array |
|
41 | + { |
|
42 | + return $this->getApi()->request($this->getApi()->sprintf('/issues?:args', http_build_query([ |
|
43 | + 'filter' => $filter, |
|
44 | + 'state' => $state, |
|
45 | + 'labels' => $labels, |
|
46 | + 'sort' => $sort, |
|
47 | + 'direction' => $direction, |
|
48 | + 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
49 | + ]))); |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * List all issues across owned and member repositories for the authenticated user |
|
54 | - * |
|
55 | - * @link https://developer.github.com/v3/issues/#list-issues |
|
56 | - * |
|
57 | - * @param string $filter |
|
58 | - * @param string $state |
|
59 | - * @param string $labels |
|
60 | - * @param string $sort |
|
61 | - * @param string $direction |
|
62 | - * @param string $since |
|
63 | - * |
|
64 | - * @return array |
|
65 | - */ |
|
66 | - public function listUserIssues(string $filter = AbstractApi::FILTER_ASSIGNED, |
|
67 | - string $state = AbstractApi::STATE_OPEN, string $labels = '', |
|
68 | - string $sort = AbstractApi::SORT_CREATED, |
|
69 | - string $direction = AbstractApi::DIRECTION_DESC, string $since = '1970-01-01'): array |
|
70 | - { |
|
71 | - return $this->getApi()->request($this->getApi()->sprintf('/user/issues?:args', http_build_query([ |
|
72 | - 'filter' => $filter, |
|
73 | - 'state' => $state, |
|
74 | - 'labels' => $labels, |
|
75 | - 'sort' => $sort, |
|
76 | - 'direction' => $direction, |
|
77 | - 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
78 | - ]))); |
|
79 | - } |
|
52 | + /** |
|
53 | + * List all issues across owned and member repositories for the authenticated user |
|
54 | + * |
|
55 | + * @link https://developer.github.com/v3/issues/#list-issues |
|
56 | + * |
|
57 | + * @param string $filter |
|
58 | + * @param string $state |
|
59 | + * @param string $labels |
|
60 | + * @param string $sort |
|
61 | + * @param string $direction |
|
62 | + * @param string $since |
|
63 | + * |
|
64 | + * @return array |
|
65 | + */ |
|
66 | + public function listUserIssues(string $filter = AbstractApi::FILTER_ASSIGNED, |
|
67 | + string $state = AbstractApi::STATE_OPEN, string $labels = '', |
|
68 | + string $sort = AbstractApi::SORT_CREATED, |
|
69 | + string $direction = AbstractApi::DIRECTION_DESC, string $since = '1970-01-01'): array |
|
70 | + { |
|
71 | + return $this->getApi()->request($this->getApi()->sprintf('/user/issues?:args', http_build_query([ |
|
72 | + 'filter' => $filter, |
|
73 | + 'state' => $state, |
|
74 | + 'labels' => $labels, |
|
75 | + 'sort' => $sort, |
|
76 | + 'direction' => $direction, |
|
77 | + 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
78 | + ]))); |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * List all issues for a given organization for the authenticated user |
|
83 | - * |
|
84 | - * @link https://developer.github.com/v3/issues/#list-issues |
|
85 | - * |
|
86 | - * @param string $organization |
|
87 | - * @param string $filter |
|
88 | - * @param string $state |
|
89 | - * @param string $labels |
|
90 | - * @param string $sort |
|
91 | - * @param string $direction |
|
92 | - * @param string $since |
|
93 | - * |
|
94 | - * @return array |
|
95 | - */ |
|
96 | - public function listOrganizationIssues(string $organization, string $filter = AbstractApi::FILTER_ASSIGNED, |
|
97 | - string $state = AbstractApi::STATE_OPEN, string $labels = '', |
|
98 | - string $sort = AbstractApi::SORT_CREATED, |
|
99 | - string $direction = AbstractApi::DIRECTION_DESC, |
|
100 | - string $since = '1970-01-01'): array |
|
101 | - { |
|
102 | - return $this->getApi()->request($this->getApi() |
|
103 | - ->sprintf('/orgs/:org/issues?:args', $organization, http_build_query([ |
|
104 | - 'filter' => $filter, |
|
105 | - 'state' => $state, |
|
106 | - 'labels' => $labels, |
|
107 | - 'sort' => $sort, |
|
108 | - 'direction' => $direction, |
|
109 | - 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
110 | - ]))); |
|
111 | - } |
|
81 | + /** |
|
82 | + * List all issues for a given organization for the authenticated user |
|
83 | + * |
|
84 | + * @link https://developer.github.com/v3/issues/#list-issues |
|
85 | + * |
|
86 | + * @param string $organization |
|
87 | + * @param string $filter |
|
88 | + * @param string $state |
|
89 | + * @param string $labels |
|
90 | + * @param string $sort |
|
91 | + * @param string $direction |
|
92 | + * @param string $since |
|
93 | + * |
|
94 | + * @return array |
|
95 | + */ |
|
96 | + public function listOrganizationIssues(string $organization, string $filter = AbstractApi::FILTER_ASSIGNED, |
|
97 | + string $state = AbstractApi::STATE_OPEN, string $labels = '', |
|
98 | + string $sort = AbstractApi::SORT_CREATED, |
|
99 | + string $direction = AbstractApi::DIRECTION_DESC, |
|
100 | + string $since = '1970-01-01'): array |
|
101 | + { |
|
102 | + return $this->getApi()->request($this->getApi() |
|
103 | + ->sprintf('/orgs/:org/issues?:args', $organization, http_build_query([ |
|
104 | + 'filter' => $filter, |
|
105 | + 'state' => $state, |
|
106 | + 'labels' => $labels, |
|
107 | + 'sort' => $sort, |
|
108 | + 'direction' => $direction, |
|
109 | + 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
110 | + ]))); |
|
111 | + } |
|
112 | 112 | |
113 | - /** |
|
114 | - * List issues for a repository |
|
115 | - * |
|
116 | - * @link https://developer.github.com/v3/issues/#list-issues-for-a-repository |
|
117 | - * |
|
118 | - * @param string $milestone |
|
119 | - * @param string $state |
|
120 | - * @param string $assignee |
|
121 | - * @param string $creator |
|
122 | - * @param string $mentioned |
|
123 | - * @param string $labels |
|
124 | - * @param string $sort |
|
125 | - * @param string $direction |
|
126 | - * @param string $since |
|
127 | - * |
|
128 | - * @return array |
|
129 | - */ |
|
130 | - public function listRepositoryIssues(string $milestone = '*', string $state = AbstractApi::STATE_OPEN, |
|
131 | - string $assignee = '*', string $creator = '', string $mentioned = '', |
|
132 | - string $labels = '', string $sort = AbstractApi::SORT_CREATED, |
|
133 | - string $direction = AbstractApi::DIRECTION_DESC, |
|
134 | - string $since = '1970-01-01'): array |
|
135 | - { |
|
136 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues?:args', $this->getOwner(), |
|
137 | - $this->getRepo(), http_build_query([ |
|
138 | - 'milestone' => $milestone, |
|
139 | - 'state' => $state, |
|
140 | - 'assignee' => $assignee, |
|
141 | - 'creator' => $creator, |
|
142 | - 'mentioned' => $mentioned, |
|
143 | - 'labels' => $labels, |
|
144 | - 'sort' => $sort, |
|
145 | - 'direction' => $direction, |
|
146 | - 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
147 | - ]))); |
|
148 | - } |
|
113 | + /** |
|
114 | + * List issues for a repository |
|
115 | + * |
|
116 | + * @link https://developer.github.com/v3/issues/#list-issues-for-a-repository |
|
117 | + * |
|
118 | + * @param string $milestone |
|
119 | + * @param string $state |
|
120 | + * @param string $assignee |
|
121 | + * @param string $creator |
|
122 | + * @param string $mentioned |
|
123 | + * @param string $labels |
|
124 | + * @param string $sort |
|
125 | + * @param string $direction |
|
126 | + * @param string $since |
|
127 | + * |
|
128 | + * @return array |
|
129 | + */ |
|
130 | + public function listRepositoryIssues(string $milestone = '*', string $state = AbstractApi::STATE_OPEN, |
|
131 | + string $assignee = '*', string $creator = '', string $mentioned = '', |
|
132 | + string $labels = '', string $sort = AbstractApi::SORT_CREATED, |
|
133 | + string $direction = AbstractApi::DIRECTION_DESC, |
|
134 | + string $since = '1970-01-01'): array |
|
135 | + { |
|
136 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues?:args', $this->getOwner(), |
|
137 | + $this->getRepo(), http_build_query([ |
|
138 | + 'milestone' => $milestone, |
|
139 | + 'state' => $state, |
|
140 | + 'assignee' => $assignee, |
|
141 | + 'creator' => $creator, |
|
142 | + 'mentioned' => $mentioned, |
|
143 | + 'labels' => $labels, |
|
144 | + 'sort' => $sort, |
|
145 | + 'direction' => $direction, |
|
146 | + 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
147 | + ]))); |
|
148 | + } |
|
149 | 149 | |
150 | - /** |
|
151 | - * Get a single issue |
|
152 | - * |
|
153 | - * @link https://developer.github.com/v3/issues/#get-a-single-issue |
|
154 | - * |
|
155 | - * @param int $number |
|
156 | - * |
|
157 | - * @return array |
|
158 | - */ |
|
159 | - public function getIssue(int $number): array |
|
160 | - { |
|
161 | - return $this->getApi()->request($this->getApi() |
|
162 | - ->sprintf('/repos/:owner/:repo/issues/:number', $this->getOwner(), |
|
163 | - $this->getRepo(), $number)); |
|
164 | - } |
|
150 | + /** |
|
151 | + * Get a single issue |
|
152 | + * |
|
153 | + * @link https://developer.github.com/v3/issues/#get-a-single-issue |
|
154 | + * |
|
155 | + * @param int $number |
|
156 | + * |
|
157 | + * @return array |
|
158 | + */ |
|
159 | + public function getIssue(int $number): array |
|
160 | + { |
|
161 | + return $this->getApi()->request($this->getApi() |
|
162 | + ->sprintf('/repos/:owner/:repo/issues/:number', $this->getOwner(), |
|
163 | + $this->getRepo(), $number)); |
|
164 | + } |
|
165 | 165 | |
166 | - /** |
|
167 | - * Create an issue |
|
168 | - * |
|
169 | - * @link https://developer.github.com/v3/issues/#create-an-issue |
|
170 | - * |
|
171 | - * @param string $title |
|
172 | - * @param string $body |
|
173 | - * @param string $assignee |
|
174 | - * @param int $milestone |
|
175 | - * @param array $labels |
|
176 | - * |
|
177 | - * @return array |
|
178 | - */ |
|
179 | - public function createIssue(string $title, string $body = '', string $assignee = '', int $milestone = 0, |
|
180 | - array $labels = []): array |
|
181 | - { |
|
182 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues', $this->getOwner(), |
|
183 | - $this->getRepo()), Request::METHOD_POST, [ |
|
184 | - 'title' => $title, |
|
185 | - 'body' => $body, |
|
186 | - 'assignee' => $assignee, |
|
187 | - 'milestone' => $milestone, |
|
188 | - 'labels' => $labels |
|
189 | - ]); |
|
190 | - } |
|
166 | + /** |
|
167 | + * Create an issue |
|
168 | + * |
|
169 | + * @link https://developer.github.com/v3/issues/#create-an-issue |
|
170 | + * |
|
171 | + * @param string $title |
|
172 | + * @param string $body |
|
173 | + * @param string $assignee |
|
174 | + * @param int $milestone |
|
175 | + * @param array $labels |
|
176 | + * |
|
177 | + * @return array |
|
178 | + */ |
|
179 | + public function createIssue(string $title, string $body = '', string $assignee = '', int $milestone = 0, |
|
180 | + array $labels = []): array |
|
181 | + { |
|
182 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues', $this->getOwner(), |
|
183 | + $this->getRepo()), Request::METHOD_POST, [ |
|
184 | + 'title' => $title, |
|
185 | + 'body' => $body, |
|
186 | + 'assignee' => $assignee, |
|
187 | + 'milestone' => $milestone, |
|
188 | + 'labels' => $labels |
|
189 | + ]); |
|
190 | + } |
|
191 | 191 | |
192 | - /** |
|
193 | - * Edit an issue |
|
194 | - * |
|
195 | - * @link https://developer.github.com/v3/issues/#edit-an-issue |
|
196 | - * |
|
197 | - * @param int $number |
|
198 | - * @param string $title |
|
199 | - * @param string $body |
|
200 | - * @param string $assignee |
|
201 | - * @param int $milestone |
|
202 | - * @param array $labels |
|
203 | - * |
|
204 | - * @return array |
|
205 | - */ |
|
206 | - public function editIssue(int $number, string $title = '', string $body = '', string $assignee = '', |
|
207 | - int $milestone = 0, array $labels = []): array |
|
208 | - { |
|
209 | - return $this->getApi()->request($this->getApi() |
|
210 | - ->sprintf('/repos/:owner/:repo/issues/:number', $this->getOwner(), |
|
211 | - $this->getRepo(), $number), Request::METHOD_PATCH, [ |
|
212 | - 'title' => $title, |
|
213 | - 'body' => $body, |
|
214 | - 'assignee' => $assignee, |
|
215 | - 'milestone' => $milestone, |
|
216 | - 'labels' => $labels |
|
217 | - ]); |
|
218 | - } |
|
192 | + /** |
|
193 | + * Edit an issue |
|
194 | + * |
|
195 | + * @link https://developer.github.com/v3/issues/#edit-an-issue |
|
196 | + * |
|
197 | + * @param int $number |
|
198 | + * @param string $title |
|
199 | + * @param string $body |
|
200 | + * @param string $assignee |
|
201 | + * @param int $milestone |
|
202 | + * @param array $labels |
|
203 | + * |
|
204 | + * @return array |
|
205 | + */ |
|
206 | + public function editIssue(int $number, string $title = '', string $body = '', string $assignee = '', |
|
207 | + int $milestone = 0, array $labels = []): array |
|
208 | + { |
|
209 | + return $this->getApi()->request($this->getApi() |
|
210 | + ->sprintf('/repos/:owner/:repo/issues/:number', $this->getOwner(), |
|
211 | + $this->getRepo(), $number), Request::METHOD_PATCH, [ |
|
212 | + 'title' => $title, |
|
213 | + 'body' => $body, |
|
214 | + 'assignee' => $assignee, |
|
215 | + 'milestone' => $milestone, |
|
216 | + 'labels' => $labels |
|
217 | + ]); |
|
218 | + } |
|
219 | 219 | } |
220 | 220 | \ No newline at end of file |
@@ -14,176 +14,176 @@ |
||
14 | 14 | class PullRequests extends AbstractReceiver |
15 | 15 | { |
16 | 16 | |
17 | - /** Available sub-Receiver */ |
|
18 | - const REVIEW_COMMENTS = 'ReviewComments'; |
|
17 | + /** Available sub-Receiver */ |
|
18 | + const REVIEW_COMMENTS = 'ReviewComments'; |
|
19 | 19 | |
20 | - /** |
|
21 | - * List pull requests |
|
22 | - * |
|
23 | - * @link https://developer.github.com/v3/pulls/#list-pull-requests |
|
24 | - * |
|
25 | - * @param string $state |
|
26 | - * @param string $head |
|
27 | - * @param string $base |
|
28 | - * @param string $sort |
|
29 | - * @param string $direction |
|
30 | - * |
|
31 | - * @return array |
|
32 | - * @throws \Exception |
|
33 | - */ |
|
34 | - public function listPullRequests(string $state = AbstractApi::STATE_OPEN, string $head = null, string $base = null, |
|
35 | - string $sort = AbstractApi::SORT_CREATED, |
|
36 | - string $direction = AbstractApi::DIRECTION_ASC): array |
|
37 | - { |
|
38 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls?:args', $this->getOwner(), |
|
39 | - $this->getRepo(), http_build_query([ |
|
40 | - 'state' => $state, |
|
41 | - 'head' => $head, |
|
42 | - 'base' => $base, |
|
43 | - 'sort' => $sort, |
|
44 | - 'direction' => $direction |
|
45 | - ]))); |
|
46 | - } |
|
20 | + /** |
|
21 | + * List pull requests |
|
22 | + * |
|
23 | + * @link https://developer.github.com/v3/pulls/#list-pull-requests |
|
24 | + * |
|
25 | + * @param string $state |
|
26 | + * @param string $head |
|
27 | + * @param string $base |
|
28 | + * @param string $sort |
|
29 | + * @param string $direction |
|
30 | + * |
|
31 | + * @return array |
|
32 | + * @throws \Exception |
|
33 | + */ |
|
34 | + public function listPullRequests(string $state = AbstractApi::STATE_OPEN, string $head = null, string $base = null, |
|
35 | + string $sort = AbstractApi::SORT_CREATED, |
|
36 | + string $direction = AbstractApi::DIRECTION_ASC): array |
|
37 | + { |
|
38 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls?:args', $this->getOwner(), |
|
39 | + $this->getRepo(), http_build_query([ |
|
40 | + 'state' => $state, |
|
41 | + 'head' => $head, |
|
42 | + 'base' => $base, |
|
43 | + 'sort' => $sort, |
|
44 | + 'direction' => $direction |
|
45 | + ]))); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * Get a single pull request |
|
50 | - * |
|
51 | - * @link https://developer.github.com/v3/pulls/#get-a-single-pull-request |
|
52 | - * |
|
53 | - * @param int $number |
|
54 | - * |
|
55 | - * @return array |
|
56 | - * @throws \Exception |
|
57 | - */ |
|
58 | - public function getSinglePullRequest(int $number): array |
|
59 | - { |
|
60 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number', $this->getOwner(), |
|
61 | - $this->getRepo(), $number)); |
|
62 | - } |
|
48 | + /** |
|
49 | + * Get a single pull request |
|
50 | + * |
|
51 | + * @link https://developer.github.com/v3/pulls/#get-a-single-pull-request |
|
52 | + * |
|
53 | + * @param int $number |
|
54 | + * |
|
55 | + * @return array |
|
56 | + * @throws \Exception |
|
57 | + */ |
|
58 | + public function getSinglePullRequest(int $number): array |
|
59 | + { |
|
60 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number', $this->getOwner(), |
|
61 | + $this->getRepo(), $number)); |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * Create a pull request |
|
66 | - * |
|
67 | - * @link https://developer.github.com/v3/pulls/#create-a-pull-request |
|
68 | - * |
|
69 | - * @param string $title |
|
70 | - * @param string $head |
|
71 | - * @param string $base |
|
72 | - * @param string $body |
|
73 | - * |
|
74 | - * @return array |
|
75 | - * @throws \Exception |
|
76 | - */ |
|
77 | - public function createPullrequest(string $title, string $head, string $base, string $body): array |
|
78 | - { |
|
79 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls', $this->getOwner(), |
|
80 | - $this->getRepo()), Request::METHOD_POST, [ |
|
81 | - 'title' => $title, |
|
82 | - 'head' => $head, |
|
83 | - 'base' => $base, |
|
84 | - 'body' => $body |
|
85 | - ]); |
|
86 | - } |
|
64 | + /** |
|
65 | + * Create a pull request |
|
66 | + * |
|
67 | + * @link https://developer.github.com/v3/pulls/#create-a-pull-request |
|
68 | + * |
|
69 | + * @param string $title |
|
70 | + * @param string $head |
|
71 | + * @param string $base |
|
72 | + * @param string $body |
|
73 | + * |
|
74 | + * @return array |
|
75 | + * @throws \Exception |
|
76 | + */ |
|
77 | + public function createPullrequest(string $title, string $head, string $base, string $body): array |
|
78 | + { |
|
79 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls', $this->getOwner(), |
|
80 | + $this->getRepo()), Request::METHOD_POST, [ |
|
81 | + 'title' => $title, |
|
82 | + 'head' => $head, |
|
83 | + 'base' => $base, |
|
84 | + 'body' => $body |
|
85 | + ]); |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
89 | - * Update a pull request |
|
90 | - * |
|
91 | - * @link https://developer.github.com/v3/pulls/#update-a-pull-request |
|
92 | - * |
|
93 | - * @param int $number |
|
94 | - * @param string $title |
|
95 | - * @param string $body |
|
96 | - * @param string $state |
|
97 | - * |
|
98 | - * @return array |
|
99 | - * @throws \Exception |
|
100 | - */ |
|
101 | - public function updatePullRequest(int $number, string $title = null, string $body = null, |
|
102 | - string $state = null): array |
|
103 | - { |
|
104 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number', $this->getOwner(), |
|
105 | - $this->getRepo(), $number), Request::METHOD_PATCH, [ |
|
106 | - 'title' => $title, |
|
107 | - 'body' => $body, |
|
108 | - 'state' => $state |
|
109 | - ]); |
|
110 | - } |
|
88 | + /** |
|
89 | + * Update a pull request |
|
90 | + * |
|
91 | + * @link https://developer.github.com/v3/pulls/#update-a-pull-request |
|
92 | + * |
|
93 | + * @param int $number |
|
94 | + * @param string $title |
|
95 | + * @param string $body |
|
96 | + * @param string $state |
|
97 | + * |
|
98 | + * @return array |
|
99 | + * @throws \Exception |
|
100 | + */ |
|
101 | + public function updatePullRequest(int $number, string $title = null, string $body = null, |
|
102 | + string $state = null): array |
|
103 | + { |
|
104 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number', $this->getOwner(), |
|
105 | + $this->getRepo(), $number), Request::METHOD_PATCH, [ |
|
106 | + 'title' => $title, |
|
107 | + 'body' => $body, |
|
108 | + 'state' => $state |
|
109 | + ]); |
|
110 | + } |
|
111 | 111 | |
112 | - /** |
|
113 | - * List commits on a pull request |
|
114 | - * |
|
115 | - * @link https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request |
|
116 | - * |
|
117 | - * @param int $number |
|
118 | - * |
|
119 | - * @return array |
|
120 | - * @throws \Exception |
|
121 | - */ |
|
122 | - public function listCommits(int $number): array |
|
123 | - { |
|
124 | - return $this->getApi()->request($this->getApi() |
|
125 | - ->sprintf('/repos/:owner/:repo/pulls/:number/commits', $this->getOwner(), |
|
126 | - $this->getRepo(), $number)); |
|
127 | - } |
|
112 | + /** |
|
113 | + * List commits on a pull request |
|
114 | + * |
|
115 | + * @link https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request |
|
116 | + * |
|
117 | + * @param int $number |
|
118 | + * |
|
119 | + * @return array |
|
120 | + * @throws \Exception |
|
121 | + */ |
|
122 | + public function listCommits(int $number): array |
|
123 | + { |
|
124 | + return $this->getApi()->request($this->getApi() |
|
125 | + ->sprintf('/repos/:owner/:repo/pulls/:number/commits', $this->getOwner(), |
|
126 | + $this->getRepo(), $number)); |
|
127 | + } |
|
128 | 128 | |
129 | - /** |
|
130 | - * List pull requests files |
|
131 | - * |
|
132 | - * @link https://developer.github.com/v3/pulls/#list-pull-requests-files |
|
133 | - * |
|
134 | - * @param int $number |
|
135 | - * |
|
136 | - * @return array |
|
137 | - * @throws \Exception |
|
138 | - */ |
|
139 | - public function listPullRequestsFiles(int $number): array |
|
140 | - { |
|
141 | - return $this->getApi()->request($this->getApi() |
|
142 | - ->sprintf('/repos/:owner/:repo/pulls/:number/files', $this->getOwner(), |
|
143 | - $this->getRepo(), $number)); |
|
144 | - } |
|
129 | + /** |
|
130 | + * List pull requests files |
|
131 | + * |
|
132 | + * @link https://developer.github.com/v3/pulls/#list-pull-requests-files |
|
133 | + * |
|
134 | + * @param int $number |
|
135 | + * |
|
136 | + * @return array |
|
137 | + * @throws \Exception |
|
138 | + */ |
|
139 | + public function listPullRequestsFiles(int $number): array |
|
140 | + { |
|
141 | + return $this->getApi()->request($this->getApi() |
|
142 | + ->sprintf('/repos/:owner/:repo/pulls/:number/files', $this->getOwner(), |
|
143 | + $this->getRepo(), $number)); |
|
144 | + } |
|
145 | 145 | |
146 | - /** |
|
147 | - * Get if a pull request has been merged |
|
148 | - * |
|
149 | - * @link https://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged |
|
150 | - * |
|
151 | - * @param int $number |
|
152 | - * |
|
153 | - * @return bool |
|
154 | - * @throws \Exception |
|
155 | - */ |
|
156 | - public function checkPullRequestsMerged(int $number): bool |
|
157 | - { |
|
158 | - $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number/merge', $this->getOwner(), |
|
159 | - $this->getRepo(), $number)); |
|
146 | + /** |
|
147 | + * Get if a pull request has been merged |
|
148 | + * |
|
149 | + * @link https://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged |
|
150 | + * |
|
151 | + * @param int $number |
|
152 | + * |
|
153 | + * @return bool |
|
154 | + * @throws \Exception |
|
155 | + */ |
|
156 | + public function checkPullRequestsMerged(int $number): bool |
|
157 | + { |
|
158 | + $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number/merge', $this->getOwner(), |
|
159 | + $this->getRepo(), $number)); |
|
160 | 160 | |
161 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
162 | - return true; |
|
163 | - } |
|
161 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
162 | + return true; |
|
163 | + } |
|
164 | 164 | |
165 | - return false; |
|
166 | - } |
|
165 | + return false; |
|
166 | + } |
|
167 | 167 | |
168 | - /** |
|
169 | - * Merge a pull request (Merge Button) |
|
170 | - * |
|
171 | - * @link https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button |
|
172 | - * |
|
173 | - * @param int $number |
|
174 | - * @param string $commitMessage |
|
175 | - * @param string $sha |
|
176 | - * |
|
177 | - * @return array |
|
178 | - * @throws \Exception |
|
179 | - */ |
|
180 | - public function mergePullRequest(int $number, string $commitMessage = null, string $sha = null): array |
|
181 | - { |
|
182 | - return $this->getApi()->request($this->getApi() |
|
183 | - ->sprintf('/repos/:owner/:repo/pulls/:number/merge', $this->getOwner(), |
|
184 | - $this->getRepo(), $number), Request::METHOD_PUT, [ |
|
185 | - 'commit_message' => $commitMessage, |
|
186 | - 'sha' => $sha |
|
187 | - ]); |
|
188 | - } |
|
168 | + /** |
|
169 | + * Merge a pull request (Merge Button) |
|
170 | + * |
|
171 | + * @link https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button |
|
172 | + * |
|
173 | + * @param int $number |
|
174 | + * @param string $commitMessage |
|
175 | + * @param string $sha |
|
176 | + * |
|
177 | + * @return array |
|
178 | + * @throws \Exception |
|
179 | + */ |
|
180 | + public function mergePullRequest(int $number, string $commitMessage = null, string $sha = null): array |
|
181 | + { |
|
182 | + return $this->getApi()->request($this->getApi() |
|
183 | + ->sprintf('/repos/:owner/:repo/pulls/:number/merge', $this->getOwner(), |
|
184 | + $this->getRepo(), $number), Request::METHOD_PUT, [ |
|
185 | + 'commit_message' => $commitMessage, |
|
186 | + 'sha' => $sha |
|
187 | + ]); |
|
188 | + } |
|
189 | 189 | } |
190 | 190 | \ No newline at end of file |
@@ -12,24 +12,24 @@ |
||
12 | 12 | class WebHook extends AbstractApi |
13 | 13 | { |
14 | 14 | |
15 | - /** Constants */ |
|
16 | - const PAYLOAD = 'Payload'; |
|
15 | + /** Constants */ |
|
16 | + const PAYLOAD = 'Payload'; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Returns Event object |
|
20 | - * |
|
21 | - * @param string $event |
|
22 | - * |
|
23 | - * @return null|EventInterface |
|
24 | - */ |
|
25 | - public function getEvent(string $event) |
|
26 | - { |
|
27 | - $class = (string)$this->sprintf(':namespace\Event\:event', __NAMESPACE__, $event); |
|
18 | + /** |
|
19 | + * Returns Event object |
|
20 | + * |
|
21 | + * @param string $event |
|
22 | + * |
|
23 | + * @return null|EventInterface |
|
24 | + */ |
|
25 | + public function getEvent(string $event) |
|
26 | + { |
|
27 | + $class = (string)$this->sprintf(':namespace\Event\:event', __NAMESPACE__, $event); |
|
28 | 28 | |
29 | - if (class_exists($class)) { |
|
30 | - return new $class($this); |
|
31 | - } |
|
29 | + if (class_exists($class)) { |
|
30 | + return new $class($this); |
|
31 | + } |
|
32 | 32 | |
33 | - return null; |
|
34 | - } |
|
33 | + return null; |
|
34 | + } |
|
35 | 35 | } |
36 | 36 | \ No newline at end of file |
@@ -11,17 +11,17 @@ |
||
11 | 11 | interface EventInterface |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * Constructor, pass a WebHook object |
|
16 | - * |
|
17 | - * @param WebHook $webHook |
|
18 | - */ |
|
19 | - public function __construct(WebHook $webHook); |
|
14 | + /** |
|
15 | + * Constructor, pass a WebHook object |
|
16 | + * |
|
17 | + * @param WebHook $webHook |
|
18 | + */ |
|
19 | + public function __construct(WebHook $webHook); |
|
20 | 20 | |
21 | - /** |
|
22 | - * Parse raw data |
|
23 | - * |
|
24 | - * @return Payload |
|
25 | - */ |
|
26 | - public function parse(): Payload; |
|
21 | + /** |
|
22 | + * Parse raw data |
|
23 | + * |
|
24 | + * @return Payload |
|
25 | + */ |
|
26 | + public function parse(): Payload; |
|
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -13,253 +13,253 @@ |
||
13 | 13 | class Gists extends AbstractReceiver |
14 | 14 | { |
15 | 15 | |
16 | - /** Available sub-Receiver */ |
|
17 | - const COMMENTS = 'Comments'; |
|
16 | + /** Available sub-Receiver */ |
|
17 | + const COMMENTS = 'Comments'; |
|
18 | 18 | |
19 | - /** |
|
20 | - * List a user's gists |
|
21 | - * |
|
22 | - * @link https://developer.github.com/v3/gists/#list-a-users-gists |
|
23 | - * |
|
24 | - * @param string $username |
|
25 | - * @param string $since |
|
26 | - * |
|
27 | - * @return array |
|
28 | - */ |
|
29 | - public function listGists(string $username = null, string $since = '1970-01-01'): array |
|
30 | - { |
|
31 | - $url = '/gists'; |
|
32 | - if (null !== $username) { |
|
33 | - $url = '/users/:username/gists'; |
|
34 | - } |
|
19 | + /** |
|
20 | + * List a user's gists |
|
21 | + * |
|
22 | + * @link https://developer.github.com/v3/gists/#list-a-users-gists |
|
23 | + * |
|
24 | + * @param string $username |
|
25 | + * @param string $since |
|
26 | + * |
|
27 | + * @return array |
|
28 | + */ |
|
29 | + public function listGists(string $username = null, string $since = '1970-01-01'): array |
|
30 | + { |
|
31 | + $url = '/gists'; |
|
32 | + if (null !== $username) { |
|
33 | + $url = '/users/:username/gists'; |
|
34 | + } |
|
35 | 35 | |
36 | - return $this->getApi()->request($this->getApi()->sprintf(':url?:arg', $url, $username, |
|
37 | - http_build_query(['since' => (new DateTime($since))->format(DateTime::ATOM)]))); |
|
38 | - } |
|
36 | + return $this->getApi()->request($this->getApi()->sprintf(':url?:arg', $url, $username, |
|
37 | + http_build_query(['since' => (new DateTime($since))->format(DateTime::ATOM)]))); |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * List all public gists: |
|
42 | - * |
|
43 | - * @link https://developer.github.com/v3/gists/#list-all-public-gists |
|
44 | - * |
|
45 | - * @param string $since |
|
46 | - * |
|
47 | - * @return array |
|
48 | - */ |
|
49 | - public function listPublicGists(string $since = '1970-01-01'): array |
|
50 | - { |
|
51 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/public?:arg', |
|
52 | - http_build_query(['since' => (new DateTime($since))->format(DateTime::ATOM)]))); |
|
53 | - } |
|
40 | + /** |
|
41 | + * List all public gists: |
|
42 | + * |
|
43 | + * @link https://developer.github.com/v3/gists/#list-all-public-gists |
|
44 | + * |
|
45 | + * @param string $since |
|
46 | + * |
|
47 | + * @return array |
|
48 | + */ |
|
49 | + public function listPublicGists(string $since = '1970-01-01'): array |
|
50 | + { |
|
51 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/public?:arg', |
|
52 | + http_build_query(['since' => (new DateTime($since))->format(DateTime::ATOM)]))); |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * List the authenticated user’s starred gists |
|
57 | - * |
|
58 | - * @link https://developer.github.com/v3/gists/#list-starred-gists |
|
59 | - * |
|
60 | - * @param string $since |
|
61 | - * |
|
62 | - * @return array |
|
63 | - */ |
|
64 | - public function listUsersStarredGists(string $since = '1970-01-01'): array |
|
65 | - { |
|
66 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/starred?:arg', |
|
67 | - http_build_query(['since' => (new DateTime($since))->format(DateTime::ATOM)]))); |
|
68 | - } |
|
55 | + /** |
|
56 | + * List the authenticated user’s starred gists |
|
57 | + * |
|
58 | + * @link https://developer.github.com/v3/gists/#list-starred-gists |
|
59 | + * |
|
60 | + * @param string $since |
|
61 | + * |
|
62 | + * @return array |
|
63 | + */ |
|
64 | + public function listUsersStarredGists(string $since = '1970-01-01'): array |
|
65 | + { |
|
66 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/starred?:arg', |
|
67 | + http_build_query(['since' => (new DateTime($since))->format(DateTime::ATOM)]))); |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * Get a single gist |
|
72 | - * |
|
73 | - * @link https://developer.github.com/v3/gists/#get-a-single-gist |
|
74 | - * |
|
75 | - * @param string $id |
|
76 | - * |
|
77 | - * @return array |
|
78 | - */ |
|
79 | - public function getGist(string $id): array |
|
80 | - { |
|
81 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:id', $id)); |
|
82 | - } |
|
70 | + /** |
|
71 | + * Get a single gist |
|
72 | + * |
|
73 | + * @link https://developer.github.com/v3/gists/#get-a-single-gist |
|
74 | + * |
|
75 | + * @param string $id |
|
76 | + * |
|
77 | + * @return array |
|
78 | + */ |
|
79 | + public function getGist(string $id): array |
|
80 | + { |
|
81 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:id', $id)); |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * Get a specific revision of a gist |
|
86 | - * |
|
87 | - * @link https://developer.github.com/v3/gists/#get-a-specific-revision-of-a-gist |
|
88 | - * |
|
89 | - * @param string $id |
|
90 | - * @param string $sha |
|
91 | - * |
|
92 | - * @return array |
|
93 | - * @throws \Exception |
|
94 | - */ |
|
95 | - public function getGistRevision(string $id, string $sha): array |
|
96 | - { |
|
97 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/:sha', $id, $sha)); |
|
98 | - } |
|
84 | + /** |
|
85 | + * Get a specific revision of a gist |
|
86 | + * |
|
87 | + * @link https://developer.github.com/v3/gists/#get-a-specific-revision-of-a-gist |
|
88 | + * |
|
89 | + * @param string $id |
|
90 | + * @param string $sha |
|
91 | + * |
|
92 | + * @return array |
|
93 | + * @throws \Exception |
|
94 | + */ |
|
95 | + public function getGistRevision(string $id, string $sha): array |
|
96 | + { |
|
97 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/:sha', $id, $sha)); |
|
98 | + } |
|
99 | 99 | |
100 | - /** |
|
101 | - * Create a gist |
|
102 | - * |
|
103 | - * @link https://developer.github.com/v3/gists/#create-a-gist |
|
104 | - * |
|
105 | - * @param array $files |
|
106 | - * @param string $description |
|
107 | - * @param bool $public |
|
108 | - * |
|
109 | - * @return array |
|
110 | - */ |
|
111 | - public function createGist(array $files, string $description = null, bool $public = false): array |
|
112 | - { |
|
113 | - return $this->getApi()->request($this->getApi()->sprintf('/gists'), Request::METHOD_POST, [ |
|
114 | - 'files' => $files, |
|
115 | - 'description' => $description, |
|
116 | - 'public' => $public |
|
117 | - ]); |
|
118 | - } |
|
100 | + /** |
|
101 | + * Create a gist |
|
102 | + * |
|
103 | + * @link https://developer.github.com/v3/gists/#create-a-gist |
|
104 | + * |
|
105 | + * @param array $files |
|
106 | + * @param string $description |
|
107 | + * @param bool $public |
|
108 | + * |
|
109 | + * @return array |
|
110 | + */ |
|
111 | + public function createGist(array $files, string $description = null, bool $public = false): array |
|
112 | + { |
|
113 | + return $this->getApi()->request($this->getApi()->sprintf('/gists'), Request::METHOD_POST, [ |
|
114 | + 'files' => $files, |
|
115 | + 'description' => $description, |
|
116 | + 'public' => $public |
|
117 | + ]); |
|
118 | + } |
|
119 | 119 | |
120 | - /** |
|
121 | - * Edit a gist |
|
122 | - * |
|
123 | - * @link https://developer.github.com/v3/gists/#edit-a-gist |
|
124 | - * |
|
125 | - * @param string $id |
|
126 | - * @param string $description |
|
127 | - * @param array $files |
|
128 | - * @param string $content |
|
129 | - * @param string $filename |
|
130 | - * |
|
131 | - * @return array |
|
132 | - */ |
|
133 | - public function editGist(string $id, string $description = '', array $files = [], string $content = '', |
|
134 | - string $filename = ''): array |
|
135 | - { |
|
136 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:id', $id), Request::METHOD_PATCH, [ |
|
137 | - 'description' => $description, |
|
138 | - 'files' => $files, |
|
139 | - 'content' => $content, |
|
140 | - 'filename' => $filename |
|
141 | - ]); |
|
142 | - } |
|
120 | + /** |
|
121 | + * Edit a gist |
|
122 | + * |
|
123 | + * @link https://developer.github.com/v3/gists/#edit-a-gist |
|
124 | + * |
|
125 | + * @param string $id |
|
126 | + * @param string $description |
|
127 | + * @param array $files |
|
128 | + * @param string $content |
|
129 | + * @param string $filename |
|
130 | + * |
|
131 | + * @return array |
|
132 | + */ |
|
133 | + public function editGist(string $id, string $description = '', array $files = [], string $content = '', |
|
134 | + string $filename = ''): array |
|
135 | + { |
|
136 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:id', $id), Request::METHOD_PATCH, [ |
|
137 | + 'description' => $description, |
|
138 | + 'files' => $files, |
|
139 | + 'content' => $content, |
|
140 | + 'filename' => $filename |
|
141 | + ]); |
|
142 | + } |
|
143 | 143 | |
144 | - /** |
|
145 | - * List gist commits |
|
146 | - * |
|
147 | - * @link https://developer.github.com/v3/gists/#list-gist-commits |
|
148 | - * |
|
149 | - * @param string $id |
|
150 | - * |
|
151 | - * @return array |
|
152 | - */ |
|
153 | - public function listGistsCommits(string $id): array |
|
154 | - { |
|
155 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/commits', $id)); |
|
156 | - } |
|
144 | + /** |
|
145 | + * List gist commits |
|
146 | + * |
|
147 | + * @link https://developer.github.com/v3/gists/#list-gist-commits |
|
148 | + * |
|
149 | + * @param string $id |
|
150 | + * |
|
151 | + * @return array |
|
152 | + */ |
|
153 | + public function listGistsCommits(string $id): array |
|
154 | + { |
|
155 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/commits', $id)); |
|
156 | + } |
|
157 | 157 | |
158 | - /** |
|
159 | - * Star a gist |
|
160 | - * |
|
161 | - * @link https://developer.github.com/v3/gists/#star-a-gist |
|
162 | - * |
|
163 | - * @param string $id |
|
164 | - * |
|
165 | - * @return bool |
|
166 | - */ |
|
167 | - public function starGist(string $id): bool |
|
168 | - { |
|
169 | - $this->getApi()->request($this->getApi()->sprintf('/gists/:id/star', $id), Request::METHOD_PUT); |
|
158 | + /** |
|
159 | + * Star a gist |
|
160 | + * |
|
161 | + * @link https://developer.github.com/v3/gists/#star-a-gist |
|
162 | + * |
|
163 | + * @param string $id |
|
164 | + * |
|
165 | + * @return bool |
|
166 | + */ |
|
167 | + public function starGist(string $id): bool |
|
168 | + { |
|
169 | + $this->getApi()->request($this->getApi()->sprintf('/gists/:id/star', $id), Request::METHOD_PUT); |
|
170 | 170 | |
171 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
172 | - return true; |
|
173 | - } |
|
171 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
172 | + return true; |
|
173 | + } |
|
174 | 174 | |
175 | - return false; |
|
176 | - } |
|
175 | + return false; |
|
176 | + } |
|
177 | 177 | |
178 | - /** |
|
179 | - * Unstar a gist |
|
180 | - * |
|
181 | - * @link https://developer.github.com/v3/gists/#unstar-a-gist |
|
182 | - * |
|
183 | - * @param string $id |
|
184 | - * |
|
185 | - * @return bool |
|
186 | - */ |
|
187 | - public function unStarGist(string $id): bool |
|
188 | - { |
|
189 | - $this->getApi()->request($this->getApi()->sprintf('/gists/:id/star', $id), Request::METHOD_DELETE); |
|
178 | + /** |
|
179 | + * Unstar a gist |
|
180 | + * |
|
181 | + * @link https://developer.github.com/v3/gists/#unstar-a-gist |
|
182 | + * |
|
183 | + * @param string $id |
|
184 | + * |
|
185 | + * @return bool |
|
186 | + */ |
|
187 | + public function unStarGist(string $id): bool |
|
188 | + { |
|
189 | + $this->getApi()->request($this->getApi()->sprintf('/gists/:id/star', $id), Request::METHOD_DELETE); |
|
190 | 190 | |
191 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
192 | - return true; |
|
193 | - } |
|
191 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
192 | + return true; |
|
193 | + } |
|
194 | 194 | |
195 | - return false; |
|
196 | - } |
|
195 | + return false; |
|
196 | + } |
|
197 | 197 | |
198 | - /** |
|
199 | - * Check if a gist is starred |
|
200 | - * |
|
201 | - * @link https://developer.github.com/v3/gists/#check-if-a-gist-is-starred |
|
202 | - * |
|
203 | - * @param string $id |
|
204 | - * |
|
205 | - * @return bool |
|
206 | - */ |
|
207 | - public function checkGistIsStarred(string $id): bool |
|
208 | - { |
|
209 | - $this->getApi()->request($this->getApi()->sprintf('/gists/:id/star', $id)); |
|
198 | + /** |
|
199 | + * Check if a gist is starred |
|
200 | + * |
|
201 | + * @link https://developer.github.com/v3/gists/#check-if-a-gist-is-starred |
|
202 | + * |
|
203 | + * @param string $id |
|
204 | + * |
|
205 | + * @return bool |
|
206 | + */ |
|
207 | + public function checkGistIsStarred(string $id): bool |
|
208 | + { |
|
209 | + $this->getApi()->request($this->getApi()->sprintf('/gists/:id/star', $id)); |
|
210 | 210 | |
211 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
212 | - return true; |
|
213 | - } |
|
211 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
212 | + return true; |
|
213 | + } |
|
214 | 214 | |
215 | - return false; |
|
216 | - } |
|
215 | + return false; |
|
216 | + } |
|
217 | 217 | |
218 | - /** |
|
219 | - * Fork a gist |
|
220 | - * |
|
221 | - * @link https://developer.github.com/v3/gists/#fork-a-gist |
|
222 | - * |
|
223 | - * @param string $id |
|
224 | - * |
|
225 | - * @return array |
|
226 | - */ |
|
227 | - public function forkGist(string $id): array |
|
228 | - { |
|
229 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/forks', $id), Request::METHOD_POST); |
|
230 | - } |
|
218 | + /** |
|
219 | + * Fork a gist |
|
220 | + * |
|
221 | + * @link https://developer.github.com/v3/gists/#fork-a-gist |
|
222 | + * |
|
223 | + * @param string $id |
|
224 | + * |
|
225 | + * @return array |
|
226 | + */ |
|
227 | + public function forkGist(string $id): array |
|
228 | + { |
|
229 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/forks', $id), Request::METHOD_POST); |
|
230 | + } |
|
231 | 231 | |
232 | - /** |
|
233 | - * List gist forks |
|
234 | - * |
|
235 | - * @link https://developer.github.com/v3/gists/#list-gist-forks |
|
236 | - * |
|
237 | - * @param string $id |
|
238 | - * |
|
239 | - * @return array |
|
240 | - */ |
|
241 | - public function listGistForks(string $id): array |
|
242 | - { |
|
243 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/forks', $id)); |
|
244 | - } |
|
232 | + /** |
|
233 | + * List gist forks |
|
234 | + * |
|
235 | + * @link https://developer.github.com/v3/gists/#list-gist-forks |
|
236 | + * |
|
237 | + * @param string $id |
|
238 | + * |
|
239 | + * @return array |
|
240 | + */ |
|
241 | + public function listGistForks(string $id): array |
|
242 | + { |
|
243 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/forks', $id)); |
|
244 | + } |
|
245 | 245 | |
246 | - /** |
|
247 | - * Delete a gist |
|
248 | - * |
|
249 | - * @link https://developer.github.com/v3/gists/#delete-a-gist |
|
250 | - * |
|
251 | - * @param string $id |
|
252 | - * |
|
253 | - * @return bool |
|
254 | - */ |
|
255 | - public function deleteGist(string $id): bool |
|
256 | - { |
|
257 | - $this->getApi()->request($this->getApi()->sprintf('/gists/:id', $id), Request::METHOD_DELETE); |
|
246 | + /** |
|
247 | + * Delete a gist |
|
248 | + * |
|
249 | + * @link https://developer.github.com/v3/gists/#delete-a-gist |
|
250 | + * |
|
251 | + * @param string $id |
|
252 | + * |
|
253 | + * @return bool |
|
254 | + */ |
|
255 | + public function deleteGist(string $id): bool |
|
256 | + { |
|
257 | + $this->getApi()->request($this->getApi()->sprintf('/gists/:id', $id), Request::METHOD_DELETE); |
|
258 | 258 | |
259 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
260 | - return true; |
|
261 | - } |
|
259 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
260 | + return true; |
|
261 | + } |
|
262 | 262 | |
263 | - return false; |
|
264 | - } |
|
263 | + return false; |
|
264 | + } |
|
265 | 265 | } |
266 | 266 | \ No newline at end of file |
@@ -12,91 +12,91 @@ |
||
12 | 12 | class Comments extends AbstractGists |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * List comments on a gist |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/gists/comments/#list-comments-on-a-gist |
|
19 | - * |
|
20 | - * @param string $gistId |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function listComments(string $gistId): array |
|
25 | - { |
|
26 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments', $gistId)); |
|
27 | - } |
|
15 | + /** |
|
16 | + * List comments on a gist |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/gists/comments/#list-comments-on-a-gist |
|
19 | + * |
|
20 | + * @param string $gistId |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function listComments(string $gistId): array |
|
25 | + { |
|
26 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments', $gistId)); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Get a single comment |
|
31 | - * |
|
32 | - * @link https://developer.github.com/v3/gists/comments/#get-a-single-comment |
|
33 | - * |
|
34 | - * @param string $gistId |
|
35 | - * @param int $id |
|
36 | - * |
|
37 | - * @return array |
|
38 | - */ |
|
39 | - public function getSingleComment(string $gistId, int $id): array |
|
40 | - { |
|
41 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments/:id', $gistId, (string)$id)); |
|
42 | - } |
|
29 | + /** |
|
30 | + * Get a single comment |
|
31 | + * |
|
32 | + * @link https://developer.github.com/v3/gists/comments/#get-a-single-comment |
|
33 | + * |
|
34 | + * @param string $gistId |
|
35 | + * @param int $id |
|
36 | + * |
|
37 | + * @return array |
|
38 | + */ |
|
39 | + public function getSingleComment(string $gistId, int $id): array |
|
40 | + { |
|
41 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments/:id', $gistId, (string)$id)); |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * Create a comment |
|
46 | - * |
|
47 | - * @link https://developer.github.com/v3/gists/comments/#create-a-comment |
|
48 | - * |
|
49 | - * @param string $gistId |
|
50 | - * @param string $body |
|
51 | - * |
|
52 | - * @return array |
|
53 | - */ |
|
54 | - public function createComment(string $gistId, string $body): array |
|
55 | - { |
|
56 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments', $gistId), |
|
57 | - Request::METHOD_POST, [ |
|
58 | - 'body' => $body |
|
59 | - ]); |
|
60 | - } |
|
44 | + /** |
|
45 | + * Create a comment |
|
46 | + * |
|
47 | + * @link https://developer.github.com/v3/gists/comments/#create-a-comment |
|
48 | + * |
|
49 | + * @param string $gistId |
|
50 | + * @param string $body |
|
51 | + * |
|
52 | + * @return array |
|
53 | + */ |
|
54 | + public function createComment(string $gistId, string $body): array |
|
55 | + { |
|
56 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments', $gistId), |
|
57 | + Request::METHOD_POST, [ |
|
58 | + 'body' => $body |
|
59 | + ]); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Edit a comment |
|
64 | - * |
|
65 | - * @link https://developer.github.com/v3/gists/comments/#edit-a-comment |
|
66 | - * |
|
67 | - * @param string $gistId |
|
68 | - * @param int $id |
|
69 | - * @param string $body |
|
70 | - * |
|
71 | - * @return array |
|
72 | - */ |
|
73 | - public function editComment(string $gistId, int $id, string $body): array |
|
74 | - { |
|
75 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments/:id', $gistId, (string)$id), |
|
76 | - Request::METHOD_PATCH, [ |
|
77 | - 'body' => $body |
|
78 | - ]); |
|
79 | - } |
|
62 | + /** |
|
63 | + * Edit a comment |
|
64 | + * |
|
65 | + * @link https://developer.github.com/v3/gists/comments/#edit-a-comment |
|
66 | + * |
|
67 | + * @param string $gistId |
|
68 | + * @param int $id |
|
69 | + * @param string $body |
|
70 | + * |
|
71 | + * @return array |
|
72 | + */ |
|
73 | + public function editComment(string $gistId, int $id, string $body): array |
|
74 | + { |
|
75 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments/:id', $gistId, (string)$id), |
|
76 | + Request::METHOD_PATCH, [ |
|
77 | + 'body' => $body |
|
78 | + ]); |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * Delete a comment |
|
83 | - * |
|
84 | - * @link https://developer.github.com/v3/gists/comments/#delete-a-comment |
|
85 | - * |
|
86 | - * @param string $gistId |
|
87 | - * @param int $id |
|
88 | - * |
|
89 | - * @return bool |
|
90 | - */ |
|
91 | - public function deleteComment(string $gistId, int $id): bool |
|
92 | - { |
|
93 | - $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments/:id', $gistId, (string)$id), |
|
94 | - Request::METHOD_DELETE); |
|
81 | + /** |
|
82 | + * Delete a comment |
|
83 | + * |
|
84 | + * @link https://developer.github.com/v3/gists/comments/#delete-a-comment |
|
85 | + * |
|
86 | + * @param string $gistId |
|
87 | + * @param int $id |
|
88 | + * |
|
89 | + * @return bool |
|
90 | + */ |
|
91 | + public function deleteComment(string $gistId, int $id): bool |
|
92 | + { |
|
93 | + $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments/:id', $gistId, (string)$id), |
|
94 | + Request::METHOD_DELETE); |
|
95 | 95 | |
96 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
97 | - return true; |
|
98 | - } |
|
96 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
97 | + return true; |
|
98 | + } |
|
99 | 99 | |
100 | - return false; |
|
101 | - } |
|
100 | + return false; |
|
101 | + } |
|
102 | 102 | } |
103 | 103 | \ No newline at end of file |
@@ -10,88 +10,88 @@ |
||
10 | 10 | */ |
11 | 11 | abstract class AbstractReceiver |
12 | 12 | { |
13 | - /** Api trait */ |
|
14 | - use Api; |
|
13 | + /** Api trait */ |
|
14 | + use Api; |
|
15 | 15 | |
16 | - /** Protected properties */ |
|
17 | - protected $owner = ''; |
|
18 | - protected $repo = ''; |
|
16 | + /** Protected properties */ |
|
17 | + protected $owner = ''; |
|
18 | + protected $repo = ''; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Constructor |
|
22 | - * |
|
23 | - * @param AbstractApi $api |
|
24 | - */ |
|
25 | - public function __construct(AbstractApi $api) |
|
26 | - { |
|
27 | - $this->setApi($api); |
|
28 | - } |
|
20 | + /** |
|
21 | + * Constructor |
|
22 | + * |
|
23 | + * @param AbstractApi $api |
|
24 | + */ |
|
25 | + public function __construct(AbstractApi $api) |
|
26 | + { |
|
27 | + $this->setApi($api); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Get owner |
|
32 | - * |
|
33 | - * @return string |
|
34 | - */ |
|
35 | - public function getOwner(): string |
|
36 | - { |
|
37 | - return $this->owner; |
|
38 | - } |
|
30 | + /** |
|
31 | + * Get owner |
|
32 | + * |
|
33 | + * @return string |
|
34 | + */ |
|
35 | + public function getOwner(): string |
|
36 | + { |
|
37 | + return $this->owner; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Set owner |
|
42 | - * |
|
43 | - * @param string $owner |
|
44 | - * |
|
45 | - * @return AbstractReceiver |
|
46 | - */ |
|
47 | - public function setOwner(string $owner): AbstractReceiver |
|
48 | - { |
|
49 | - $this->owner = $owner; |
|
40 | + /** |
|
41 | + * Set owner |
|
42 | + * |
|
43 | + * @param string $owner |
|
44 | + * |
|
45 | + * @return AbstractReceiver |
|
46 | + */ |
|
47 | + public function setOwner(string $owner): AbstractReceiver |
|
48 | + { |
|
49 | + $this->owner = $owner; |
|
50 | 50 | |
51 | - return $this; |
|
52 | - } |
|
51 | + return $this; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Get repository |
|
56 | - * |
|
57 | - * @return string |
|
58 | - */ |
|
59 | - public function getRepo(): string |
|
60 | - { |
|
61 | - return $this->repo; |
|
62 | - } |
|
54 | + /** |
|
55 | + * Get repository |
|
56 | + * |
|
57 | + * @return string |
|
58 | + */ |
|
59 | + public function getRepo(): string |
|
60 | + { |
|
61 | + return $this->repo; |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * Set repository |
|
66 | - * |
|
67 | - * @param string $repo |
|
68 | - * |
|
69 | - * @return AbstractReceiver |
|
70 | - */ |
|
71 | - public function setRepo(string $repo): AbstractReceiver |
|
72 | - { |
|
73 | - $this->repo = $repo; |
|
64 | + /** |
|
65 | + * Set repository |
|
66 | + * |
|
67 | + * @param string $repo |
|
68 | + * |
|
69 | + * @return AbstractReceiver |
|
70 | + */ |
|
71 | + public function setRepo(string $repo): AbstractReceiver |
|
72 | + { |
|
73 | + $this->repo = $repo; |
|
74 | 74 | |
75 | - return $this; |
|
76 | - } |
|
75 | + return $this; |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * Get a sub-receiver |
|
80 | - * |
|
81 | - * @param string $name |
|
82 | - * |
|
83 | - * @return null|object |
|
84 | - */ |
|
85 | - public function getReceiver(string $name) |
|
86 | - { |
|
87 | - $classPath = explode('\\', get_called_class()); |
|
88 | - $class = (string)$this->getApi() |
|
89 | - ->sprintf(':namespace\:class\:method', __NAMESPACE__, end($classPath), $name); |
|
78 | + /** |
|
79 | + * Get a sub-receiver |
|
80 | + * |
|
81 | + * @param string $name |
|
82 | + * |
|
83 | + * @return null|object |
|
84 | + */ |
|
85 | + public function getReceiver(string $name) |
|
86 | + { |
|
87 | + $classPath = explode('\\', get_called_class()); |
|
88 | + $class = (string)$this->getApi() |
|
89 | + ->sprintf(':namespace\:class\:method', __NAMESPACE__, end($classPath), $name); |
|
90 | 90 | |
91 | - if (class_exists($class)) { |
|
92 | - return new $class($this); |
|
93 | - } |
|
91 | + if (class_exists($class)) { |
|
92 | + return new $class($this); |
|
93 | + } |
|
94 | 94 | |
95 | - return null; |
|
96 | - } |
|
95 | + return null; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 | \ No newline at end of file |
@@ -12,44 +12,44 @@ |
||
12 | 12 | */ |
13 | 13 | abstract class AbstractGitData |
14 | 14 | { |
15 | - /** Api trait */ |
|
16 | - use Api; |
|
15 | + /** Api trait */ |
|
16 | + use Api; |
|
17 | 17 | |
18 | - /** Properties */ |
|
19 | - protected $gitData; |
|
18 | + /** Properties */ |
|
19 | + protected $gitData; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Constructor |
|
23 | - * |
|
24 | - * @param GitData $gitData |
|
25 | - */ |
|
26 | - public function __construct(GitData $gitData) |
|
27 | - { |
|
28 | - $this->setGitData($gitData); |
|
29 | - $this->setApi($gitData->getApi()); |
|
30 | - } |
|
21 | + /** |
|
22 | + * Constructor |
|
23 | + * |
|
24 | + * @param GitData $gitData |
|
25 | + */ |
|
26 | + public function __construct(GitData $gitData) |
|
27 | + { |
|
28 | + $this->setGitData($gitData); |
|
29 | + $this->setApi($gitData->getApi()); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * Get gitData |
|
34 | - * |
|
35 | - * @return GitData |
|
36 | - */ |
|
37 | - public function getGitData(): GitData |
|
38 | - { |
|
39 | - return $this->gitData; |
|
40 | - } |
|
32 | + /** |
|
33 | + * Get gitData |
|
34 | + * |
|
35 | + * @return GitData |
|
36 | + */ |
|
37 | + public function getGitData(): GitData |
|
38 | + { |
|
39 | + return $this->gitData; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Set gitData |
|
44 | - * |
|
45 | - * @param GitData $gitData |
|
46 | - * |
|
47 | - * @return AbstractGitData |
|
48 | - */ |
|
49 | - public function setGitData(GitData $gitData): AbstractGitData |
|
50 | - { |
|
51 | - $this->gitData = $gitData; |
|
42 | + /** |
|
43 | + * Set gitData |
|
44 | + * |
|
45 | + * @param GitData $gitData |
|
46 | + * |
|
47 | + * @return AbstractGitData |
|
48 | + */ |
|
49 | + public function setGitData(GitData $gitData): AbstractGitData |
|
50 | + { |
|
51 | + $this->gitData = $gitData; |
|
52 | 52 | |
53 | - return $this; |
|
54 | - } |
|
53 | + return $this; |
|
54 | + } |
|
55 | 55 | } |
56 | 56 | \ No newline at end of file |