@@ -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 |
@@ -12,65 +12,65 @@ |
||
12 | 12 | abstract class AbstractActivity |
13 | 13 | { |
14 | 14 | |
15 | - protected $activity; |
|
16 | - protected $api; |
|
15 | + protected $activity; |
|
16 | + protected $api; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Constructor |
|
20 | - * |
|
21 | - * @param Activity $activity |
|
22 | - */ |
|
23 | - public function __construct(Activity $activity) |
|
24 | - { |
|
25 | - $this->setActivity($activity); |
|
26 | - $this->setApi($activity->getApi()); |
|
27 | - } |
|
18 | + /** |
|
19 | + * Constructor |
|
20 | + * |
|
21 | + * @param Activity $activity |
|
22 | + */ |
|
23 | + public function __construct(Activity $activity) |
|
24 | + { |
|
25 | + $this->setActivity($activity); |
|
26 | + $this->setApi($activity->getApi()); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Get activity |
|
31 | - * |
|
32 | - * @return Activity |
|
33 | - */ |
|
34 | - public function getActivity(): Activity |
|
35 | - { |
|
36 | - return $this->activity; |
|
37 | - } |
|
29 | + /** |
|
30 | + * Get activity |
|
31 | + * |
|
32 | + * @return Activity |
|
33 | + */ |
|
34 | + public function getActivity(): Activity |
|
35 | + { |
|
36 | + return $this->activity; |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Set activity |
|
41 | - * |
|
42 | - * @param Activity $activity |
|
43 | - * |
|
44 | - * @return AbstractActivity |
|
45 | - */ |
|
46 | - public function setActivity(Activity $activity): AbstractActivity |
|
47 | - { |
|
48 | - $this->activity = $activity; |
|
39 | + /** |
|
40 | + * Set activity |
|
41 | + * |
|
42 | + * @param Activity $activity |
|
43 | + * |
|
44 | + * @return AbstractActivity |
|
45 | + */ |
|
46 | + public function setActivity(Activity $activity): AbstractActivity |
|
47 | + { |
|
48 | + $this->activity = $activity; |
|
49 | 49 | |
50 | - return $this; |
|
51 | - } |
|
50 | + return $this; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Get api |
|
55 | - * |
|
56 | - * @return AbstractApi |
|
57 | - */ |
|
58 | - public function getApi(): AbstractApi |
|
59 | - { |
|
60 | - return $this->api; |
|
61 | - } |
|
53 | + /** |
|
54 | + * Get api |
|
55 | + * |
|
56 | + * @return AbstractApi |
|
57 | + */ |
|
58 | + public function getApi(): AbstractApi |
|
59 | + { |
|
60 | + return $this->api; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Set api |
|
65 | - * |
|
66 | - * @param AbstractApi $api |
|
67 | - * |
|
68 | - * @return AbstractActivity |
|
69 | - */ |
|
70 | - public function setApi(AbstractApi $api): AbstractActivity |
|
71 | - { |
|
72 | - $this->api = $api; |
|
63 | + /** |
|
64 | + * Set api |
|
65 | + * |
|
66 | + * @param AbstractApi $api |
|
67 | + * |
|
68 | + * @return AbstractActivity |
|
69 | + */ |
|
70 | + public function setApi(AbstractApi $api): AbstractActivity |
|
71 | + { |
|
72 | + $this->api = $api; |
|
73 | 73 | |
74 | - return $this; |
|
75 | - } |
|
74 | + return $this; |
|
75 | + } |
|
76 | 76 | } |
77 | 77 | \ No newline at end of file |
@@ -12,66 +12,66 @@ |
||
12 | 12 | abstract class AbstractPullRequests |
13 | 13 | { |
14 | 14 | |
15 | - /** Properties */ |
|
16 | - protected $pullRequests; |
|
17 | - protected $api; |
|
15 | + /** Properties */ |
|
16 | + protected $pullRequests; |
|
17 | + protected $api; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Constructor |
|
21 | - * |
|
22 | - * @param PullRequests $pullRequests |
|
23 | - */ |
|
24 | - public function __construct(PullRequests $pullRequests) |
|
25 | - { |
|
26 | - $this->setPullRequests($pullRequests); |
|
27 | - $this->setApi($pullRequests->getApi()); |
|
28 | - } |
|
19 | + /** |
|
20 | + * Constructor |
|
21 | + * |
|
22 | + * @param PullRequests $pullRequests |
|
23 | + */ |
|
24 | + public function __construct(PullRequests $pullRequests) |
|
25 | + { |
|
26 | + $this->setPullRequests($pullRequests); |
|
27 | + $this->setApi($pullRequests->getApi()); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Get pullRequests |
|
32 | - * |
|
33 | - * @return PullRequests |
|
34 | - */ |
|
35 | - public function getPullRequests(): PullRequests |
|
36 | - { |
|
37 | - return $this->pullRequests; |
|
38 | - } |
|
30 | + /** |
|
31 | + * Get pullRequests |
|
32 | + * |
|
33 | + * @return PullRequests |
|
34 | + */ |
|
35 | + public function getPullRequests(): PullRequests |
|
36 | + { |
|
37 | + return $this->pullRequests; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Set pullRequests |
|
42 | - * |
|
43 | - * @param PullRequests $pullRequests |
|
44 | - * |
|
45 | - * @return AbstractPullRequests |
|
46 | - */ |
|
47 | - public function setPullRequests(PullRequests $pullRequests): AbstractPullRequests |
|
48 | - { |
|
49 | - $this->pullRequests = $pullRequests; |
|
40 | + /** |
|
41 | + * Set pullRequests |
|
42 | + * |
|
43 | + * @param PullRequests $pullRequests |
|
44 | + * |
|
45 | + * @return AbstractPullRequests |
|
46 | + */ |
|
47 | + public function setPullRequests(PullRequests $pullRequests): AbstractPullRequests |
|
48 | + { |
|
49 | + $this->pullRequests = $pullRequests; |
|
50 | 50 | |
51 | - return $this; |
|
52 | - } |
|
51 | + return $this; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Get api |
|
56 | - * |
|
57 | - * @return AbstractApi |
|
58 | - */ |
|
59 | - public function getApi(): AbstractApi |
|
60 | - { |
|
61 | - return $this->api; |
|
62 | - } |
|
54 | + /** |
|
55 | + * Get api |
|
56 | + * |
|
57 | + * @return AbstractApi |
|
58 | + */ |
|
59 | + public function getApi(): AbstractApi |
|
60 | + { |
|
61 | + return $this->api; |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * Set api |
|
66 | - * |
|
67 | - * @param AbstractApi $api |
|
68 | - * |
|
69 | - * @return AbstractPullRequests |
|
70 | - */ |
|
71 | - public function setApi(AbstractApi $api): AbstractPullRequests |
|
72 | - { |
|
73 | - $this->api = $api; |
|
64 | + /** |
|
65 | + * Set api |
|
66 | + * |
|
67 | + * @param AbstractApi $api |
|
68 | + * |
|
69 | + * @return AbstractPullRequests |
|
70 | + */ |
|
71 | + public function setApi(AbstractApi $api): AbstractPullRequests |
|
72 | + { |
|
73 | + $this->api = $api; |
|
74 | 74 | |
75 | - return $this; |
|
76 | - } |
|
75 | + return $this; |
|
76 | + } |
|
77 | 77 | } |
78 | 78 | \ 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 |
@@ -12,103 +12,103 @@ |
||
12 | 12 | class Comments extends AbstractRepositories |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * List commit comments for a repository |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository |
|
19 | - * @return array |
|
20 | - */ |
|
21 | - public function listComments(): array |
|
22 | - { |
|
23 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments', |
|
24 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
25 | - } |
|
15 | + /** |
|
16 | + * List commit comments for a repository |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository |
|
19 | + * @return array |
|
20 | + */ |
|
21 | + public function listComments(): array |
|
22 | + { |
|
23 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments', |
|
24 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * List comments for a single commit |
|
29 | - * |
|
30 | - * @link https://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit |
|
31 | - * |
|
32 | - * @param string $ref |
|
33 | - * |
|
34 | - * @return array |
|
35 | - */ |
|
36 | - public function listCommitComments(string $ref): array |
|
37 | - { |
|
38 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits/:ref/comments', |
|
39 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $ref)); |
|
40 | - } |
|
27 | + /** |
|
28 | + * List comments for a single commit |
|
29 | + * |
|
30 | + * @link https://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit |
|
31 | + * |
|
32 | + * @param string $ref |
|
33 | + * |
|
34 | + * @return array |
|
35 | + */ |
|
36 | + public function listCommitComments(string $ref): array |
|
37 | + { |
|
38 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits/:ref/comments', |
|
39 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $ref)); |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Create a commit comment |
|
44 | - * |
|
45 | - * @link https://developer.github.com/v3/repos/comments/#create-a-commit-comment |
|
46 | - * |
|
47 | - * @param string $sha |
|
48 | - * @param string $body |
|
49 | - * @param string $path |
|
50 | - * @param int $position |
|
51 | - * |
|
52 | - * @return array |
|
53 | - */ |
|
54 | - public function addCommitComment(string $sha, string $body, string $path = '', int $position = 0): array |
|
55 | - { |
|
56 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits/:sha/comments', |
|
57 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $sha), Request::METHOD_POST, [ |
|
58 | - 'body' => $body, |
|
59 | - 'path' => $path, |
|
60 | - 'position' => $position |
|
61 | - ]); |
|
62 | - } |
|
42 | + /** |
|
43 | + * Create a commit comment |
|
44 | + * |
|
45 | + * @link https://developer.github.com/v3/repos/comments/#create-a-commit-comment |
|
46 | + * |
|
47 | + * @param string $sha |
|
48 | + * @param string $body |
|
49 | + * @param string $path |
|
50 | + * @param int $position |
|
51 | + * |
|
52 | + * @return array |
|
53 | + */ |
|
54 | + public function addCommitComment(string $sha, string $body, string $path = '', int $position = 0): array |
|
55 | + { |
|
56 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits/:sha/comments', |
|
57 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $sha), Request::METHOD_POST, [ |
|
58 | + 'body' => $body, |
|
59 | + 'path' => $path, |
|
60 | + 'position' => $position |
|
61 | + ]); |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * Get a single commit comment |
|
66 | - * |
|
67 | - * @link https://developer.github.com/v3/repos/comments/#get-a-single-commit-comment |
|
68 | - * |
|
69 | - * @param int $id |
|
70 | - * |
|
71 | - * @return array |
|
72 | - */ |
|
73 | - public function getCommitComment(int $id): array |
|
74 | - { |
|
75 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments/:id', |
|
76 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), (string)$id)); |
|
77 | - } |
|
64 | + /** |
|
65 | + * Get a single commit comment |
|
66 | + * |
|
67 | + * @link https://developer.github.com/v3/repos/comments/#get-a-single-commit-comment |
|
68 | + * |
|
69 | + * @param int $id |
|
70 | + * |
|
71 | + * @return array |
|
72 | + */ |
|
73 | + public function getCommitComment(int $id): array |
|
74 | + { |
|
75 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments/:id', |
|
76 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), (string)$id)); |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * Update a commit comment |
|
81 | - * |
|
82 | - * @link https://developer.github.com/v3/repos/comments/#update-a-commit-comment |
|
83 | - * |
|
84 | - * @param int $id |
|
85 | - * @param string $body |
|
86 | - * |
|
87 | - * @return array |
|
88 | - * @throws \Exception |
|
89 | - */ |
|
90 | - public function updateCommitComment(int $id, string $body): array |
|
91 | - { |
|
92 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments/:id', |
|
93 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), (string)$id), |
|
94 | - Request::METHOD_PATCH, [ |
|
95 | - 'body' => $body |
|
96 | - ]); |
|
97 | - } |
|
79 | + /** |
|
80 | + * Update a commit comment |
|
81 | + * |
|
82 | + * @link https://developer.github.com/v3/repos/comments/#update-a-commit-comment |
|
83 | + * |
|
84 | + * @param int $id |
|
85 | + * @param string $body |
|
86 | + * |
|
87 | + * @return array |
|
88 | + * @throws \Exception |
|
89 | + */ |
|
90 | + public function updateCommitComment(int $id, string $body): array |
|
91 | + { |
|
92 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments/:id', |
|
93 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), (string)$id), |
|
94 | + Request::METHOD_PATCH, [ |
|
95 | + 'body' => $body |
|
96 | + ]); |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * Delete a commit comment |
|
101 | - * |
|
102 | - * @link https://developer.github.com/v3/repos/comments/#delete-a-commit-comment |
|
103 | - * |
|
104 | - * @param int $id |
|
105 | - * |
|
106 | - * @return array |
|
107 | - */ |
|
108 | - public function deleteCommitComment(int $id): array |
|
109 | - { |
|
110 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments/:id', |
|
111 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), (string)$id), |
|
112 | - Request::METHOD_DELETE); |
|
113 | - } |
|
99 | + /** |
|
100 | + * Delete a commit comment |
|
101 | + * |
|
102 | + * @link https://developer.github.com/v3/repos/comments/#delete-a-commit-comment |
|
103 | + * |
|
104 | + * @param int $id |
|
105 | + * |
|
106 | + * @return array |
|
107 | + */ |
|
108 | + public function deleteCommitComment(int $id): array |
|
109 | + { |
|
110 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments/:id', |
|
111 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), (string)$id), |
|
112 | + Request::METHOD_DELETE); |
|
113 | + } |
|
114 | 114 | } |
115 | 115 | \ No newline at end of file |
@@ -13,35 +13,35 @@ |
||
13 | 13 | class Forks extends AbstractRepositories |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * List forks |
|
18 | - * |
|
19 | - * @link https://developer.github.com/v3/repos/forks/#list-forks |
|
20 | - * |
|
21 | - * @param string $sort |
|
22 | - * |
|
23 | - * @return array |
|
24 | - */ |
|
25 | - public function listForks(string $sort = AbstractApi::SORT_NEWEST): array |
|
26 | - { |
|
27 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/forks?:arg', |
|
28 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), |
|
29 | - http_build_query(['sort' => $sort]))); |
|
30 | - } |
|
16 | + /** |
|
17 | + * List forks |
|
18 | + * |
|
19 | + * @link https://developer.github.com/v3/repos/forks/#list-forks |
|
20 | + * |
|
21 | + * @param string $sort |
|
22 | + * |
|
23 | + * @return array |
|
24 | + */ |
|
25 | + public function listForks(string $sort = AbstractApi::SORT_NEWEST): array |
|
26 | + { |
|
27 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/forks?:arg', |
|
28 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), |
|
29 | + http_build_query(['sort' => $sort]))); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * Create a fork |
|
34 | - * |
|
35 | - * @link https://developer.github.com/v3/repos/forks/#create-a-fork |
|
36 | - * |
|
37 | - * @param string $organization |
|
38 | - * |
|
39 | - * @return array |
|
40 | - */ |
|
41 | - public function createFork(string $organization = ''): array |
|
42 | - { |
|
43 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/forks', |
|
44 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, |
|
45 | - ['organization' => $organization]); |
|
46 | - } |
|
32 | + /** |
|
33 | + * Create a fork |
|
34 | + * |
|
35 | + * @link https://developer.github.com/v3/repos/forks/#create-a-fork |
|
36 | + * |
|
37 | + * @param string $organization |
|
38 | + * |
|
39 | + * @return array |
|
40 | + */ |
|
41 | + public function createFork(string $organization = ''): array |
|
42 | + { |
|
43 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/forks', |
|
44 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, |
|
45 | + ['organization' => $organization]); |
|
46 | + } |
|
47 | 47 | } |
48 | 48 | \ No newline at end of file |
@@ -12,66 +12,66 @@ |
||
12 | 12 | class DeployKeys extends AbstractRepositories |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * List deploy keys |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/repos/keys/#list |
|
19 | - * @return array |
|
20 | - */ |
|
21 | - public function listDeployKeys(): array |
|
22 | - { |
|
23 | - return $this->getApi()->request($this->getApi() |
|
24 | - ->sprintf('/repos/:owner/:repo/keys', $this->getRepositories()->getOwner(), |
|
25 | - $this->getRepositories()->getRepo())); |
|
26 | - } |
|
15 | + /** |
|
16 | + * List deploy keys |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/repos/keys/#list |
|
19 | + * @return array |
|
20 | + */ |
|
21 | + public function listDeployKeys(): array |
|
22 | + { |
|
23 | + return $this->getApi()->request($this->getApi() |
|
24 | + ->sprintf('/repos/:owner/:repo/keys', $this->getRepositories()->getOwner(), |
|
25 | + $this->getRepositories()->getRepo())); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * Get a deploy key |
|
30 | - * |
|
31 | - * @link https://developer.github.com/v3/repos/keys/#get |
|
32 | - * |
|
33 | - * @param int $id |
|
34 | - * |
|
35 | - * @return array |
|
36 | - */ |
|
37 | - public function getDeployKey(int $id): array |
|
38 | - { |
|
39 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/keys/:id', |
|
40 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id)); |
|
41 | - } |
|
28 | + /** |
|
29 | + * Get a deploy key |
|
30 | + * |
|
31 | + * @link https://developer.github.com/v3/repos/keys/#get |
|
32 | + * |
|
33 | + * @param int $id |
|
34 | + * |
|
35 | + * @return array |
|
36 | + */ |
|
37 | + public function getDeployKey(int $id): array |
|
38 | + { |
|
39 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/keys/:id', |
|
40 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id)); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * Add a new deploy key |
|
45 | - * |
|
46 | - * @link https://developer.github.com/v3/repos/keys/#create |
|
47 | - * |
|
48 | - * @param string $title |
|
49 | - * @param string $key |
|
50 | - * |
|
51 | - * @return array |
|
52 | - */ |
|
53 | - public function addNewDeployKey(string $title, string $key): array |
|
54 | - { |
|
55 | - return $this->getApi()->request($this->getApi() |
|
56 | - ->sprintf('/repos/:owner/:repo/keys', $this->getRepositories()->getOwner(), |
|
57 | - $this->getRepositories()->getRepo()), Request::METHOD_POST, [ |
|
58 | - 'title' => $title, |
|
59 | - 'key' => $key |
|
60 | - ]); |
|
61 | - } |
|
43 | + /** |
|
44 | + * Add a new deploy key |
|
45 | + * |
|
46 | + * @link https://developer.github.com/v3/repos/keys/#create |
|
47 | + * |
|
48 | + * @param string $title |
|
49 | + * @param string $key |
|
50 | + * |
|
51 | + * @return array |
|
52 | + */ |
|
53 | + public function addNewDeployKey(string $title, string $key): array |
|
54 | + { |
|
55 | + return $this->getApi()->request($this->getApi() |
|
56 | + ->sprintf('/repos/:owner/:repo/keys', $this->getRepositories()->getOwner(), |
|
57 | + $this->getRepositories()->getRepo()), Request::METHOD_POST, [ |
|
58 | + 'title' => $title, |
|
59 | + 'key' => $key |
|
60 | + ]); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Remove a deploy key |
|
65 | - * |
|
66 | - * @link https://developer.github.com/v3/repos/keys/#delete |
|
67 | - * |
|
68 | - * @param int $id |
|
69 | - * |
|
70 | - * @return array |
|
71 | - */ |
|
72 | - public function removeDeployKey(int $id): array |
|
73 | - { |
|
74 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/keys/:id', |
|
75 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_DELETE); |
|
76 | - } |
|
63 | + /** |
|
64 | + * Remove a deploy key |
|
65 | + * |
|
66 | + * @link https://developer.github.com/v3/repos/keys/#delete |
|
67 | + * |
|
68 | + * @param int $id |
|
69 | + * |
|
70 | + * @return array |
|
71 | + */ |
|
72 | + public function removeDeployKey(int $id): array |
|
73 | + { |
|
74 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/keys/:id', |
|
75 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_DELETE); |
|
76 | + } |
|
77 | 77 | } |
78 | 78 | \ No newline at end of file |
@@ -12,58 +12,58 @@ |
||
12 | 12 | class Statuses extends AbstractRepositories |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Create a Status |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/repos/statuses/#create-a-status |
|
19 | - * |
|
20 | - * @param string $sha |
|
21 | - * @param string $state |
|
22 | - * @param string $targetUrl |
|
23 | - * @param string $description |
|
24 | - * @param string $context |
|
25 | - * |
|
26 | - * @return array |
|
27 | - */ |
|
28 | - public function createStatus(string $sha, string $state, string $targetUrl = null, string $description = null, |
|
29 | - string $context = 'default'): array |
|
30 | - { |
|
31 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/statuses/:sha', |
|
32 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $sha), Request::METHOD_POST, [ |
|
33 | - 'state' => $state, |
|
34 | - 'target_url' => $targetUrl, |
|
35 | - 'description' => $description, |
|
36 | - 'context' => $context |
|
37 | - ]); |
|
38 | - } |
|
15 | + /** |
|
16 | + * Create a Status |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/repos/statuses/#create-a-status |
|
19 | + * |
|
20 | + * @param string $sha |
|
21 | + * @param string $state |
|
22 | + * @param string $targetUrl |
|
23 | + * @param string $description |
|
24 | + * @param string $context |
|
25 | + * |
|
26 | + * @return array |
|
27 | + */ |
|
28 | + public function createStatus(string $sha, string $state, string $targetUrl = null, string $description = null, |
|
29 | + string $context = 'default'): array |
|
30 | + { |
|
31 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/statuses/:sha', |
|
32 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $sha), Request::METHOD_POST, [ |
|
33 | + 'state' => $state, |
|
34 | + 'target_url' => $targetUrl, |
|
35 | + 'description' => $description, |
|
36 | + 'context' => $context |
|
37 | + ]); |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * List Statuses for a specific Ref |
|
42 | - * |
|
43 | - * @link https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref |
|
44 | - * |
|
45 | - * @param string $ref |
|
46 | - * |
|
47 | - * @return array |
|
48 | - */ |
|
49 | - public function listStatuses(string $ref): array |
|
50 | - { |
|
51 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits/:ref/statuses', |
|
52 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $ref)); |
|
53 | - } |
|
40 | + /** |
|
41 | + * List Statuses for a specific Ref |
|
42 | + * |
|
43 | + * @link https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref |
|
44 | + * |
|
45 | + * @param string $ref |
|
46 | + * |
|
47 | + * @return array |
|
48 | + */ |
|
49 | + public function listStatuses(string $ref): array |
|
50 | + { |
|
51 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits/:ref/statuses', |
|
52 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $ref)); |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * Get the combined Status for a specific Ref |
|
57 | - * |
|
58 | - * @link https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref |
|
59 | - * |
|
60 | - * @param string $ref |
|
61 | - * |
|
62 | - * @return array |
|
63 | - */ |
|
64 | - public function getCombinedStatus(string $ref): array |
|
65 | - { |
|
66 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits/:ref/status', |
|
67 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $ref)); |
|
68 | - } |
|
55 | + /** |
|
56 | + * Get the combined Status for a specific Ref |
|
57 | + * |
|
58 | + * @link https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref |
|
59 | + * |
|
60 | + * @param string $ref |
|
61 | + * |
|
62 | + * @return array |
|
63 | + */ |
|
64 | + public function getCombinedStatus(string $ref): array |
|
65 | + { |
|
66 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits/:ref/status', |
|
67 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $ref)); |
|
68 | + } |
|
69 | 69 | } |
70 | 70 | \ No newline at end of file |