@@ -13,114 +13,114 @@ |
||
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( |
|
25 | - '/repos/:owner/:repo/stargazers', |
|
26 | - $this->getActivity()->getOwner(), |
|
27 | - $this->getActivity()->getRepo() |
|
28 | - )); |
|
29 | - } |
|
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( |
|
25 | + '/repos/:owner/:repo/stargazers', |
|
26 | + $this->getActivity()->getOwner(), |
|
27 | + $this->getActivity()->getRepo() |
|
28 | + )); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * List repositories being starred |
|
33 | - * |
|
34 | - * @link https://developer.github.com/v3/activity/starring/#list-repositories-being-starred |
|
35 | - * |
|
36 | - * @param string $sort |
|
37 | - * @param string $direction |
|
38 | - * @param string $username |
|
39 | - * |
|
40 | - * @return array |
|
41 | - */ |
|
42 | - public function listRepositories( |
|
43 | - string $sort = AbstractApi::SORT_CREATED, |
|
44 | - string $direction = AbstractApi::DIRECTION_DESC, |
|
45 | - string $username = null |
|
46 | - ): array { |
|
47 | - if (null !== $username) { |
|
48 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
49 | - '/users/:username/starred?:args', |
|
50 | - $username, |
|
51 | - http_build_query(['sort' => $sort, 'direction' => $direction]) |
|
52 | - )); |
|
53 | - } |
|
31 | + /** |
|
32 | + * List repositories being starred |
|
33 | + * |
|
34 | + * @link https://developer.github.com/v3/activity/starring/#list-repositories-being-starred |
|
35 | + * |
|
36 | + * @param string $sort |
|
37 | + * @param string $direction |
|
38 | + * @param string $username |
|
39 | + * |
|
40 | + * @return array |
|
41 | + */ |
|
42 | + public function listRepositories( |
|
43 | + string $sort = AbstractApi::SORT_CREATED, |
|
44 | + string $direction = AbstractApi::DIRECTION_DESC, |
|
45 | + string $username = null |
|
46 | + ): array { |
|
47 | + if (null !== $username) { |
|
48 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
49 | + '/users/:username/starred?:args', |
|
50 | + $username, |
|
51 | + http_build_query(['sort' => $sort, 'direction' => $direction]) |
|
52 | + )); |
|
53 | + } |
|
54 | 54 | |
55 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
56 | - '/user/starred?:args', |
|
57 | - http_build_query(['sort' => $sort, 'direction' => $direction]) |
|
58 | - )); |
|
59 | - } |
|
55 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
56 | + '/user/starred?:args', |
|
57 | + http_build_query(['sort' => $sort, 'direction' => $direction]) |
|
58 | + )); |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Check if you are starring a repository |
|
63 | - * |
|
64 | - * @link https://developer.github.com/v3/activity/starring/#check-if-you-are-starring-a-repository |
|
65 | - * @return bool |
|
66 | - */ |
|
67 | - public function checkYouAreStarringRepository(): bool |
|
68 | - { |
|
69 | - $this->getApi()->request($this->getApi() |
|
70 | - ->sprintf( |
|
71 | - '/user/starred/:owner/:repo', |
|
72 | - $this->getActivity()->getOwner(), |
|
73 | - $this->getActivity()->getRepo() |
|
74 | - )); |
|
61 | + /** |
|
62 | + * Check if you are starring a repository |
|
63 | + * |
|
64 | + * @link https://developer.github.com/v3/activity/starring/#check-if-you-are-starring-a-repository |
|
65 | + * @return bool |
|
66 | + */ |
|
67 | + public function checkYouAreStarringRepository(): bool |
|
68 | + { |
|
69 | + $this->getApi()->request($this->getApi() |
|
70 | + ->sprintf( |
|
71 | + '/user/starred/:owner/:repo', |
|
72 | + $this->getActivity()->getOwner(), |
|
73 | + $this->getActivity()->getRepo() |
|
74 | + )); |
|
75 | 75 | |
76 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
77 | - return true; |
|
78 | - } |
|
76 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
77 | + return true; |
|
78 | + } |
|
79 | 79 | |
80 | - return false; |
|
81 | - } |
|
80 | + return false; |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * Star a repository |
|
85 | - * |
|
86 | - * @link https://developer.github.com/v3/activity/starring/#star-a-repository |
|
87 | - * @return bool |
|
88 | - */ |
|
89 | - public function starRepository(): bool |
|
90 | - { |
|
91 | - $this->getApi()->request($this->getApi() |
|
92 | - ->sprintf( |
|
93 | - '/user/starred/:owner/:repo', |
|
94 | - $this->getActivity()->getOwner(), |
|
95 | - $this->getActivity()->getRepo() |
|
96 | - ), Request::METHOD_PUT); |
|
83 | + /** |
|
84 | + * Star a repository |
|
85 | + * |
|
86 | + * @link https://developer.github.com/v3/activity/starring/#star-a-repository |
|
87 | + * @return bool |
|
88 | + */ |
|
89 | + public function starRepository(): bool |
|
90 | + { |
|
91 | + $this->getApi()->request($this->getApi() |
|
92 | + ->sprintf( |
|
93 | + '/user/starred/:owner/:repo', |
|
94 | + $this->getActivity()->getOwner(), |
|
95 | + $this->getActivity()->getRepo() |
|
96 | + ), Request::METHOD_PUT); |
|
97 | 97 | |
98 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
99 | - return true; |
|
100 | - } |
|
98 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
99 | + return true; |
|
100 | + } |
|
101 | 101 | |
102 | - return false; |
|
103 | - } |
|
102 | + return false; |
|
103 | + } |
|
104 | 104 | |
105 | - /** |
|
106 | - * Unstar a repository |
|
107 | - * |
|
108 | - * @link https://developer.github.com/v3/activity/starring/#unstar-a-repository |
|
109 | - * @return bool |
|
110 | - */ |
|
111 | - public function unStarRepository(): bool |
|
112 | - { |
|
113 | - $this->getApi()->request($this->getApi() |
|
114 | - ->sprintf( |
|
115 | - '/user/starred/:owner/:repo', |
|
116 | - $this->getActivity()->getOwner(), |
|
117 | - $this->getActivity()->getRepo() |
|
118 | - ), Request::METHOD_DELETE); |
|
105 | + /** |
|
106 | + * Unstar a repository |
|
107 | + * |
|
108 | + * @link https://developer.github.com/v3/activity/starring/#unstar-a-repository |
|
109 | + * @return bool |
|
110 | + */ |
|
111 | + public function unStarRepository(): bool |
|
112 | + { |
|
113 | + $this->getApi()->request($this->getApi() |
|
114 | + ->sprintf( |
|
115 | + '/user/starred/:owner/:repo', |
|
116 | + $this->getActivity()->getOwner(), |
|
117 | + $this->getActivity()->getRepo() |
|
118 | + ), Request::METHOD_DELETE); |
|
119 | 119 | |
120 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
121 | - return true; |
|
122 | - } |
|
120 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
121 | + return true; |
|
122 | + } |
|
123 | 123 | |
124 | - return false; |
|
125 | - } |
|
124 | + return false; |
|
125 | + } |
|
126 | 126 | } |
@@ -12,44 +12,44 @@ |
||
12 | 12 | */ |
13 | 13 | abstract class AbstractPullRequests |
14 | 14 | { |
15 | - /** Api trait */ |
|
16 | - use Api; |
|
15 | + /** Api trait */ |
|
16 | + use Api; |
|
17 | 17 | |
18 | - /** Properties */ |
|
19 | - protected $pullRequests; |
|
18 | + /** Properties */ |
|
19 | + protected $pullRequests; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Constructor |
|
23 | - * |
|
24 | - * @param PullRequests $pullRequests |
|
25 | - */ |
|
26 | - public function __construct(PullRequests $pullRequests) |
|
27 | - { |
|
28 | - $this->setPullRequests($pullRequests); |
|
29 | - $this->setApi($pullRequests->getApi()); |
|
30 | - } |
|
21 | + /** |
|
22 | + * Constructor |
|
23 | + * |
|
24 | + * @param PullRequests $pullRequests |
|
25 | + */ |
|
26 | + public function __construct(PullRequests $pullRequests) |
|
27 | + { |
|
28 | + $this->setPullRequests($pullRequests); |
|
29 | + $this->setApi($pullRequests->getApi()); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * Get pullRequests |
|
34 | - * |
|
35 | - * @return PullRequests |
|
36 | - */ |
|
37 | - public function getPullRequests(): PullRequests |
|
38 | - { |
|
39 | - return $this->pullRequests; |
|
40 | - } |
|
32 | + /** |
|
33 | + * Get pullRequests |
|
34 | + * |
|
35 | + * @return PullRequests |
|
36 | + */ |
|
37 | + public function getPullRequests(): PullRequests |
|
38 | + { |
|
39 | + return $this->pullRequests; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Set pullRequests |
|
44 | - * |
|
45 | - * @param PullRequests $pullRequests |
|
46 | - * |
|
47 | - * @return AbstractPullRequests |
|
48 | - */ |
|
49 | - public function setPullRequests(PullRequests $pullRequests): AbstractPullRequests |
|
50 | - { |
|
51 | - $this->pullRequests = $pullRequests; |
|
42 | + /** |
|
43 | + * Set pullRequests |
|
44 | + * |
|
45 | + * @param PullRequests $pullRequests |
|
46 | + * |
|
47 | + * @return AbstractPullRequests |
|
48 | + */ |
|
49 | + public function setPullRequests(PullRequests $pullRequests): AbstractPullRequests |
|
50 | + { |
|
51 | + $this->pullRequests = $pullRequests; |
|
52 | 52 | |
53 | - return $this; |
|
54 | - } |
|
53 | + return $this; |
|
54 | + } |
|
55 | 55 | } |
@@ -14,154 +14,154 @@ |
||
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( |
|
30 | - '/repos/:owner/:repo/pulls/:number/comments', |
|
31 | - $this->getPullRequests()->getOwner(), |
|
32 | - $this->getPullRequests()->getRepo(), |
|
33 | - $number |
|
34 | - )); |
|
35 | - } |
|
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( |
|
30 | + '/repos/:owner/:repo/pulls/:number/comments', |
|
31 | + $this->getPullRequests()->getOwner(), |
|
32 | + $this->getPullRequests()->getRepo(), |
|
33 | + $number |
|
34 | + )); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * List comments in a repository |
|
39 | - * |
|
40 | - * @link https://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository |
|
41 | - * |
|
42 | - * @param string $sort |
|
43 | - * @param string $direction |
|
44 | - * @param string $since |
|
45 | - * |
|
46 | - * @return array |
|
47 | - * @throws \Exception |
|
48 | - */ |
|
49 | - public function listCommentsRepository( |
|
50 | - string $sort = AbstractApi::SORT_CREATED, |
|
51 | - string $direction = AbstractApi::DIRECTION_DESC, |
|
52 | - string $since = 'now' |
|
53 | - ): array { |
|
54 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
55 | - '/repos/:owner/:repo/pulls/comments?:args', |
|
56 | - $this->getPullRequests()->getOwner(), |
|
57 | - $this->getPullRequests()->getRepo(), |
|
58 | - http_build_query([ |
|
59 | - 'sort' => $sort, |
|
60 | - 'direction' => $direction, |
|
61 | - 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
62 | - ]) |
|
63 | - )); |
|
64 | - } |
|
37 | + /** |
|
38 | + * List comments in a repository |
|
39 | + * |
|
40 | + * @link https://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository |
|
41 | + * |
|
42 | + * @param string $sort |
|
43 | + * @param string $direction |
|
44 | + * @param string $since |
|
45 | + * |
|
46 | + * @return array |
|
47 | + * @throws \Exception |
|
48 | + */ |
|
49 | + public function listCommentsRepository( |
|
50 | + string $sort = AbstractApi::SORT_CREATED, |
|
51 | + string $direction = AbstractApi::DIRECTION_DESC, |
|
52 | + string $since = 'now' |
|
53 | + ): array { |
|
54 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
55 | + '/repos/:owner/:repo/pulls/comments?:args', |
|
56 | + $this->getPullRequests()->getOwner(), |
|
57 | + $this->getPullRequests()->getRepo(), |
|
58 | + http_build_query([ |
|
59 | + 'sort' => $sort, |
|
60 | + 'direction' => $direction, |
|
61 | + 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
62 | + ]) |
|
63 | + )); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * Get a single comment |
|
68 | - * |
|
69 | - * @link https://developer.github.com/v3/pulls/comments/#get-a-single-comment |
|
70 | - * |
|
71 | - * @param int $number |
|
72 | - * |
|
73 | - * @return array |
|
74 | - * @throws \Exception |
|
75 | - */ |
|
76 | - public function getSingleComment(int $number): array |
|
77 | - { |
|
78 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
79 | - '/repos/:owner/:repo/pulls/comments/:number', |
|
80 | - $this->getPullRequests()->getOwner(), |
|
81 | - $this->getPullRequests()->getRepo(), |
|
82 | - $number |
|
83 | - )); |
|
84 | - } |
|
66 | + /** |
|
67 | + * Get a single comment |
|
68 | + * |
|
69 | + * @link https://developer.github.com/v3/pulls/comments/#get-a-single-comment |
|
70 | + * |
|
71 | + * @param int $number |
|
72 | + * |
|
73 | + * @return array |
|
74 | + * @throws \Exception |
|
75 | + */ |
|
76 | + public function getSingleComment(int $number): array |
|
77 | + { |
|
78 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
79 | + '/repos/:owner/:repo/pulls/comments/:number', |
|
80 | + $this->getPullRequests()->getOwner(), |
|
81 | + $this->getPullRequests()->getRepo(), |
|
82 | + $number |
|
83 | + )); |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * Create a comment |
|
88 | - * |
|
89 | - * @link https://developer.github.com/v3/pulls/comments/#create-a-comment |
|
90 | - * |
|
91 | - * @param int $number |
|
92 | - * @param string $body |
|
93 | - * @param string $commitId |
|
94 | - * @param string $path |
|
95 | - * @param int $position |
|
96 | - * |
|
97 | - * @return array |
|
98 | - * @throws \Exception |
|
99 | - */ |
|
100 | - public function createComment(int $number, string $body, string $commitId, string $path, int $position): array |
|
101 | - { |
|
102 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
103 | - '/repos/:owner/:repo/pulls/:number/comments', |
|
104 | - $this->getPullRequests()->getOwner(), |
|
105 | - $this->getPullRequests()->getRepo(), |
|
106 | - $number |
|
107 | - ), Request::METHOD_POST, [ |
|
108 | - 'body' => $body, |
|
109 | - 'commit_id' => $commitId, |
|
110 | - 'path' => $path, |
|
111 | - 'position' => $position |
|
112 | - ]); |
|
113 | - } |
|
86 | + /** |
|
87 | + * Create a comment |
|
88 | + * |
|
89 | + * @link https://developer.github.com/v3/pulls/comments/#create-a-comment |
|
90 | + * |
|
91 | + * @param int $number |
|
92 | + * @param string $body |
|
93 | + * @param string $commitId |
|
94 | + * @param string $path |
|
95 | + * @param int $position |
|
96 | + * |
|
97 | + * @return array |
|
98 | + * @throws \Exception |
|
99 | + */ |
|
100 | + public function createComment(int $number, string $body, string $commitId, string $path, int $position): array |
|
101 | + { |
|
102 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
103 | + '/repos/:owner/:repo/pulls/:number/comments', |
|
104 | + $this->getPullRequests()->getOwner(), |
|
105 | + $this->getPullRequests()->getRepo(), |
|
106 | + $number |
|
107 | + ), Request::METHOD_POST, [ |
|
108 | + 'body' => $body, |
|
109 | + 'commit_id' => $commitId, |
|
110 | + 'path' => $path, |
|
111 | + 'position' => $position |
|
112 | + ]); |
|
113 | + } |
|
114 | 114 | |
115 | - /** |
|
116 | - * Edit a comment |
|
117 | - * |
|
118 | - * @link https://developer.github.com/v3/pulls/comments/#edit-a-comment |
|
119 | - * |
|
120 | - * @param int $number |
|
121 | - * @param string $body |
|
122 | - * |
|
123 | - * @return array |
|
124 | - * @throws \Exception |
|
125 | - */ |
|
126 | - public function editComment(int $number, string $body): array |
|
127 | - { |
|
128 | - return $this->getApi()->request( |
|
129 | - $this->getApi()->sprintf( |
|
130 | - '/repos/:owner/:repo/pulls/comments/:number', |
|
131 | - $this->getPullRequests()->getOwner(), |
|
132 | - $this->getPullRequests()->getRepo(), |
|
133 | - $number |
|
134 | - ), |
|
135 | - Request::METHOD_PATCH, |
|
136 | - [ |
|
137 | - 'body' => $body |
|
138 | - ] |
|
139 | - ); |
|
140 | - } |
|
115 | + /** |
|
116 | + * Edit a comment |
|
117 | + * |
|
118 | + * @link https://developer.github.com/v3/pulls/comments/#edit-a-comment |
|
119 | + * |
|
120 | + * @param int $number |
|
121 | + * @param string $body |
|
122 | + * |
|
123 | + * @return array |
|
124 | + * @throws \Exception |
|
125 | + */ |
|
126 | + public function editComment(int $number, string $body): array |
|
127 | + { |
|
128 | + return $this->getApi()->request( |
|
129 | + $this->getApi()->sprintf( |
|
130 | + '/repos/:owner/:repo/pulls/comments/:number', |
|
131 | + $this->getPullRequests()->getOwner(), |
|
132 | + $this->getPullRequests()->getRepo(), |
|
133 | + $number |
|
134 | + ), |
|
135 | + Request::METHOD_PATCH, |
|
136 | + [ |
|
137 | + 'body' => $body |
|
138 | + ] |
|
139 | + ); |
|
140 | + } |
|
141 | 141 | |
142 | - /** |
|
143 | - * Delete a comment |
|
144 | - * |
|
145 | - * @link https://developer.github.com/v3/pulls/comments/#delete-a-comment |
|
146 | - * |
|
147 | - * @param int $number |
|
148 | - * |
|
149 | - * @return bool |
|
150 | - * @throws \Exception |
|
151 | - */ |
|
152 | - public function deleteComment(int $number): bool |
|
153 | - { |
|
154 | - $this->getApi()->request($this->getApi()->sprintf( |
|
155 | - '/repos/:owner/:repo/pulls/comments/:number', |
|
156 | - $this->getPullRequests()->getOwner(), |
|
157 | - $this->getPullRequests()->getRepo(), |
|
158 | - $number |
|
159 | - )); |
|
142 | + /** |
|
143 | + * Delete a comment |
|
144 | + * |
|
145 | + * @link https://developer.github.com/v3/pulls/comments/#delete-a-comment |
|
146 | + * |
|
147 | + * @param int $number |
|
148 | + * |
|
149 | + * @return bool |
|
150 | + * @throws \Exception |
|
151 | + */ |
|
152 | + public function deleteComment(int $number): bool |
|
153 | + { |
|
154 | + $this->getApi()->request($this->getApi()->sprintf( |
|
155 | + '/repos/:owner/:repo/pulls/comments/:number', |
|
156 | + $this->getPullRequests()->getOwner(), |
|
157 | + $this->getPullRequests()->getRepo(), |
|
158 | + $number |
|
159 | + )); |
|
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 | } |
@@ -11,10 +11,10 @@ |
||
11 | 11 | class GitData extends AbstractReceiver |
12 | 12 | { |
13 | 13 | |
14 | - /** Available sub-Receiver */ |
|
15 | - const BLOBS = 'Blobs'; |
|
16 | - const COMMITS = 'Commits'; |
|
17 | - const REFERENCES = 'References'; |
|
18 | - const TAGS = 'Tags'; |
|
19 | - const TREES = 'Trees'; |
|
14 | + /** Available sub-Receiver */ |
|
15 | + const BLOBS = 'Blobs'; |
|
16 | + const COMMITS = 'Commits'; |
|
17 | + const REFERENCES = 'References'; |
|
18 | + const TAGS = 'Tags'; |
|
19 | + const TREES = 'Trees'; |
|
20 | 20 | } |
@@ -11,10 +11,10 @@ |
||
11 | 11 | class Activity extends AbstractReceiver |
12 | 12 | { |
13 | 13 | |
14 | - /** Available sub-Receiver */ |
|
15 | - const EVENTS = 'Events'; |
|
16 | - const FEEDS = 'Feeds'; |
|
17 | - const NOTIFICATIONS = 'Notifications'; |
|
18 | - const STARRING = 'Starring'; |
|
19 | - const WATCHING = 'Watching'; |
|
14 | + /** Available sub-Receiver */ |
|
15 | + const EVENTS = 'Events'; |
|
16 | + const FEEDS = 'Feeds'; |
|
17 | + const NOTIFICATIONS = 'Notifications'; |
|
18 | + const STARRING = 'Starring'; |
|
19 | + const WATCHING = 'Watching'; |
|
20 | 20 | } |
@@ -13,265 +13,265 @@ |
||
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( |
|
37 | - ':url?:arg', |
|
38 | - $url, |
|
39 | - $username, |
|
40 | - http_build_query(['since' => (new DateTime($since))->format(DateTime::ATOM)]) |
|
41 | - )); |
|
42 | - } |
|
36 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
37 | + ':url?:arg', |
|
38 | + $url, |
|
39 | + $username, |
|
40 | + http_build_query(['since' => (new DateTime($since))->format(DateTime::ATOM)]) |
|
41 | + )); |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * List all public gists: |
|
46 | - * |
|
47 | - * @link https://developer.github.com/v3/gists/#list-all-public-gists |
|
48 | - * |
|
49 | - * @param string $since |
|
50 | - * |
|
51 | - * @return array |
|
52 | - */ |
|
53 | - public function listPublicGists(string $since = '1970-01-01'): array |
|
54 | - { |
|
55 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
56 | - '/gists/public?:arg', |
|
57 | - http_build_query(['since' => (new DateTime($since))->format(DateTime::ATOM)]) |
|
58 | - )); |
|
59 | - } |
|
44 | + /** |
|
45 | + * List all public gists: |
|
46 | + * |
|
47 | + * @link https://developer.github.com/v3/gists/#list-all-public-gists |
|
48 | + * |
|
49 | + * @param string $since |
|
50 | + * |
|
51 | + * @return array |
|
52 | + */ |
|
53 | + public function listPublicGists(string $since = '1970-01-01'): array |
|
54 | + { |
|
55 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
56 | + '/gists/public?:arg', |
|
57 | + http_build_query(['since' => (new DateTime($since))->format(DateTime::ATOM)]) |
|
58 | + )); |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * List the authenticated user’s starred gists |
|
63 | - * |
|
64 | - * @link https://developer.github.com/v3/gists/#list-starred-gists |
|
65 | - * |
|
66 | - * @param string $since |
|
67 | - * |
|
68 | - * @return array |
|
69 | - */ |
|
70 | - public function listUsersStarredGists(string $since = '1970-01-01'): array |
|
71 | - { |
|
72 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
73 | - '/gists/starred?:arg', |
|
74 | - http_build_query(['since' => (new DateTime($since))->format(DateTime::ATOM)]) |
|
75 | - )); |
|
76 | - } |
|
61 | + /** |
|
62 | + * List the authenticated user’s starred gists |
|
63 | + * |
|
64 | + * @link https://developer.github.com/v3/gists/#list-starred-gists |
|
65 | + * |
|
66 | + * @param string $since |
|
67 | + * |
|
68 | + * @return array |
|
69 | + */ |
|
70 | + public function listUsersStarredGists(string $since = '1970-01-01'): array |
|
71 | + { |
|
72 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
73 | + '/gists/starred?:arg', |
|
74 | + http_build_query(['since' => (new DateTime($since))->format(DateTime::ATOM)]) |
|
75 | + )); |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * Get a single gist |
|
80 | - * |
|
81 | - * @link https://developer.github.com/v3/gists/#get-a-single-gist |
|
82 | - * |
|
83 | - * @param string $id |
|
84 | - * |
|
85 | - * @return array |
|
86 | - */ |
|
87 | - public function getGist(string $id): array |
|
88 | - { |
|
89 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:id', $id)); |
|
90 | - } |
|
78 | + /** |
|
79 | + * Get a single gist |
|
80 | + * |
|
81 | + * @link https://developer.github.com/v3/gists/#get-a-single-gist |
|
82 | + * |
|
83 | + * @param string $id |
|
84 | + * |
|
85 | + * @return array |
|
86 | + */ |
|
87 | + public function getGist(string $id): array |
|
88 | + { |
|
89 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:id', $id)); |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * Get a specific revision of a gist |
|
94 | - * |
|
95 | - * @link https://developer.github.com/v3/gists/#get-a-specific-revision-of-a-gist |
|
96 | - * |
|
97 | - * @param string $id |
|
98 | - * @param string $sha |
|
99 | - * |
|
100 | - * @return array |
|
101 | - * @throws \Exception |
|
102 | - */ |
|
103 | - public function getGistRevision(string $id, string $sha): array |
|
104 | - { |
|
105 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/:sha', $id, $sha)); |
|
106 | - } |
|
92 | + /** |
|
93 | + * Get a specific revision of a gist |
|
94 | + * |
|
95 | + * @link https://developer.github.com/v3/gists/#get-a-specific-revision-of-a-gist |
|
96 | + * |
|
97 | + * @param string $id |
|
98 | + * @param string $sha |
|
99 | + * |
|
100 | + * @return array |
|
101 | + * @throws \Exception |
|
102 | + */ |
|
103 | + public function getGistRevision(string $id, string $sha): array |
|
104 | + { |
|
105 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/:sha', $id, $sha)); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * Create a gist |
|
110 | - * |
|
111 | - * @link https://developer.github.com/v3/gists/#create-a-gist |
|
112 | - * |
|
113 | - * @param array $files |
|
114 | - * @param string $description |
|
115 | - * @param bool $public |
|
116 | - * |
|
117 | - * @return array |
|
118 | - */ |
|
119 | - public function createGist(array $files, string $description = null, bool $public = false): array |
|
120 | - { |
|
121 | - return $this->getApi()->request($this->getApi()->sprintf('/gists'), Request::METHOD_POST, [ |
|
122 | - 'files' => $files, |
|
123 | - 'description' => $description, |
|
124 | - 'public' => $public |
|
125 | - ]); |
|
126 | - } |
|
108 | + /** |
|
109 | + * Create a gist |
|
110 | + * |
|
111 | + * @link https://developer.github.com/v3/gists/#create-a-gist |
|
112 | + * |
|
113 | + * @param array $files |
|
114 | + * @param string $description |
|
115 | + * @param bool $public |
|
116 | + * |
|
117 | + * @return array |
|
118 | + */ |
|
119 | + public function createGist(array $files, string $description = null, bool $public = false): array |
|
120 | + { |
|
121 | + return $this->getApi()->request($this->getApi()->sprintf('/gists'), Request::METHOD_POST, [ |
|
122 | + 'files' => $files, |
|
123 | + 'description' => $description, |
|
124 | + 'public' => $public |
|
125 | + ]); |
|
126 | + } |
|
127 | 127 | |
128 | - /** |
|
129 | - * Edit a gist |
|
130 | - * |
|
131 | - * @link https://developer.github.com/v3/gists/#edit-a-gist |
|
132 | - * |
|
133 | - * @param string $id |
|
134 | - * @param string $description |
|
135 | - * @param array $files |
|
136 | - * @param string $content |
|
137 | - * @param string $filename |
|
138 | - * |
|
139 | - * @return array |
|
140 | - */ |
|
141 | - public function editGist( |
|
142 | - string $id, |
|
143 | - string $description = '', |
|
144 | - array $files = [], |
|
145 | - string $content = '', |
|
146 | - string $filename = '' |
|
147 | - ): array { |
|
148 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:id', $id), Request::METHOD_PATCH, [ |
|
149 | - 'description' => $description, |
|
150 | - 'files' => $files, |
|
151 | - 'content' => $content, |
|
152 | - 'filename' => $filename |
|
153 | - ]); |
|
154 | - } |
|
128 | + /** |
|
129 | + * Edit a gist |
|
130 | + * |
|
131 | + * @link https://developer.github.com/v3/gists/#edit-a-gist |
|
132 | + * |
|
133 | + * @param string $id |
|
134 | + * @param string $description |
|
135 | + * @param array $files |
|
136 | + * @param string $content |
|
137 | + * @param string $filename |
|
138 | + * |
|
139 | + * @return array |
|
140 | + */ |
|
141 | + public function editGist( |
|
142 | + string $id, |
|
143 | + string $description = '', |
|
144 | + array $files = [], |
|
145 | + string $content = '', |
|
146 | + string $filename = '' |
|
147 | + ): array { |
|
148 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:id', $id), Request::METHOD_PATCH, [ |
|
149 | + 'description' => $description, |
|
150 | + 'files' => $files, |
|
151 | + 'content' => $content, |
|
152 | + 'filename' => $filename |
|
153 | + ]); |
|
154 | + } |
|
155 | 155 | |
156 | - /** |
|
157 | - * List gist commits |
|
158 | - * |
|
159 | - * @link https://developer.github.com/v3/gists/#list-gist-commits |
|
160 | - * |
|
161 | - * @param string $id |
|
162 | - * |
|
163 | - * @return array |
|
164 | - */ |
|
165 | - public function listGistsCommits(string $id): array |
|
166 | - { |
|
167 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/commits', $id)); |
|
168 | - } |
|
156 | + /** |
|
157 | + * List gist commits |
|
158 | + * |
|
159 | + * @link https://developer.github.com/v3/gists/#list-gist-commits |
|
160 | + * |
|
161 | + * @param string $id |
|
162 | + * |
|
163 | + * @return array |
|
164 | + */ |
|
165 | + public function listGistsCommits(string $id): array |
|
166 | + { |
|
167 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/commits', $id)); |
|
168 | + } |
|
169 | 169 | |
170 | - /** |
|
171 | - * Star a gist |
|
172 | - * |
|
173 | - * @link https://developer.github.com/v3/gists/#star-a-gist |
|
174 | - * |
|
175 | - * @param string $id |
|
176 | - * |
|
177 | - * @return bool |
|
178 | - */ |
|
179 | - public function starGist(string $id): bool |
|
180 | - { |
|
181 | - $this->getApi()->request($this->getApi()->sprintf('/gists/:id/star', $id), Request::METHOD_PUT); |
|
170 | + /** |
|
171 | + * Star a gist |
|
172 | + * |
|
173 | + * @link https://developer.github.com/v3/gists/#star-a-gist |
|
174 | + * |
|
175 | + * @param string $id |
|
176 | + * |
|
177 | + * @return bool |
|
178 | + */ |
|
179 | + public function starGist(string $id): bool |
|
180 | + { |
|
181 | + $this->getApi()->request($this->getApi()->sprintf('/gists/:id/star', $id), Request::METHOD_PUT); |
|
182 | 182 | |
183 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
184 | - return true; |
|
185 | - } |
|
183 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
184 | + return true; |
|
185 | + } |
|
186 | 186 | |
187 | - return false; |
|
188 | - } |
|
187 | + return false; |
|
188 | + } |
|
189 | 189 | |
190 | - /** |
|
191 | - * Unstar a gist |
|
192 | - * |
|
193 | - * @link https://developer.github.com/v3/gists/#unstar-a-gist |
|
194 | - * |
|
195 | - * @param string $id |
|
196 | - * |
|
197 | - * @return bool |
|
198 | - */ |
|
199 | - public function unStarGist(string $id): bool |
|
200 | - { |
|
201 | - $this->getApi()->request($this->getApi()->sprintf('/gists/:id/star', $id), Request::METHOD_DELETE); |
|
190 | + /** |
|
191 | + * Unstar a gist |
|
192 | + * |
|
193 | + * @link https://developer.github.com/v3/gists/#unstar-a-gist |
|
194 | + * |
|
195 | + * @param string $id |
|
196 | + * |
|
197 | + * @return bool |
|
198 | + */ |
|
199 | + public function unStarGist(string $id): bool |
|
200 | + { |
|
201 | + $this->getApi()->request($this->getApi()->sprintf('/gists/:id/star', $id), Request::METHOD_DELETE); |
|
202 | 202 | |
203 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
204 | - return true; |
|
205 | - } |
|
203 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
204 | + return true; |
|
205 | + } |
|
206 | 206 | |
207 | - return false; |
|
208 | - } |
|
207 | + return false; |
|
208 | + } |
|
209 | 209 | |
210 | - /** |
|
211 | - * Check if a gist is starred |
|
212 | - * |
|
213 | - * @link https://developer.github.com/v3/gists/#check-if-a-gist-is-starred |
|
214 | - * |
|
215 | - * @param string $id |
|
216 | - * |
|
217 | - * @return bool |
|
218 | - */ |
|
219 | - public function checkGistIsStarred(string $id): bool |
|
220 | - { |
|
221 | - $this->getApi()->request($this->getApi()->sprintf('/gists/:id/star', $id)); |
|
210 | + /** |
|
211 | + * Check if a gist is starred |
|
212 | + * |
|
213 | + * @link https://developer.github.com/v3/gists/#check-if-a-gist-is-starred |
|
214 | + * |
|
215 | + * @param string $id |
|
216 | + * |
|
217 | + * @return bool |
|
218 | + */ |
|
219 | + public function checkGistIsStarred(string $id): bool |
|
220 | + { |
|
221 | + $this->getApi()->request($this->getApi()->sprintf('/gists/:id/star', $id)); |
|
222 | 222 | |
223 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
224 | - return true; |
|
225 | - } |
|
223 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
224 | + return true; |
|
225 | + } |
|
226 | 226 | |
227 | - return false; |
|
228 | - } |
|
227 | + return false; |
|
228 | + } |
|
229 | 229 | |
230 | - /** |
|
231 | - * Fork a gist |
|
232 | - * |
|
233 | - * @link https://developer.github.com/v3/gists/#fork-a-gist |
|
234 | - * |
|
235 | - * @param string $id |
|
236 | - * |
|
237 | - * @return array |
|
238 | - */ |
|
239 | - public function forkGist(string $id): array |
|
240 | - { |
|
241 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/forks', $id), Request::METHOD_POST); |
|
242 | - } |
|
230 | + /** |
|
231 | + * Fork a gist |
|
232 | + * |
|
233 | + * @link https://developer.github.com/v3/gists/#fork-a-gist |
|
234 | + * |
|
235 | + * @param string $id |
|
236 | + * |
|
237 | + * @return array |
|
238 | + */ |
|
239 | + public function forkGist(string $id): array |
|
240 | + { |
|
241 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/forks', $id), Request::METHOD_POST); |
|
242 | + } |
|
243 | 243 | |
244 | - /** |
|
245 | - * List gist forks |
|
246 | - * |
|
247 | - * @link https://developer.github.com/v3/gists/#list-gist-forks |
|
248 | - * |
|
249 | - * @param string $id |
|
250 | - * |
|
251 | - * @return array |
|
252 | - */ |
|
253 | - public function listGistForks(string $id): array |
|
254 | - { |
|
255 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/forks', $id)); |
|
256 | - } |
|
244 | + /** |
|
245 | + * List gist forks |
|
246 | + * |
|
247 | + * @link https://developer.github.com/v3/gists/#list-gist-forks |
|
248 | + * |
|
249 | + * @param string $id |
|
250 | + * |
|
251 | + * @return array |
|
252 | + */ |
|
253 | + public function listGistForks(string $id): array |
|
254 | + { |
|
255 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/forks', $id)); |
|
256 | + } |
|
257 | 257 | |
258 | - /** |
|
259 | - * Delete a gist |
|
260 | - * |
|
261 | - * @link https://developer.github.com/v3/gists/#delete-a-gist |
|
262 | - * |
|
263 | - * @param string $id |
|
264 | - * |
|
265 | - * @return bool |
|
266 | - */ |
|
267 | - public function deleteGist(string $id): bool |
|
268 | - { |
|
269 | - $this->getApi()->request($this->getApi()->sprintf('/gists/:id', $id), Request::METHOD_DELETE); |
|
258 | + /** |
|
259 | + * Delete a gist |
|
260 | + * |
|
261 | + * @link https://developer.github.com/v3/gists/#delete-a-gist |
|
262 | + * |
|
263 | + * @param string $id |
|
264 | + * |
|
265 | + * @return bool |
|
266 | + */ |
|
267 | + public function deleteGist(string $id): bool |
|
268 | + { |
|
269 | + $this->getApi()->request($this->getApi()->sprintf('/gists/:id', $id), Request::METHOD_DELETE); |
|
270 | 270 | |
271 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
272 | - return true; |
|
273 | - } |
|
271 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
272 | + return true; |
|
273 | + } |
|
274 | 274 | |
275 | - return false; |
|
276 | - } |
|
275 | + return false; |
|
276 | + } |
|
277 | 277 | } |
@@ -12,67 +12,67 @@ |
||
12 | 12 | class Trees extends AbstractGitData |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Get a Tree |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/git/trees/#get-a-tree |
|
19 | - * |
|
20 | - * @param string $sha |
|
21 | - * |
|
22 | - * @return array |
|
23 | - * @throws \Exception |
|
24 | - */ |
|
25 | - public function get(string $sha): array |
|
26 | - { |
|
27 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
28 | - '/repos/:owner/:repo/git/trees/:sha', |
|
29 | - $this->getGitData()->getOwner(), |
|
30 | - $this->getGitData()->getRepo(), |
|
31 | - $sha |
|
32 | - )); |
|
33 | - } |
|
15 | + /** |
|
16 | + * Get a Tree |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/git/trees/#get-a-tree |
|
19 | + * |
|
20 | + * @param string $sha |
|
21 | + * |
|
22 | + * @return array |
|
23 | + * @throws \Exception |
|
24 | + */ |
|
25 | + public function get(string $sha): array |
|
26 | + { |
|
27 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
28 | + '/repos/:owner/:repo/git/trees/:sha', |
|
29 | + $this->getGitData()->getOwner(), |
|
30 | + $this->getGitData()->getRepo(), |
|
31 | + $sha |
|
32 | + )); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * Get a Tree Recursively |
|
37 | - * |
|
38 | - * @link https://developer.github.com/v3/git/trees/#get-a-tree-recursively |
|
39 | - * |
|
40 | - * @param string $sha |
|
41 | - * |
|
42 | - * @return array |
|
43 | - * @throws \Exception |
|
44 | - */ |
|
45 | - public function getRecursively(string $sha): array |
|
46 | - { |
|
47 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
48 | - '/repos/:owner/:repo/git/trees/:sha?recursive=1', |
|
49 | - $this->getGitData()->getOwner(), |
|
50 | - $this->getGitData()->getRepo(), |
|
51 | - $sha |
|
52 | - )); |
|
53 | - } |
|
35 | + /** |
|
36 | + * Get a Tree Recursively |
|
37 | + * |
|
38 | + * @link https://developer.github.com/v3/git/trees/#get-a-tree-recursively |
|
39 | + * |
|
40 | + * @param string $sha |
|
41 | + * |
|
42 | + * @return array |
|
43 | + * @throws \Exception |
|
44 | + */ |
|
45 | + public function getRecursively(string $sha): array |
|
46 | + { |
|
47 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
48 | + '/repos/:owner/:repo/git/trees/:sha?recursive=1', |
|
49 | + $this->getGitData()->getOwner(), |
|
50 | + $this->getGitData()->getRepo(), |
|
51 | + $sha |
|
52 | + )); |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * Create a Tree |
|
57 | - * |
|
58 | - * @link https://developer.github.com/v3/git/trees/#create-a-tree |
|
59 | - * |
|
60 | - * @param array $tree |
|
61 | - * @param string $base_tree |
|
62 | - * |
|
63 | - * @return array |
|
64 | - * @throws \Exception |
|
65 | - */ |
|
66 | - public function create(array $tree, string $base_tree): array |
|
67 | - { |
|
68 | - return $this->getApi()->request($this->getApi() |
|
69 | - ->sprintf( |
|
70 | - '/repos/:owner/:repo/git/trees', |
|
71 | - $this->getGitData()->getOwner(), |
|
72 | - $this->getGitData()->getRepo() |
|
73 | - ), Request::METHOD_POST, [ |
|
74 | - 'tree' => $tree, |
|
75 | - 'base_tree' => $base_tree |
|
76 | - ]); |
|
77 | - } |
|
55 | + /** |
|
56 | + * Create a Tree |
|
57 | + * |
|
58 | + * @link https://developer.github.com/v3/git/trees/#create-a-tree |
|
59 | + * |
|
60 | + * @param array $tree |
|
61 | + * @param string $base_tree |
|
62 | + * |
|
63 | + * @return array |
|
64 | + * @throws \Exception |
|
65 | + */ |
|
66 | + public function create(array $tree, string $base_tree): array |
|
67 | + { |
|
68 | + return $this->getApi()->request($this->getApi() |
|
69 | + ->sprintf( |
|
70 | + '/repos/:owner/:repo/git/trees', |
|
71 | + $this->getGitData()->getOwner(), |
|
72 | + $this->getGitData()->getRepo() |
|
73 | + ), Request::METHOD_POST, [ |
|
74 | + 'tree' => $tree, |
|
75 | + 'base_tree' => $base_tree |
|
76 | + ]); |
|
77 | + } |
|
78 | 78 | } |
@@ -12,45 +12,45 @@ |
||
12 | 12 | class Blobs extends AbstractGitData |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Get a Blob |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/git/blobs/#get-a-blob |
|
19 | - * |
|
20 | - * @param string $sha |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function getBlob(string $sha): array |
|
25 | - { |
|
26 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
27 | - '/repos/:owner/:repo/git/blobs/:sha', |
|
28 | - $this->getGitData()->getOwner(), |
|
29 | - $this->getGitData()->getRepo(), |
|
30 | - $sha |
|
31 | - )); |
|
32 | - } |
|
15 | + /** |
|
16 | + * Get a Blob |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/git/blobs/#get-a-blob |
|
19 | + * |
|
20 | + * @param string $sha |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function getBlob(string $sha): array |
|
25 | + { |
|
26 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
27 | + '/repos/:owner/:repo/git/blobs/:sha', |
|
28 | + $this->getGitData()->getOwner(), |
|
29 | + $this->getGitData()->getRepo(), |
|
30 | + $sha |
|
31 | + )); |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * Create a Blob |
|
36 | - * |
|
37 | - * @link https://developer.github.com/v3/git/blobs/#create-a-blob |
|
38 | - * |
|
39 | - * @param string $content |
|
40 | - * @param string $encoding |
|
41 | - * |
|
42 | - * @return array |
|
43 | - */ |
|
44 | - public function createBlob(string $content, string $encoding = 'utf-8'): array |
|
45 | - { |
|
46 | - return $this->getApi()->request($this->getApi() |
|
47 | - ->sprintf( |
|
48 | - '/repos/:owner/:repo/git/blobs', |
|
49 | - $this->getGitData()->getOwner(), |
|
50 | - $this->getGitData()->getRepo() |
|
51 | - ), Request::METHOD_POST, [ |
|
52 | - 'content' => $content, |
|
53 | - 'encoding' => $encoding |
|
54 | - ]); |
|
55 | - } |
|
34 | + /** |
|
35 | + * Create a Blob |
|
36 | + * |
|
37 | + * @link https://developer.github.com/v3/git/blobs/#create-a-blob |
|
38 | + * |
|
39 | + * @param string $content |
|
40 | + * @param string $encoding |
|
41 | + * |
|
42 | + * @return array |
|
43 | + */ |
|
44 | + public function createBlob(string $content, string $encoding = 'utf-8'): array |
|
45 | + { |
|
46 | + return $this->getApi()->request($this->getApi() |
|
47 | + ->sprintf( |
|
48 | + '/repos/:owner/:repo/git/blobs', |
|
49 | + $this->getGitData()->getOwner(), |
|
50 | + $this->getGitData()->getRepo() |
|
51 | + ), Request::METHOD_POST, [ |
|
52 | + 'content' => $content, |
|
53 | + 'encoding' => $encoding |
|
54 | + ]); |
|
55 | + } |
|
56 | 56 | } |
@@ -13,59 +13,59 @@ |
||
13 | 13 | class Commits extends AbstractGitData |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * Get a Commit |
|
18 | - * |
|
19 | - * @link https://developer.github.com/v3/git/commits/#get-a-commit |
|
20 | - * |
|
21 | - * @param string $sha |
|
22 | - * |
|
23 | - * @return array |
|
24 | - */ |
|
25 | - public function get(string $sha): array |
|
26 | - { |
|
27 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
28 | - '/repos/:owner/:repo/git/commits/:sha', |
|
29 | - $this->getGitData()->getOwner(), |
|
30 | - $this->getGitData()->getRepo(), |
|
31 | - $sha |
|
32 | - )); |
|
33 | - } |
|
16 | + /** |
|
17 | + * Get a Commit |
|
18 | + * |
|
19 | + * @link https://developer.github.com/v3/git/commits/#get-a-commit |
|
20 | + * |
|
21 | + * @param string $sha |
|
22 | + * |
|
23 | + * @return array |
|
24 | + */ |
|
25 | + public function get(string $sha): array |
|
26 | + { |
|
27 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
28 | + '/repos/:owner/:repo/git/commits/:sha', |
|
29 | + $this->getGitData()->getOwner(), |
|
30 | + $this->getGitData()->getRepo(), |
|
31 | + $sha |
|
32 | + )); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * Create a Commit |
|
37 | - * |
|
38 | - * @link https://developer.github.com/v3/git/commits/#create-a-commit |
|
39 | - * |
|
40 | - * @param string $message |
|
41 | - * @param string $tree |
|
42 | - * @param array|string $parents |
|
43 | - * @param string $name |
|
44 | - * @param string $email |
|
45 | - * @param string $date |
|
46 | - * |
|
47 | - * @return array |
|
48 | - * @throws \Exception |
|
49 | - */ |
|
50 | - public function create( |
|
51 | - string $message, |
|
52 | - string $tree, |
|
53 | - $parents, |
|
54 | - string $name = null, |
|
55 | - string $email = null, |
|
56 | - string $date = 'now' |
|
57 | - ): array { |
|
58 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
59 | - '/repos/:owner/:repo/git/commits', |
|
60 | - $this->getGitData()->getOwner(), |
|
61 | - $this->getGitData()->getRepo() |
|
62 | - ), Request::METHOD_POST, [ |
|
63 | - 'message' => $message, |
|
64 | - 'tree' => $tree, |
|
65 | - 'parents' => $parents, |
|
66 | - 'name' => $name, |
|
67 | - 'email' => $email, |
|
68 | - 'date' => (new DateTime($date))->format(DateTime::ATOM) |
|
69 | - ]); |
|
70 | - } |
|
35 | + /** |
|
36 | + * Create a Commit |
|
37 | + * |
|
38 | + * @link https://developer.github.com/v3/git/commits/#create-a-commit |
|
39 | + * |
|
40 | + * @param string $message |
|
41 | + * @param string $tree |
|
42 | + * @param array|string $parents |
|
43 | + * @param string $name |
|
44 | + * @param string $email |
|
45 | + * @param string $date |
|
46 | + * |
|
47 | + * @return array |
|
48 | + * @throws \Exception |
|
49 | + */ |
|
50 | + public function create( |
|
51 | + string $message, |
|
52 | + string $tree, |
|
53 | + $parents, |
|
54 | + string $name = null, |
|
55 | + string $email = null, |
|
56 | + string $date = 'now' |
|
57 | + ): array { |
|
58 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
59 | + '/repos/:owner/:repo/git/commits', |
|
60 | + $this->getGitData()->getOwner(), |
|
61 | + $this->getGitData()->getRepo() |
|
62 | + ), Request::METHOD_POST, [ |
|
63 | + 'message' => $message, |
|
64 | + 'tree' => $tree, |
|
65 | + 'parents' => $parents, |
|
66 | + 'name' => $name, |
|
67 | + 'email' => $email, |
|
68 | + 'date' => (new DateTime($date))->format(DateTime::ATOM) |
|
69 | + ]); |
|
70 | + } |
|
71 | 71 | } |