@@ -12,237 +12,237 @@ |
||
| 12 | 12 | class Labels extends AbstractIssues |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * List all labels for this repository |
|
| 17 | - * |
|
| 18 | - * @link https://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository |
|
| 19 | - * @return array |
|
| 20 | - */ |
|
| 21 | - public function listRepositoryLabels(): array |
|
| 22 | - { |
|
| 23 | - return $this->getApi()->request($this->getApi() |
|
| 24 | - ->sprintf( |
|
| 25 | - '/repos/:owner/:repo/labels', |
|
| 26 | - $this->getIssues()->getOwner(), |
|
| 27 | - $this->getIssues()->getRepo() |
|
| 28 | - )); |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * Get a single label |
|
| 33 | - * |
|
| 34 | - * @link https://developer.github.com/v3/issues/labels/#get-a-single-label |
|
| 35 | - * |
|
| 36 | - * @param string $name |
|
| 37 | - * |
|
| 38 | - * @return array |
|
| 39 | - */ |
|
| 40 | - public function getLabel(string $name): array |
|
| 41 | - { |
|
| 42 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 43 | - '/repos/:owner/:repo/labels/:name', |
|
| 44 | - $this->getIssues()->getOwner(), |
|
| 45 | - $this->getIssues()->getRepo(), |
|
| 46 | - $name |
|
| 47 | - )); |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * Create a label |
|
| 52 | - * |
|
| 53 | - * @link https://developer.github.com/v3/issues/labels/#create-a-label |
|
| 54 | - * |
|
| 55 | - * @param string $name |
|
| 56 | - * @param string $color |
|
| 57 | - * |
|
| 58 | - * @return array |
|
| 59 | - */ |
|
| 60 | - public function createLabel(string $name, string $color): array |
|
| 61 | - { |
|
| 62 | - return $this->getApi()->request($this->getApi() |
|
| 63 | - ->sprintf( |
|
| 64 | - '/repos/:owner/:repo/labels', |
|
| 65 | - $this->getIssues()->getOwner(), |
|
| 66 | - $this->getIssues()->getRepo() |
|
| 67 | - ), Request::METHOD_POST, [ |
|
| 68 | - 'name' => $name, |
|
| 69 | - 'color' => $color |
|
| 70 | - ]); |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * Update a label |
|
| 75 | - * |
|
| 76 | - * @link https://developer.github.com/v3/issues/labels/#update-a-label |
|
| 77 | - * |
|
| 78 | - * @param string $name |
|
| 79 | - * @param string $color |
|
| 80 | - * |
|
| 81 | - * @return array |
|
| 82 | - */ |
|
| 83 | - public function updateLabel(string $name, string $color): array |
|
| 84 | - { |
|
| 85 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 86 | - '/repos/:owner/:repo/labels/:name', |
|
| 87 | - $this->getIssues()->getOwner(), |
|
| 88 | - $this->getIssues()->getRepo(), |
|
| 89 | - $name |
|
| 90 | - ), Request::METHOD_PATCH, [ |
|
| 91 | - 'color' => $color |
|
| 92 | - ]); |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * Delete a label |
|
| 97 | - * |
|
| 98 | - * @link https://developer.github.com/v3/issues/labels/#delete-a-label |
|
| 99 | - * |
|
| 100 | - * @param string $name |
|
| 101 | - * |
|
| 102 | - * @return bool |
|
| 103 | - */ |
|
| 104 | - public function deleteLabel(string $name): bool |
|
| 105 | - { |
|
| 106 | - $this->getApi()->request($this->getApi() |
|
| 107 | - ->sprintf( |
|
| 108 | - '/repos/:owner/:repo/labels/:name', |
|
| 109 | - $this->getIssues()->getOwner(), |
|
| 110 | - $this->getIssues()->getRepo(), |
|
| 111 | - $name |
|
| 112 | - )); |
|
| 113 | - |
|
| 114 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 115 | - return true; |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - return false; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * List labels on an issue |
|
| 123 | - * |
|
| 124 | - * @link https://developer.github.com/v3/issues/labels/#list-labels-on-an-issue |
|
| 125 | - * |
|
| 126 | - * @param int $number |
|
| 127 | - * |
|
| 128 | - * @return array |
|
| 129 | - */ |
|
| 130 | - public function listIssueLabels(int $number): array |
|
| 131 | - { |
|
| 132 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 133 | - '/repos/:owner/:repo/issues/:number/labels', |
|
| 134 | - $this->getIssues()->getOwner(), |
|
| 135 | - $this->getIssues()->getRepo(), |
|
| 136 | - $number |
|
| 137 | - )); |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - /** |
|
| 141 | - * Add labels to an issue |
|
| 142 | - * |
|
| 143 | - * @link https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue |
|
| 144 | - * |
|
| 145 | - * @param int $number |
|
| 146 | - * |
|
| 147 | - * @return array |
|
| 148 | - */ |
|
| 149 | - public function addIssueLabels(int $number): array |
|
| 150 | - { |
|
| 151 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 152 | - '/repos/:owner/:repo/issues/:number/labels', |
|
| 153 | - $this->getIssues()->getOwner(), |
|
| 154 | - $this->getIssues()->getRepo(), |
|
| 155 | - $number |
|
| 156 | - ), Request::METHOD_POST); |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * Remove a label from an issue |
|
| 161 | - * |
|
| 162 | - * @link https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue |
|
| 163 | - * |
|
| 164 | - * @param int $number |
|
| 165 | - * @param string $name |
|
| 166 | - * |
|
| 167 | - * @return bool |
|
| 168 | - */ |
|
| 169 | - public function removeIssueLabel(int $number, string $name): bool |
|
| 170 | - { |
|
| 171 | - $this->getApi()->request($this->getApi()->sprintf( |
|
| 172 | - '/repos/:owner/:repo/issues/:number/labels/:name', |
|
| 173 | - $this->getIssues()->getOwner(), |
|
| 174 | - $this->getIssues()->getRepo(), |
|
| 175 | - $number, |
|
| 176 | - $name |
|
| 177 | - ), Request::METHOD_DELETE); |
|
| 178 | - |
|
| 179 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 180 | - return true; |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - return false; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * Replace all labels for an issue |
|
| 188 | - * |
|
| 189 | - * @link https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue |
|
| 190 | - * |
|
| 191 | - * @param int $number |
|
| 192 | - * |
|
| 193 | - * @return array |
|
| 194 | - */ |
|
| 195 | - public function replaceIssuesLabels(int $number): array |
|
| 196 | - { |
|
| 197 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 198 | - '/repos/:owner/:repo/issues/:number/labels', |
|
| 199 | - $this->getIssues()->getOwner(), |
|
| 200 | - $this->getIssues()->getRepo(), |
|
| 201 | - $number |
|
| 202 | - ), Request::METHOD_PUT); |
|
| 203 | - } |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * Remove all labels from an issue |
|
| 207 | - * |
|
| 208 | - * @link https://developer.github.com/v3/issues/labels/#remove-all-labels-from-an-issue |
|
| 209 | - * |
|
| 210 | - * @param int $number |
|
| 211 | - * |
|
| 212 | - * @return bool |
|
| 213 | - */ |
|
| 214 | - public function removeIssueLabels(int $number): bool |
|
| 215 | - { |
|
| 216 | - $this->getApi()->request($this->getApi()->sprintf( |
|
| 217 | - '/repos/:owner/:repo/issues/:number/labels', |
|
| 218 | - $this->getIssues()->getOwner(), |
|
| 219 | - $this->getIssues()->getRepo(), |
|
| 220 | - $number |
|
| 221 | - ), Request::METHOD_DELETE); |
|
| 222 | - |
|
| 223 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 224 | - return true; |
|
| 225 | - } |
|
| 226 | - |
|
| 227 | - return false; |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - /** |
|
| 231 | - * Get labels for every issue in a milestone |
|
| 232 | - * |
|
| 233 | - * @link https://developer.github.com/v3/issues/labels/#get-labels-for-every-issue-in-a-milestone |
|
| 234 | - * |
|
| 235 | - * @param int $number |
|
| 236 | - * |
|
| 237 | - * @return array |
|
| 238 | - */ |
|
| 239 | - public function getIssueLabelsInMilestone(int $number): array |
|
| 240 | - { |
|
| 241 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 242 | - '/repos/:owner/:repo/milestones/:number/labels', |
|
| 243 | - $this->getIssues()->getOwner(), |
|
| 244 | - $this->getIssues()->getRepo(), |
|
| 245 | - $number |
|
| 246 | - )); |
|
| 247 | - } |
|
| 15 | + /** |
|
| 16 | + * List all labels for this repository |
|
| 17 | + * |
|
| 18 | + * @link https://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository |
|
| 19 | + * @return array |
|
| 20 | + */ |
|
| 21 | + public function listRepositoryLabels(): array |
|
| 22 | + { |
|
| 23 | + return $this->getApi()->request($this->getApi() |
|
| 24 | + ->sprintf( |
|
| 25 | + '/repos/:owner/:repo/labels', |
|
| 26 | + $this->getIssues()->getOwner(), |
|
| 27 | + $this->getIssues()->getRepo() |
|
| 28 | + )); |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * Get a single label |
|
| 33 | + * |
|
| 34 | + * @link https://developer.github.com/v3/issues/labels/#get-a-single-label |
|
| 35 | + * |
|
| 36 | + * @param string $name |
|
| 37 | + * |
|
| 38 | + * @return array |
|
| 39 | + */ |
|
| 40 | + public function getLabel(string $name): array |
|
| 41 | + { |
|
| 42 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 43 | + '/repos/:owner/:repo/labels/:name', |
|
| 44 | + $this->getIssues()->getOwner(), |
|
| 45 | + $this->getIssues()->getRepo(), |
|
| 46 | + $name |
|
| 47 | + )); |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * Create a label |
|
| 52 | + * |
|
| 53 | + * @link https://developer.github.com/v3/issues/labels/#create-a-label |
|
| 54 | + * |
|
| 55 | + * @param string $name |
|
| 56 | + * @param string $color |
|
| 57 | + * |
|
| 58 | + * @return array |
|
| 59 | + */ |
|
| 60 | + public function createLabel(string $name, string $color): array |
|
| 61 | + { |
|
| 62 | + return $this->getApi()->request($this->getApi() |
|
| 63 | + ->sprintf( |
|
| 64 | + '/repos/:owner/:repo/labels', |
|
| 65 | + $this->getIssues()->getOwner(), |
|
| 66 | + $this->getIssues()->getRepo() |
|
| 67 | + ), Request::METHOD_POST, [ |
|
| 68 | + 'name' => $name, |
|
| 69 | + 'color' => $color |
|
| 70 | + ]); |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * Update a label |
|
| 75 | + * |
|
| 76 | + * @link https://developer.github.com/v3/issues/labels/#update-a-label |
|
| 77 | + * |
|
| 78 | + * @param string $name |
|
| 79 | + * @param string $color |
|
| 80 | + * |
|
| 81 | + * @return array |
|
| 82 | + */ |
|
| 83 | + public function updateLabel(string $name, string $color): array |
|
| 84 | + { |
|
| 85 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 86 | + '/repos/:owner/:repo/labels/:name', |
|
| 87 | + $this->getIssues()->getOwner(), |
|
| 88 | + $this->getIssues()->getRepo(), |
|
| 89 | + $name |
|
| 90 | + ), Request::METHOD_PATCH, [ |
|
| 91 | + 'color' => $color |
|
| 92 | + ]); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * Delete a label |
|
| 97 | + * |
|
| 98 | + * @link https://developer.github.com/v3/issues/labels/#delete-a-label |
|
| 99 | + * |
|
| 100 | + * @param string $name |
|
| 101 | + * |
|
| 102 | + * @return bool |
|
| 103 | + */ |
|
| 104 | + public function deleteLabel(string $name): bool |
|
| 105 | + { |
|
| 106 | + $this->getApi()->request($this->getApi() |
|
| 107 | + ->sprintf( |
|
| 108 | + '/repos/:owner/:repo/labels/:name', |
|
| 109 | + $this->getIssues()->getOwner(), |
|
| 110 | + $this->getIssues()->getRepo(), |
|
| 111 | + $name |
|
| 112 | + )); |
|
| 113 | + |
|
| 114 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 115 | + return true; |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + return false; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * List labels on an issue |
|
| 123 | + * |
|
| 124 | + * @link https://developer.github.com/v3/issues/labels/#list-labels-on-an-issue |
|
| 125 | + * |
|
| 126 | + * @param int $number |
|
| 127 | + * |
|
| 128 | + * @return array |
|
| 129 | + */ |
|
| 130 | + public function listIssueLabels(int $number): array |
|
| 131 | + { |
|
| 132 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 133 | + '/repos/:owner/:repo/issues/:number/labels', |
|
| 134 | + $this->getIssues()->getOwner(), |
|
| 135 | + $this->getIssues()->getRepo(), |
|
| 136 | + $number |
|
| 137 | + )); |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * Add labels to an issue |
|
| 142 | + * |
|
| 143 | + * @link https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue |
|
| 144 | + * |
|
| 145 | + * @param int $number |
|
| 146 | + * |
|
| 147 | + * @return array |
|
| 148 | + */ |
|
| 149 | + public function addIssueLabels(int $number): array |
|
| 150 | + { |
|
| 151 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 152 | + '/repos/:owner/:repo/issues/:number/labels', |
|
| 153 | + $this->getIssues()->getOwner(), |
|
| 154 | + $this->getIssues()->getRepo(), |
|
| 155 | + $number |
|
| 156 | + ), Request::METHOD_POST); |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * Remove a label from an issue |
|
| 161 | + * |
|
| 162 | + * @link https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue |
|
| 163 | + * |
|
| 164 | + * @param int $number |
|
| 165 | + * @param string $name |
|
| 166 | + * |
|
| 167 | + * @return bool |
|
| 168 | + */ |
|
| 169 | + public function removeIssueLabel(int $number, string $name): bool |
|
| 170 | + { |
|
| 171 | + $this->getApi()->request($this->getApi()->sprintf( |
|
| 172 | + '/repos/:owner/:repo/issues/:number/labels/:name', |
|
| 173 | + $this->getIssues()->getOwner(), |
|
| 174 | + $this->getIssues()->getRepo(), |
|
| 175 | + $number, |
|
| 176 | + $name |
|
| 177 | + ), Request::METHOD_DELETE); |
|
| 178 | + |
|
| 179 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 180 | + return true; |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + return false; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * Replace all labels for an issue |
|
| 188 | + * |
|
| 189 | + * @link https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue |
|
| 190 | + * |
|
| 191 | + * @param int $number |
|
| 192 | + * |
|
| 193 | + * @return array |
|
| 194 | + */ |
|
| 195 | + public function replaceIssuesLabels(int $number): array |
|
| 196 | + { |
|
| 197 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 198 | + '/repos/:owner/:repo/issues/:number/labels', |
|
| 199 | + $this->getIssues()->getOwner(), |
|
| 200 | + $this->getIssues()->getRepo(), |
|
| 201 | + $number |
|
| 202 | + ), Request::METHOD_PUT); |
|
| 203 | + } |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * Remove all labels from an issue |
|
| 207 | + * |
|
| 208 | + * @link https://developer.github.com/v3/issues/labels/#remove-all-labels-from-an-issue |
|
| 209 | + * |
|
| 210 | + * @param int $number |
|
| 211 | + * |
|
| 212 | + * @return bool |
|
| 213 | + */ |
|
| 214 | + public function removeIssueLabels(int $number): bool |
|
| 215 | + { |
|
| 216 | + $this->getApi()->request($this->getApi()->sprintf( |
|
| 217 | + '/repos/:owner/:repo/issues/:number/labels', |
|
| 218 | + $this->getIssues()->getOwner(), |
|
| 219 | + $this->getIssues()->getRepo(), |
|
| 220 | + $number |
|
| 221 | + ), Request::METHOD_DELETE); |
|
| 222 | + |
|
| 223 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 224 | + return true; |
|
| 225 | + } |
|
| 226 | + |
|
| 227 | + return false; |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + /** |
|
| 231 | + * Get labels for every issue in a milestone |
|
| 232 | + * |
|
| 233 | + * @link https://developer.github.com/v3/issues/labels/#get-labels-for-every-issue-in-a-milestone |
|
| 234 | + * |
|
| 235 | + * @param int $number |
|
| 236 | + * |
|
| 237 | + * @return array |
|
| 238 | + */ |
|
| 239 | + public function getIssueLabelsInMilestone(int $number): array |
|
| 240 | + { |
|
| 241 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 242 | + '/repos/:owner/:repo/milestones/:number/labels', |
|
| 243 | + $this->getIssues()->getOwner(), |
|
| 244 | + $this->getIssues()->getRepo(), |
|
| 245 | + $number |
|
| 246 | + )); |
|
| 247 | + } |
|
| 248 | 248 | } |
@@ -12,27 +12,27 @@ |
||
| 12 | 12 | class Merging extends AbstractRepositories |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Perform a merge |
|
| 17 | - * |
|
| 18 | - * @link https://developer.github.com/v3/repos/merging/#perform-a-merge |
|
| 19 | - * |
|
| 20 | - * @param string $base |
|
| 21 | - * @param string $head |
|
| 22 | - * @param string|null $commitMessage |
|
| 23 | - * |
|
| 24 | - * @return array |
|
| 25 | - */ |
|
| 26 | - public function performMerge(string $base, string $head, string $commitMessage = null): array |
|
| 27 | - { |
|
| 28 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 29 | - '/repos/:owner/:repo/merges', |
|
| 30 | - $this->getRepositories()->getOwner(), |
|
| 31 | - $this->getRepositories()->getRepo() |
|
| 32 | - ), Request::METHOD_POST, [ |
|
| 33 | - 'base' => $base, |
|
| 34 | - 'head' => $head, |
|
| 35 | - 'commit_message' => $commitMessage |
|
| 36 | - ]); |
|
| 37 | - } |
|
| 15 | + /** |
|
| 16 | + * Perform a merge |
|
| 17 | + * |
|
| 18 | + * @link https://developer.github.com/v3/repos/merging/#perform-a-merge |
|
| 19 | + * |
|
| 20 | + * @param string $base |
|
| 21 | + * @param string $head |
|
| 22 | + * @param string|null $commitMessage |
|
| 23 | + * |
|
| 24 | + * @return array |
|
| 25 | + */ |
|
| 26 | + public function performMerge(string $base, string $head, string $commitMessage = null): array |
|
| 27 | + { |
|
| 28 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 29 | + '/repos/:owner/:repo/merges', |
|
| 30 | + $this->getRepositories()->getOwner(), |
|
| 31 | + $this->getRepositories()->getRepo() |
|
| 32 | + ), Request::METHOD_POST, [ |
|
| 33 | + 'base' => $base, |
|
| 34 | + 'head' => $head, |
|
| 35 | + 'commit_message' => $commitMessage |
|
| 36 | + ]); |
|
| 37 | + } |
|
| 38 | 38 | } |
@@ -12,80 +12,80 @@ |
||
| 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( |
|
| 25 | - '/repos/:owner/:repo/keys', |
|
| 26 | - $this->getRepositories()->getOwner(), |
|
| 27 | - $this->getRepositories()->getRepo() |
|
| 28 | - )); |
|
| 29 | - } |
|
| 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( |
|
| 25 | + '/repos/:owner/:repo/keys', |
|
| 26 | + $this->getRepositories()->getOwner(), |
|
| 27 | + $this->getRepositories()->getRepo() |
|
| 28 | + )); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Get a deploy key |
|
| 33 | - * |
|
| 34 | - * @link https://developer.github.com/v3/repos/keys/#get |
|
| 35 | - * |
|
| 36 | - * @param int $id |
|
| 37 | - * |
|
| 38 | - * @return array |
|
| 39 | - */ |
|
| 40 | - public function getDeployKey(int $id): array |
|
| 41 | - { |
|
| 42 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 43 | - '/repos/:owner/:repo/keys/:id', |
|
| 44 | - $this->getRepositories()->getOwner(), |
|
| 45 | - $this->getRepositories()->getRepo(), |
|
| 46 | - $id |
|
| 47 | - )); |
|
| 48 | - } |
|
| 31 | + /** |
|
| 32 | + * Get a deploy key |
|
| 33 | + * |
|
| 34 | + * @link https://developer.github.com/v3/repos/keys/#get |
|
| 35 | + * |
|
| 36 | + * @param int $id |
|
| 37 | + * |
|
| 38 | + * @return array |
|
| 39 | + */ |
|
| 40 | + public function getDeployKey(int $id): array |
|
| 41 | + { |
|
| 42 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 43 | + '/repos/:owner/:repo/keys/:id', |
|
| 44 | + $this->getRepositories()->getOwner(), |
|
| 45 | + $this->getRepositories()->getRepo(), |
|
| 46 | + $id |
|
| 47 | + )); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * Add a new deploy key |
|
| 52 | - * |
|
| 53 | - * @link https://developer.github.com/v3/repos/keys/#create |
|
| 54 | - * |
|
| 55 | - * @param string $title |
|
| 56 | - * @param string $key |
|
| 57 | - * |
|
| 58 | - * @return array |
|
| 59 | - */ |
|
| 60 | - public function addNewDeployKey(string $title, string $key): array |
|
| 61 | - { |
|
| 62 | - return $this->getApi()->request($this->getApi() |
|
| 63 | - ->sprintf( |
|
| 64 | - '/repos/:owner/:repo/keys', |
|
| 65 | - $this->getRepositories()->getOwner(), |
|
| 66 | - $this->getRepositories()->getRepo() |
|
| 67 | - ), Request::METHOD_POST, [ |
|
| 68 | - 'title' => $title, |
|
| 69 | - 'key' => $key |
|
| 70 | - ]); |
|
| 71 | - } |
|
| 50 | + /** |
|
| 51 | + * Add a new deploy key |
|
| 52 | + * |
|
| 53 | + * @link https://developer.github.com/v3/repos/keys/#create |
|
| 54 | + * |
|
| 55 | + * @param string $title |
|
| 56 | + * @param string $key |
|
| 57 | + * |
|
| 58 | + * @return array |
|
| 59 | + */ |
|
| 60 | + public function addNewDeployKey(string $title, string $key): array |
|
| 61 | + { |
|
| 62 | + return $this->getApi()->request($this->getApi() |
|
| 63 | + ->sprintf( |
|
| 64 | + '/repos/:owner/:repo/keys', |
|
| 65 | + $this->getRepositories()->getOwner(), |
|
| 66 | + $this->getRepositories()->getRepo() |
|
| 67 | + ), Request::METHOD_POST, [ |
|
| 68 | + 'title' => $title, |
|
| 69 | + 'key' => $key |
|
| 70 | + ]); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Remove a deploy key |
|
| 75 | - * |
|
| 76 | - * @link https://developer.github.com/v3/repos/keys/#delete |
|
| 77 | - * |
|
| 78 | - * @param int $id |
|
| 79 | - * |
|
| 80 | - * @return array |
|
| 81 | - */ |
|
| 82 | - public function removeDeployKey(int $id): array |
|
| 83 | - { |
|
| 84 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 85 | - '/repos/:owner/:repo/keys/:id', |
|
| 86 | - $this->getRepositories()->getOwner(), |
|
| 87 | - $this->getRepositories()->getRepo(), |
|
| 88 | - $id |
|
| 89 | - ), Request::METHOD_DELETE); |
|
| 90 | - } |
|
| 73 | + /** |
|
| 74 | + * Remove a deploy key |
|
| 75 | + * |
|
| 76 | + * @link https://developer.github.com/v3/repos/keys/#delete |
|
| 77 | + * |
|
| 78 | + * @param int $id |
|
| 79 | + * |
|
| 80 | + * @return array |
|
| 81 | + */ |
|
| 82 | + public function removeDeployKey(int $id): array |
|
| 83 | + { |
|
| 84 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 85 | + '/repos/:owner/:repo/keys/:id', |
|
| 86 | + $this->getRepositories()->getOwner(), |
|
| 87 | + $this->getRepositories()->getRepo(), |
|
| 88 | + $id |
|
| 89 | + ), Request::METHOD_DELETE); |
|
| 90 | + } |
|
| 91 | 91 | } |
@@ -13,44 +13,44 @@ |
||
| 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( |
|
| 28 | - '/repos/:owner/:repo/forks?:arg', |
|
| 29 | - $this->getRepositories()->getOwner(), |
|
| 30 | - $this->getRepositories()->getRepo(), |
|
| 31 | - http_build_query(['sort' => $sort]) |
|
| 32 | - )); |
|
| 33 | - } |
|
| 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( |
|
| 28 | + '/repos/:owner/:repo/forks?:arg', |
|
| 29 | + $this->getRepositories()->getOwner(), |
|
| 30 | + $this->getRepositories()->getRepo(), |
|
| 31 | + http_build_query(['sort' => $sort]) |
|
| 32 | + )); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Create a fork |
|
| 37 | - * |
|
| 38 | - * @link https://developer.github.com/v3/repos/forks/#create-a-fork |
|
| 39 | - * |
|
| 40 | - * @param string $organization |
|
| 41 | - * |
|
| 42 | - * @return array |
|
| 43 | - */ |
|
| 44 | - public function createFork(string $organization = ''): array |
|
| 45 | - { |
|
| 46 | - return $this->getApi()->request( |
|
| 47 | - $this->getApi()->sprintf( |
|
| 48 | - '/repos/:owner/:repo/forks', |
|
| 49 | - $this->getRepositories()->getOwner(), |
|
| 50 | - $this->getRepositories()->getRepo() |
|
| 51 | - ), |
|
| 52 | - Request::METHOD_POST, |
|
| 53 | - ['organization' => $organization] |
|
| 54 | - ); |
|
| 55 | - } |
|
| 35 | + /** |
|
| 36 | + * Create a fork |
|
| 37 | + * |
|
| 38 | + * @link https://developer.github.com/v3/repos/forks/#create-a-fork |
|
| 39 | + * |
|
| 40 | + * @param string $organization |
|
| 41 | + * |
|
| 42 | + * @return array |
|
| 43 | + */ |
|
| 44 | + public function createFork(string $organization = ''): array |
|
| 45 | + { |
|
| 46 | + return $this->getApi()->request( |
|
| 47 | + $this->getApi()->sprintf( |
|
| 48 | + '/repos/:owner/:repo/forks', |
|
| 49 | + $this->getRepositories()->getOwner(), |
|
| 50 | + $this->getRepositories()->getRepo() |
|
| 51 | + ), |
|
| 52 | + Request::METHOD_POST, |
|
| 53 | + ['organization' => $organization] |
|
| 54 | + ); |
|
| 55 | + } |
|
| 56 | 56 | } |
@@ -13,117 +13,117 @@ |
||
| 13 | 13 | class Deployments extends AbstractRepositories |
| 14 | 14 | { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * List Deployments |
|
| 18 | - * |
|
| 19 | - * @link https://developer.github.com/v3/repos/deployments/#list-deployments |
|
| 20 | - * |
|
| 21 | - * @param string $sha |
|
| 22 | - * @param string $ref |
|
| 23 | - * @param string $task |
|
| 24 | - * @param string $environment |
|
| 25 | - * |
|
| 26 | - * @return array |
|
| 27 | - */ |
|
| 28 | - public function listDeployments( |
|
| 29 | - string $sha = null, |
|
| 30 | - string $ref = null, |
|
| 31 | - string $task = null, |
|
| 32 | - string $environment = null |
|
| 33 | - ): array { |
|
| 34 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 35 | - '/repos/:owner/:repo/deployments', |
|
| 36 | - $this->getRepositories()->getOwner(), |
|
| 37 | - $this->getRepositories()->getRepo(), |
|
| 38 | - http_build_query(['sha' => $sha, 'ref' => $ref, 'task' => $task, 'environment' => $environment]) |
|
| 39 | - )); |
|
| 40 | - } |
|
| 16 | + /** |
|
| 17 | + * List Deployments |
|
| 18 | + * |
|
| 19 | + * @link https://developer.github.com/v3/repos/deployments/#list-deployments |
|
| 20 | + * |
|
| 21 | + * @param string $sha |
|
| 22 | + * @param string $ref |
|
| 23 | + * @param string $task |
|
| 24 | + * @param string $environment |
|
| 25 | + * |
|
| 26 | + * @return array |
|
| 27 | + */ |
|
| 28 | + public function listDeployments( |
|
| 29 | + string $sha = null, |
|
| 30 | + string $ref = null, |
|
| 31 | + string $task = null, |
|
| 32 | + string $environment = null |
|
| 33 | + ): array { |
|
| 34 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 35 | + '/repos/:owner/:repo/deployments', |
|
| 36 | + $this->getRepositories()->getOwner(), |
|
| 37 | + $this->getRepositories()->getRepo(), |
|
| 38 | + http_build_query(['sha' => $sha, 'ref' => $ref, 'task' => $task, 'environment' => $environment]) |
|
| 39 | + )); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Create a Deployment |
|
| 44 | - * |
|
| 45 | - * @link https://developer.github.com/v3/repos/deployments/#create-a-deployment |
|
| 46 | - * |
|
| 47 | - * @param string $ref |
|
| 48 | - * @param string $task |
|
| 49 | - * @param bool $autoMerge |
|
| 50 | - * @param array $requiredContexts |
|
| 51 | - * @param string $payload |
|
| 52 | - * @param string $environment |
|
| 53 | - * @param string $description |
|
| 54 | - * |
|
| 55 | - * @return array |
|
| 56 | - */ |
|
| 57 | - public function createDeployement( |
|
| 58 | - string $ref, |
|
| 59 | - string $task = AbstractApi::TASK_DEPLOY, |
|
| 60 | - bool $autoMerge = true, |
|
| 61 | - array $requiredContexts = [], |
|
| 62 | - string $payload = '', |
|
| 63 | - string $environment = AbstractApi::ENVIRONMENT_PRODUCTION, |
|
| 64 | - string $description = '' |
|
| 65 | - ): array { |
|
| 66 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 67 | - '/repos/:owner/:repo/deployments', |
|
| 68 | - $this->getRepositories()->getOwner(), |
|
| 69 | - $this->getRepositories()->getRepo() |
|
| 70 | - ), Request::METHOD_POST, [ |
|
| 71 | - 'ref' => $ref, |
|
| 72 | - 'task' => $task, |
|
| 73 | - 'auto_merge' => $autoMerge, |
|
| 74 | - 'required_contexts' => $requiredContexts, |
|
| 75 | - 'payload' => $payload, |
|
| 76 | - 'environment' => $environment, |
|
| 77 | - 'description' => $description |
|
| 78 | - ]); |
|
| 79 | - } |
|
| 42 | + /** |
|
| 43 | + * Create a Deployment |
|
| 44 | + * |
|
| 45 | + * @link https://developer.github.com/v3/repos/deployments/#create-a-deployment |
|
| 46 | + * |
|
| 47 | + * @param string $ref |
|
| 48 | + * @param string $task |
|
| 49 | + * @param bool $autoMerge |
|
| 50 | + * @param array $requiredContexts |
|
| 51 | + * @param string $payload |
|
| 52 | + * @param string $environment |
|
| 53 | + * @param string $description |
|
| 54 | + * |
|
| 55 | + * @return array |
|
| 56 | + */ |
|
| 57 | + public function createDeployement( |
|
| 58 | + string $ref, |
|
| 59 | + string $task = AbstractApi::TASK_DEPLOY, |
|
| 60 | + bool $autoMerge = true, |
|
| 61 | + array $requiredContexts = [], |
|
| 62 | + string $payload = '', |
|
| 63 | + string $environment = AbstractApi::ENVIRONMENT_PRODUCTION, |
|
| 64 | + string $description = '' |
|
| 65 | + ): array { |
|
| 66 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 67 | + '/repos/:owner/:repo/deployments', |
|
| 68 | + $this->getRepositories()->getOwner(), |
|
| 69 | + $this->getRepositories()->getRepo() |
|
| 70 | + ), Request::METHOD_POST, [ |
|
| 71 | + 'ref' => $ref, |
|
| 72 | + 'task' => $task, |
|
| 73 | + 'auto_merge' => $autoMerge, |
|
| 74 | + 'required_contexts' => $requiredContexts, |
|
| 75 | + 'payload' => $payload, |
|
| 76 | + 'environment' => $environment, |
|
| 77 | + 'description' => $description |
|
| 78 | + ]); |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * List Deployment Statuses |
|
| 83 | - * |
|
| 84 | - * @link https://developer.github.com/v3/repos/deployments/#list-deployment-statuses |
|
| 85 | - * |
|
| 86 | - * @param int $id |
|
| 87 | - * |
|
| 88 | - * @return array |
|
| 89 | - */ |
|
| 90 | - public function listDeploymentStatus(int $id): array |
|
| 91 | - { |
|
| 92 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 93 | - '/repos/:owner/:repo/deployments/:id/statuses', |
|
| 94 | - $this->getRepositories()->getOwner(), |
|
| 95 | - $this->getRepositories()->getRepo(), |
|
| 96 | - $id |
|
| 97 | - )); |
|
| 98 | - } |
|
| 81 | + /** |
|
| 82 | + * List Deployment Statuses |
|
| 83 | + * |
|
| 84 | + * @link https://developer.github.com/v3/repos/deployments/#list-deployment-statuses |
|
| 85 | + * |
|
| 86 | + * @param int $id |
|
| 87 | + * |
|
| 88 | + * @return array |
|
| 89 | + */ |
|
| 90 | + public function listDeploymentStatus(int $id): array |
|
| 91 | + { |
|
| 92 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 93 | + '/repos/:owner/:repo/deployments/:id/statuses', |
|
| 94 | + $this->getRepositories()->getOwner(), |
|
| 95 | + $this->getRepositories()->getRepo(), |
|
| 96 | + $id |
|
| 97 | + )); |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * Create a Deployment Status |
|
| 102 | - * |
|
| 103 | - * @link https://developer.github.com/v3/repos/deployments/#create-a-deployment-status |
|
| 104 | - * |
|
| 105 | - * @param int $id |
|
| 106 | - * @param string $state |
|
| 107 | - * @param string $targetUrl |
|
| 108 | - * @param string $description |
|
| 109 | - * |
|
| 110 | - * @return array |
|
| 111 | - */ |
|
| 112 | - public function createDeploymentStatus( |
|
| 113 | - int $id, |
|
| 114 | - string $state, |
|
| 115 | - string $targetUrl = '', |
|
| 116 | - string $description = '' |
|
| 117 | - ): array { |
|
| 118 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 119 | - '/repos/:owner/:repo/deployments/:id/statuses', |
|
| 120 | - $this->getRepositories()->getOwner(), |
|
| 121 | - $this->getRepositories()->getRepo(), |
|
| 122 | - $id |
|
| 123 | - ), Request::METHOD_POST, [ |
|
| 124 | - 'state' => $state, |
|
| 125 | - 'target_url' => $targetUrl, |
|
| 126 | - 'description' => $description |
|
| 127 | - ]); |
|
| 128 | - } |
|
| 100 | + /** |
|
| 101 | + * Create a Deployment Status |
|
| 102 | + * |
|
| 103 | + * @link https://developer.github.com/v3/repos/deployments/#create-a-deployment-status |
|
| 104 | + * |
|
| 105 | + * @param int $id |
|
| 106 | + * @param string $state |
|
| 107 | + * @param string $targetUrl |
|
| 108 | + * @param string $description |
|
| 109 | + * |
|
| 110 | + * @return array |
|
| 111 | + */ |
|
| 112 | + public function createDeploymentStatus( |
|
| 113 | + int $id, |
|
| 114 | + string $state, |
|
| 115 | + string $targetUrl = '', |
|
| 116 | + string $description = '' |
|
| 117 | + ): array { |
|
| 118 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 119 | + '/repos/:owner/:repo/deployments/:id/statuses', |
|
| 120 | + $this->getRepositories()->getOwner(), |
|
| 121 | + $this->getRepositories()->getRepo(), |
|
| 122 | + $id |
|
| 123 | + ), Request::METHOD_POST, [ |
|
| 124 | + 'state' => $state, |
|
| 125 | + 'target_url' => $targetUrl, |
|
| 126 | + 'description' => $description |
|
| 127 | + ]); |
|
| 128 | + } |
|
| 129 | 129 | } |
@@ -13,154 +13,154 @@ |
||
| 13 | 13 | class Contents extends AbstractRepositories |
| 14 | 14 | { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * Get the README |
|
| 18 | - * |
|
| 19 | - * @link https://developer.github.com/v3/repos/contents/#get-the-readme |
|
| 20 | - * @return array |
|
| 21 | - */ |
|
| 22 | - public function getReadme(): array |
|
| 23 | - { |
|
| 24 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 25 | - '/repos/:owner/:repo/readme', |
|
| 26 | - $this->getRepositories()->getOwner(), |
|
| 27 | - $this->getRepositories()->getRepo() |
|
| 28 | - )); |
|
| 29 | - } |
|
| 16 | + /** |
|
| 17 | + * Get the README |
|
| 18 | + * |
|
| 19 | + * @link https://developer.github.com/v3/repos/contents/#get-the-readme |
|
| 20 | + * @return array |
|
| 21 | + */ |
|
| 22 | + public function getReadme(): array |
|
| 23 | + { |
|
| 24 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 25 | + '/repos/:owner/:repo/readme', |
|
| 26 | + $this->getRepositories()->getOwner(), |
|
| 27 | + $this->getRepositories()->getRepo() |
|
| 28 | + )); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * This method returns the contents of a file or directory in a repository. |
|
| 33 | - * |
|
| 34 | - * @link https://developer.github.com/v3/repos/contents/#get-contents |
|
| 35 | - * |
|
| 36 | - * @param string $path |
|
| 37 | - * @param string $ref |
|
| 38 | - * |
|
| 39 | - * @return array |
|
| 40 | - */ |
|
| 41 | - public function getContents(string $path = '', string $ref = AbstractApi::BRANCH_MASTER): array |
|
| 42 | - { |
|
| 43 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 44 | - '/repos/:owner/:repo/contents/:path?:args', |
|
| 45 | - $this->getRepositories()->getOwner(), |
|
| 46 | - $this->getRepositories()->getRepo(), |
|
| 47 | - $path, |
|
| 48 | - http_build_query(['ref' => $ref]) |
|
| 49 | - )); |
|
| 50 | - } |
|
| 31 | + /** |
|
| 32 | + * This method returns the contents of a file or directory in a repository. |
|
| 33 | + * |
|
| 34 | + * @link https://developer.github.com/v3/repos/contents/#get-contents |
|
| 35 | + * |
|
| 36 | + * @param string $path |
|
| 37 | + * @param string $ref |
|
| 38 | + * |
|
| 39 | + * @return array |
|
| 40 | + */ |
|
| 41 | + public function getContents(string $path = '', string $ref = AbstractApi::BRANCH_MASTER): array |
|
| 42 | + { |
|
| 43 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 44 | + '/repos/:owner/:repo/contents/:path?:args', |
|
| 45 | + $this->getRepositories()->getOwner(), |
|
| 46 | + $this->getRepositories()->getRepo(), |
|
| 47 | + $path, |
|
| 48 | + http_build_query(['ref' => $ref]) |
|
| 49 | + )); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Create a file |
|
| 54 | - * |
|
| 55 | - * @link https://developer.github.com/v3/repos/contents/#create-a-file |
|
| 56 | - * |
|
| 57 | - * @param string $path |
|
| 58 | - * @param string $message |
|
| 59 | - * @param string $content |
|
| 60 | - * @param string $branch |
|
| 61 | - * |
|
| 62 | - * @return array |
|
| 63 | - */ |
|
| 64 | - public function createFile( |
|
| 65 | - string $path, |
|
| 66 | - string $message, |
|
| 67 | - string $content, |
|
| 68 | - string $branch = AbstractApi::BRANCH_MASTER |
|
| 69 | - ): array { |
|
| 70 | - return $this->getApi()->request( |
|
| 71 | - $this->getApi()->sprintf( |
|
| 72 | - '/repos/:owner/:repo/contents/:path?:args', |
|
| 73 | - $this->getRepositories()->getOwner(), |
|
| 74 | - $this->getRepositories()->getRepo(), |
|
| 75 | - $path, |
|
| 76 | - http_build_query(['message' => $message, 'content' => $content, 'branch' => $branch]) |
|
| 77 | - ), |
|
| 78 | - Request::METHOD_PUT |
|
| 79 | - ); |
|
| 80 | - } |
|
| 52 | + /** |
|
| 53 | + * Create a file |
|
| 54 | + * |
|
| 55 | + * @link https://developer.github.com/v3/repos/contents/#create-a-file |
|
| 56 | + * |
|
| 57 | + * @param string $path |
|
| 58 | + * @param string $message |
|
| 59 | + * @param string $content |
|
| 60 | + * @param string $branch |
|
| 61 | + * |
|
| 62 | + * @return array |
|
| 63 | + */ |
|
| 64 | + public function createFile( |
|
| 65 | + string $path, |
|
| 66 | + string $message, |
|
| 67 | + string $content, |
|
| 68 | + string $branch = AbstractApi::BRANCH_MASTER |
|
| 69 | + ): array { |
|
| 70 | + return $this->getApi()->request( |
|
| 71 | + $this->getApi()->sprintf( |
|
| 72 | + '/repos/:owner/:repo/contents/:path?:args', |
|
| 73 | + $this->getRepositories()->getOwner(), |
|
| 74 | + $this->getRepositories()->getRepo(), |
|
| 75 | + $path, |
|
| 76 | + http_build_query(['message' => $message, 'content' => $content, 'branch' => $branch]) |
|
| 77 | + ), |
|
| 78 | + Request::METHOD_PUT |
|
| 79 | + ); |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * Update a file |
|
| 84 | - * |
|
| 85 | - * @link https://developer.github.com/v3/repos/contents/#update-a-file |
|
| 86 | - * |
|
| 87 | - * @param string $path |
|
| 88 | - * @param string $message |
|
| 89 | - * @param string $content |
|
| 90 | - * @param string $sha |
|
| 91 | - * @param string $branch |
|
| 92 | - * |
|
| 93 | - * @return array |
|
| 94 | - */ |
|
| 95 | - public function updateFile( |
|
| 96 | - string $path, |
|
| 97 | - string $message, |
|
| 98 | - string $content, |
|
| 99 | - string $sha, |
|
| 100 | - string $branch = AbstractApi::BRANCH_MASTER |
|
| 101 | - ): array { |
|
| 102 | - return $this->getApi()->request( |
|
| 103 | - $this->getApi()->sprintf( |
|
| 104 | - '/repos/:owner/:repo/contents/:path?:args', |
|
| 105 | - $this->getRepositories()->getOwner(), |
|
| 106 | - $this->getRepositories()->getRepo(), |
|
| 107 | - $path, |
|
| 108 | - http_build_query(['message' => $message, 'content' => $content, 'sha' => $sha, 'branch' => $branch]) |
|
| 109 | - ), |
|
| 110 | - Request::METHOD_PUT |
|
| 111 | - ); |
|
| 112 | - } |
|
| 82 | + /** |
|
| 83 | + * Update a file |
|
| 84 | + * |
|
| 85 | + * @link https://developer.github.com/v3/repos/contents/#update-a-file |
|
| 86 | + * |
|
| 87 | + * @param string $path |
|
| 88 | + * @param string $message |
|
| 89 | + * @param string $content |
|
| 90 | + * @param string $sha |
|
| 91 | + * @param string $branch |
|
| 92 | + * |
|
| 93 | + * @return array |
|
| 94 | + */ |
|
| 95 | + public function updateFile( |
|
| 96 | + string $path, |
|
| 97 | + string $message, |
|
| 98 | + string $content, |
|
| 99 | + string $sha, |
|
| 100 | + string $branch = AbstractApi::BRANCH_MASTER |
|
| 101 | + ): array { |
|
| 102 | + return $this->getApi()->request( |
|
| 103 | + $this->getApi()->sprintf( |
|
| 104 | + '/repos/:owner/:repo/contents/:path?:args', |
|
| 105 | + $this->getRepositories()->getOwner(), |
|
| 106 | + $this->getRepositories()->getRepo(), |
|
| 107 | + $path, |
|
| 108 | + http_build_query(['message' => $message, 'content' => $content, 'sha' => $sha, 'branch' => $branch]) |
|
| 109 | + ), |
|
| 110 | + Request::METHOD_PUT |
|
| 111 | + ); |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - /** |
|
| 115 | - * Delete a file |
|
| 116 | - * |
|
| 117 | - * @link https://developer.github.com/v3/repos/contents/#delete-a-file |
|
| 118 | - * |
|
| 119 | - * @param string $path |
|
| 120 | - * @param string $message |
|
| 121 | - * @param string $sha |
|
| 122 | - * @param string $branch |
|
| 123 | - * |
|
| 124 | - * @return array |
|
| 125 | - */ |
|
| 126 | - public function deleteFile( |
|
| 127 | - string $path, |
|
| 128 | - string $message, |
|
| 129 | - string $sha, |
|
| 130 | - string $branch = AbstractApi::BRANCH_MASTER |
|
| 131 | - ): array { |
|
| 132 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 133 | - '/repos/:owner/:repo/contents/:path', |
|
| 134 | - $this->getRepositories()->getOwner(), |
|
| 135 | - $this->getRepositories()->getRepo(), |
|
| 136 | - $path |
|
| 137 | - ), Request::METHOD_DELETE, [ |
|
| 138 | - 'message' => $message, |
|
| 139 | - 'sha' => $sha, |
|
| 140 | - 'branch' => $branch |
|
| 141 | - ]); |
|
| 142 | - } |
|
| 114 | + /** |
|
| 115 | + * Delete a file |
|
| 116 | + * |
|
| 117 | + * @link https://developer.github.com/v3/repos/contents/#delete-a-file |
|
| 118 | + * |
|
| 119 | + * @param string $path |
|
| 120 | + * @param string $message |
|
| 121 | + * @param string $sha |
|
| 122 | + * @param string $branch |
|
| 123 | + * |
|
| 124 | + * @return array |
|
| 125 | + */ |
|
| 126 | + public function deleteFile( |
|
| 127 | + string $path, |
|
| 128 | + string $message, |
|
| 129 | + string $sha, |
|
| 130 | + string $branch = AbstractApi::BRANCH_MASTER |
|
| 131 | + ): array { |
|
| 132 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 133 | + '/repos/:owner/:repo/contents/:path', |
|
| 134 | + $this->getRepositories()->getOwner(), |
|
| 135 | + $this->getRepositories()->getRepo(), |
|
| 136 | + $path |
|
| 137 | + ), Request::METHOD_DELETE, [ |
|
| 138 | + 'message' => $message, |
|
| 139 | + 'sha' => $sha, |
|
| 140 | + 'branch' => $branch |
|
| 141 | + ]); |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - /** |
|
| 145 | - * Get archive link |
|
| 146 | - * |
|
| 147 | - * @link https://developer.github.com/v3/repos/contents/#get-archive-link |
|
| 148 | - * |
|
| 149 | - * @param string $archiveFormat |
|
| 150 | - * @param string $ref |
|
| 151 | - * |
|
| 152 | - * @return array |
|
| 153 | - */ |
|
| 154 | - public function getArchiveLink( |
|
| 155 | - string $archiveFormat = AbstractApi::ARCHIVE_TARBALL, |
|
| 156 | - string $ref = AbstractApi::BRANCH_MASTER |
|
| 157 | - ): array { |
|
| 158 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 159 | - '/repos/:owner/:repo/:archive_format/:ref', |
|
| 160 | - $this->getRepositories()->getOwner(), |
|
| 161 | - $this->getRepositories()->getRepo(), |
|
| 162 | - $archiveFormat, |
|
| 163 | - $ref |
|
| 164 | - )); |
|
| 165 | - } |
|
| 144 | + /** |
|
| 145 | + * Get archive link |
|
| 146 | + * |
|
| 147 | + * @link https://developer.github.com/v3/repos/contents/#get-archive-link |
|
| 148 | + * |
|
| 149 | + * @param string $archiveFormat |
|
| 150 | + * @param string $ref |
|
| 151 | + * |
|
| 152 | + * @return array |
|
| 153 | + */ |
|
| 154 | + public function getArchiveLink( |
|
| 155 | + string $archiveFormat = AbstractApi::ARCHIVE_TARBALL, |
|
| 156 | + string $ref = AbstractApi::BRANCH_MASTER |
|
| 157 | + ): array { |
|
| 158 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 159 | + '/repos/:owner/:repo/:archive_format/:ref', |
|
| 160 | + $this->getRepositories()->getOwner(), |
|
| 161 | + $this->getRepositories()->getRepo(), |
|
| 162 | + $archiveFormat, |
|
| 163 | + $ref |
|
| 164 | + )); |
|
| 165 | + } |
|
| 166 | 166 | } |
@@ -12,84 +12,84 @@ |
||
| 12 | 12 | class Collaborators extends AbstractRepositories |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * List collaborators |
|
| 17 | - * |
|
| 18 | - * @link https://developer.github.com/v3/repos/collaborators/#list |
|
| 19 | - * @return array |
|
| 20 | - */ |
|
| 21 | - public function listCollaborators(): array |
|
| 22 | - { |
|
| 23 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 24 | - '/repos/:owner/:repo/collaborators', |
|
| 25 | - $this->getRepositories()->getOwner(), |
|
| 26 | - $this->getRepositories()->getRepo() |
|
| 27 | - )); |
|
| 28 | - } |
|
| 15 | + /** |
|
| 16 | + * List collaborators |
|
| 17 | + * |
|
| 18 | + * @link https://developer.github.com/v3/repos/collaborators/#list |
|
| 19 | + * @return array |
|
| 20 | + */ |
|
| 21 | + public function listCollaborators(): array |
|
| 22 | + { |
|
| 23 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 24 | + '/repos/:owner/:repo/collaborators', |
|
| 25 | + $this->getRepositories()->getOwner(), |
|
| 26 | + $this->getRepositories()->getRepo() |
|
| 27 | + )); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Check if a user is a collaborator |
|
| 32 | - * |
|
| 33 | - * @link https://developer.github.com/v3/repos/collaborators/#get |
|
| 34 | - * |
|
| 35 | - * @param string $username |
|
| 36 | - * |
|
| 37 | - * @return bool |
|
| 38 | - */ |
|
| 39 | - public function checkUserIsACollaborator(string $username): bool |
|
| 40 | - { |
|
| 41 | - $this->getApi()->request($this->getApi()->sprintf( |
|
| 42 | - '/repos/:owner/:repo/collaborators/:username', |
|
| 43 | - $this->getRepositories()->getOwner(), |
|
| 44 | - $this->getRepositories()->getRepo(), |
|
| 45 | - $username |
|
| 46 | - )); |
|
| 30 | + /** |
|
| 31 | + * Check if a user is a collaborator |
|
| 32 | + * |
|
| 33 | + * @link https://developer.github.com/v3/repos/collaborators/#get |
|
| 34 | + * |
|
| 35 | + * @param string $username |
|
| 36 | + * |
|
| 37 | + * @return bool |
|
| 38 | + */ |
|
| 39 | + public function checkUserIsACollaborator(string $username): bool |
|
| 40 | + { |
|
| 41 | + $this->getApi()->request($this->getApi()->sprintf( |
|
| 42 | + '/repos/:owner/:repo/collaborators/:username', |
|
| 43 | + $this->getRepositories()->getOwner(), |
|
| 44 | + $this->getRepositories()->getRepo(), |
|
| 45 | + $username |
|
| 46 | + )); |
|
| 47 | 47 | |
| 48 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 49 | - return true; |
|
| 50 | - } |
|
| 48 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 49 | + return true; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - return false; |
|
| 53 | - } |
|
| 52 | + return false; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Add user as a collaborator |
|
| 57 | - * |
|
| 58 | - * @link https://developer.github.com/v3/repos/collaborators/#add-collaborator |
|
| 59 | - * |
|
| 60 | - * @param string $username |
|
| 61 | - * |
|
| 62 | - * @return array |
|
| 63 | - */ |
|
| 64 | - public function addUserAsCollaborator(string $username): array |
|
| 65 | - { |
|
| 66 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 67 | - '/repos/:owner/:repo/collaborators/:username', |
|
| 68 | - $this->getRepositories()->getOwner(), |
|
| 69 | - $this->getRepositories()->getRepo(), |
|
| 70 | - $username |
|
| 71 | - ), Request::METHOD_PUT); |
|
| 72 | - } |
|
| 55 | + /** |
|
| 56 | + * Add user as a collaborator |
|
| 57 | + * |
|
| 58 | + * @link https://developer.github.com/v3/repos/collaborators/#add-collaborator |
|
| 59 | + * |
|
| 60 | + * @param string $username |
|
| 61 | + * |
|
| 62 | + * @return array |
|
| 63 | + */ |
|
| 64 | + public function addUserAsCollaborator(string $username): array |
|
| 65 | + { |
|
| 66 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 67 | + '/repos/:owner/:repo/collaborators/:username', |
|
| 68 | + $this->getRepositories()->getOwner(), |
|
| 69 | + $this->getRepositories()->getRepo(), |
|
| 70 | + $username |
|
| 71 | + ), Request::METHOD_PUT); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Remove user as a collaborator |
|
| 76 | - * |
|
| 77 | - * @link https://developer.github.com/v3/repos/collaborators/#remove-collaborator |
|
| 78 | - * |
|
| 79 | - * @param string $username |
|
| 80 | - * |
|
| 81 | - * @return array |
|
| 82 | - */ |
|
| 83 | - public function removeUserAsCollaborator(string $username): array |
|
| 84 | - { |
|
| 85 | - return $this->getApi()->request( |
|
| 86 | - $this->getApi()->sprintf( |
|
| 87 | - '/repos/:owner/:repo/collaborators/:username', |
|
| 88 | - $this->getRepositories()->getOwner(), |
|
| 89 | - $this->getRepositories()->getRepo(), |
|
| 90 | - $username |
|
| 91 | - ), |
|
| 92 | - Request::METHOD_DELETE |
|
| 93 | - ); |
|
| 94 | - } |
|
| 74 | + /** |
|
| 75 | + * Remove user as a collaborator |
|
| 76 | + * |
|
| 77 | + * @link https://developer.github.com/v3/repos/collaborators/#remove-collaborator |
|
| 78 | + * |
|
| 79 | + * @param string $username |
|
| 80 | + * |
|
| 81 | + * @return array |
|
| 82 | + */ |
|
| 83 | + public function removeUserAsCollaborator(string $username): array |
|
| 84 | + { |
|
| 85 | + return $this->getApi()->request( |
|
| 86 | + $this->getApi()->sprintf( |
|
| 87 | + '/repos/:owner/:repo/collaborators/:username', |
|
| 88 | + $this->getRepositories()->getOwner(), |
|
| 89 | + $this->getRepositories()->getRepo(), |
|
| 90 | + $username |
|
| 91 | + ), |
|
| 92 | + Request::METHOD_DELETE |
|
| 93 | + ); |
|
| 94 | + } |
|
| 95 | 95 | } |
@@ -12,44 +12,44 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | abstract class AbstractRepositories |
| 14 | 14 | { |
| 15 | - /** Api trait */ |
|
| 16 | - use Api; |
|
| 15 | + /** Api trait */ |
|
| 16 | + use Api; |
|
| 17 | 17 | |
| 18 | - /** Properties */ |
|
| 19 | - protected $repositories; |
|
| 18 | + /** Properties */ |
|
| 19 | + protected $repositories; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Constructor |
|
| 23 | - * |
|
| 24 | - * @param Repositories $repositories |
|
| 25 | - */ |
|
| 26 | - public function __construct(Repositories $repositories) |
|
| 27 | - { |
|
| 28 | - $this->setRepositories($repositories); |
|
| 29 | - $this->setApi($repositories->getApi()); |
|
| 30 | - } |
|
| 21 | + /** |
|
| 22 | + * Constructor |
|
| 23 | + * |
|
| 24 | + * @param Repositories $repositories |
|
| 25 | + */ |
|
| 26 | + public function __construct(Repositories $repositories) |
|
| 27 | + { |
|
| 28 | + $this->setRepositories($repositories); |
|
| 29 | + $this->setApi($repositories->getApi()); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Get repositories |
|
| 34 | - * |
|
| 35 | - * @return Repositories |
|
| 36 | - */ |
|
| 37 | - public function getRepositories(): Repositories |
|
| 38 | - { |
|
| 39 | - return $this->repositories; |
|
| 40 | - } |
|
| 32 | + /** |
|
| 33 | + * Get repositories |
|
| 34 | + * |
|
| 35 | + * @return Repositories |
|
| 36 | + */ |
|
| 37 | + public function getRepositories(): Repositories |
|
| 38 | + { |
|
| 39 | + return $this->repositories; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Set repositories |
|
| 44 | - * |
|
| 45 | - * @param Repositories $repositories |
|
| 46 | - * |
|
| 47 | - * @return AbstractRepositories |
|
| 48 | - */ |
|
| 49 | - public function setRepositories(Repositories $repositories): AbstractRepositories |
|
| 50 | - { |
|
| 51 | - $this->repositories = $repositories; |
|
| 42 | + /** |
|
| 43 | + * Set repositories |
|
| 44 | + * |
|
| 45 | + * @param Repositories $repositories |
|
| 46 | + * |
|
| 47 | + * @return AbstractRepositories |
|
| 48 | + */ |
|
| 49 | + public function setRepositories(Repositories $repositories): AbstractRepositories |
|
| 50 | + { |
|
| 51 | + $this->repositories = $repositories; |
|
| 52 | 52 | |
| 53 | - return $this; |
|
| 54 | - } |
|
| 53 | + return $this; |
|
| 54 | + } |
|
| 55 | 55 | } |
@@ -12,131 +12,131 @@ |
||
| 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( |
|
| 24 | - '/repos/:owner/:repo/comments', |
|
| 25 | - $this->getRepositories()->getOwner(), |
|
| 26 | - $this->getRepositories()->getRepo() |
|
| 27 | - )); |
|
| 28 | - } |
|
| 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( |
|
| 24 | + '/repos/:owner/:repo/comments', |
|
| 25 | + $this->getRepositories()->getOwner(), |
|
| 26 | + $this->getRepositories()->getRepo() |
|
| 27 | + )); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * List comments for a single commit |
|
| 32 | - * |
|
| 33 | - * @link https://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit |
|
| 34 | - * |
|
| 35 | - * @param string $ref |
|
| 36 | - * |
|
| 37 | - * @return array |
|
| 38 | - */ |
|
| 39 | - public function listCommitComments(string $ref): array |
|
| 40 | - { |
|
| 41 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 42 | - '/repos/:owner/:repo/commits/:ref/comments', |
|
| 43 | - $this->getRepositories()->getOwner(), |
|
| 44 | - $this->getRepositories()->getRepo(), |
|
| 45 | - $ref |
|
| 46 | - )); |
|
| 47 | - } |
|
| 30 | + /** |
|
| 31 | + * List comments for a single commit |
|
| 32 | + * |
|
| 33 | + * @link https://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit |
|
| 34 | + * |
|
| 35 | + * @param string $ref |
|
| 36 | + * |
|
| 37 | + * @return array |
|
| 38 | + */ |
|
| 39 | + public function listCommitComments(string $ref): array |
|
| 40 | + { |
|
| 41 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 42 | + '/repos/:owner/:repo/commits/:ref/comments', |
|
| 43 | + $this->getRepositories()->getOwner(), |
|
| 44 | + $this->getRepositories()->getRepo(), |
|
| 45 | + $ref |
|
| 46 | + )); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * Create a commit comment |
|
| 51 | - * |
|
| 52 | - * @link https://developer.github.com/v3/repos/comments/#create-a-commit-comment |
|
| 53 | - * |
|
| 54 | - * @param string $sha |
|
| 55 | - * @param string $body |
|
| 56 | - * @param string $path |
|
| 57 | - * @param int $position |
|
| 58 | - * |
|
| 59 | - * @return array |
|
| 60 | - */ |
|
| 61 | - public function addCommitComment(string $sha, string $body, string $path = '', int $position = 0): array |
|
| 62 | - { |
|
| 63 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 64 | - '/repos/:owner/:repo/commits/:sha/comments', |
|
| 65 | - $this->getRepositories()->getOwner(), |
|
| 66 | - $this->getRepositories()->getRepo(), |
|
| 67 | - $sha |
|
| 68 | - ), Request::METHOD_POST, [ |
|
| 69 | - 'body' => $body, |
|
| 70 | - 'path' => $path, |
|
| 71 | - 'position' => $position |
|
| 72 | - ]); |
|
| 73 | - } |
|
| 49 | + /** |
|
| 50 | + * Create a commit comment |
|
| 51 | + * |
|
| 52 | + * @link https://developer.github.com/v3/repos/comments/#create-a-commit-comment |
|
| 53 | + * |
|
| 54 | + * @param string $sha |
|
| 55 | + * @param string $body |
|
| 56 | + * @param string $path |
|
| 57 | + * @param int $position |
|
| 58 | + * |
|
| 59 | + * @return array |
|
| 60 | + */ |
|
| 61 | + public function addCommitComment(string $sha, string $body, string $path = '', int $position = 0): array |
|
| 62 | + { |
|
| 63 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 64 | + '/repos/:owner/:repo/commits/:sha/comments', |
|
| 65 | + $this->getRepositories()->getOwner(), |
|
| 66 | + $this->getRepositories()->getRepo(), |
|
| 67 | + $sha |
|
| 68 | + ), Request::METHOD_POST, [ |
|
| 69 | + 'body' => $body, |
|
| 70 | + 'path' => $path, |
|
| 71 | + 'position' => $position |
|
| 72 | + ]); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * Get a single commit comment |
|
| 77 | - * |
|
| 78 | - * @link https://developer.github.com/v3/repos/comments/#get-a-single-commit-comment |
|
| 79 | - * |
|
| 80 | - * @param int $id |
|
| 81 | - * |
|
| 82 | - * @return array |
|
| 83 | - */ |
|
| 84 | - public function getCommitComment(int $id): array |
|
| 85 | - { |
|
| 86 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 87 | - '/repos/:owner/:repo/comments/:id', |
|
| 88 | - $this->getRepositories()->getOwner(), |
|
| 89 | - $this->getRepositories()->getRepo(), |
|
| 90 | - (string)$id |
|
| 91 | - )); |
|
| 92 | - } |
|
| 75 | + /** |
|
| 76 | + * Get a single commit comment |
|
| 77 | + * |
|
| 78 | + * @link https://developer.github.com/v3/repos/comments/#get-a-single-commit-comment |
|
| 79 | + * |
|
| 80 | + * @param int $id |
|
| 81 | + * |
|
| 82 | + * @return array |
|
| 83 | + */ |
|
| 84 | + public function getCommitComment(int $id): array |
|
| 85 | + { |
|
| 86 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 87 | + '/repos/:owner/:repo/comments/:id', |
|
| 88 | + $this->getRepositories()->getOwner(), |
|
| 89 | + $this->getRepositories()->getRepo(), |
|
| 90 | + (string)$id |
|
| 91 | + )); |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * Update a commit comment |
|
| 96 | - * |
|
| 97 | - * @link https://developer.github.com/v3/repos/comments/#update-a-commit-comment |
|
| 98 | - * |
|
| 99 | - * @param int $id |
|
| 100 | - * @param string $body |
|
| 101 | - * |
|
| 102 | - * @return array |
|
| 103 | - * @throws \Exception |
|
| 104 | - */ |
|
| 105 | - public function updateCommitComment(int $id, string $body): array |
|
| 106 | - { |
|
| 107 | - return $this->getApi()->request( |
|
| 108 | - $this->getApi()->sprintf( |
|
| 109 | - '/repos/:owner/:repo/comments/:id', |
|
| 110 | - $this->getRepositories()->getOwner(), |
|
| 111 | - $this->getRepositories()->getRepo(), |
|
| 112 | - (string)$id |
|
| 113 | - ), |
|
| 114 | - Request::METHOD_PATCH, |
|
| 115 | - [ |
|
| 116 | - 'body' => $body |
|
| 117 | - ] |
|
| 118 | - ); |
|
| 119 | - } |
|
| 94 | + /** |
|
| 95 | + * Update a commit comment |
|
| 96 | + * |
|
| 97 | + * @link https://developer.github.com/v3/repos/comments/#update-a-commit-comment |
|
| 98 | + * |
|
| 99 | + * @param int $id |
|
| 100 | + * @param string $body |
|
| 101 | + * |
|
| 102 | + * @return array |
|
| 103 | + * @throws \Exception |
|
| 104 | + */ |
|
| 105 | + public function updateCommitComment(int $id, string $body): array |
|
| 106 | + { |
|
| 107 | + return $this->getApi()->request( |
|
| 108 | + $this->getApi()->sprintf( |
|
| 109 | + '/repos/:owner/:repo/comments/:id', |
|
| 110 | + $this->getRepositories()->getOwner(), |
|
| 111 | + $this->getRepositories()->getRepo(), |
|
| 112 | + (string)$id |
|
| 113 | + ), |
|
| 114 | + Request::METHOD_PATCH, |
|
| 115 | + [ |
|
| 116 | + 'body' => $body |
|
| 117 | + ] |
|
| 118 | + ); |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - /** |
|
| 122 | - * Delete a commit comment |
|
| 123 | - * |
|
| 124 | - * @link https://developer.github.com/v3/repos/comments/#delete-a-commit-comment |
|
| 125 | - * |
|
| 126 | - * @param int $id |
|
| 127 | - * |
|
| 128 | - * @return array |
|
| 129 | - */ |
|
| 130 | - public function deleteCommitComment(int $id): array |
|
| 131 | - { |
|
| 132 | - return $this->getApi()->request( |
|
| 133 | - $this->getApi()->sprintf( |
|
| 134 | - '/repos/:owner/:repo/comments/:id', |
|
| 135 | - $this->getRepositories()->getOwner(), |
|
| 136 | - $this->getRepositories()->getRepo(), |
|
| 137 | - (string)$id |
|
| 138 | - ), |
|
| 139 | - Request::METHOD_DELETE |
|
| 140 | - ); |
|
| 141 | - } |
|
| 121 | + /** |
|
| 122 | + * Delete a commit comment |
|
| 123 | + * |
|
| 124 | + * @link https://developer.github.com/v3/repos/comments/#delete-a-commit-comment |
|
| 125 | + * |
|
| 126 | + * @param int $id |
|
| 127 | + * |
|
| 128 | + * @return array |
|
| 129 | + */ |
|
| 130 | + public function deleteCommitComment(int $id): array |
|
| 131 | + { |
|
| 132 | + return $this->getApi()->request( |
|
| 133 | + $this->getApi()->sprintf( |
|
| 134 | + '/repos/:owner/:repo/comments/:id', |
|
| 135 | + $this->getRepositories()->getOwner(), |
|
| 136 | + $this->getRepositories()->getRepo(), |
|
| 137 | + (string)$id |
|
| 138 | + ), |
|
| 139 | + Request::METHOD_DELETE |
|
| 140 | + ); |
|
| 141 | + } |
|
| 142 | 142 | } |