@@ -13,115 +13,115 @@ |
||
| 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('/repos/:owner/:repo/readme', |
|
| 25 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 26 | - } |
|
| 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('/repos/:owner/:repo/readme', |
|
| 25 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * This method returns the contents of a file or directory in a repository. |
|
| 30 | - * |
|
| 31 | - * @link https://developer.github.com/v3/repos/contents/#get-contents |
|
| 32 | - * |
|
| 33 | - * @param string $path |
|
| 34 | - * @param string $ref |
|
| 35 | - * |
|
| 36 | - * @return array |
|
| 37 | - */ |
|
| 38 | - public function getContents(string $path = '', string $ref = AbstractApi::BRANCH_MASTER): array |
|
| 39 | - { |
|
| 40 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/contents/:path?:args', |
|
| 41 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $path, |
|
| 42 | - http_build_query(['ref' => $ref]))); |
|
| 43 | - } |
|
| 28 | + /** |
|
| 29 | + * This method returns the contents of a file or directory in a repository. |
|
| 30 | + * |
|
| 31 | + * @link https://developer.github.com/v3/repos/contents/#get-contents |
|
| 32 | + * |
|
| 33 | + * @param string $path |
|
| 34 | + * @param string $ref |
|
| 35 | + * |
|
| 36 | + * @return array |
|
| 37 | + */ |
|
| 38 | + public function getContents(string $path = '', string $ref = AbstractApi::BRANCH_MASTER): array |
|
| 39 | + { |
|
| 40 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/contents/:path?:args', |
|
| 41 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $path, |
|
| 42 | + http_build_query(['ref' => $ref]))); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Create a file |
|
| 47 | - * |
|
| 48 | - * @link https://developer.github.com/v3/repos/contents/#create-a-file |
|
| 49 | - * |
|
| 50 | - * @param string $path |
|
| 51 | - * @param string $message |
|
| 52 | - * @param string $content |
|
| 53 | - * @param string $branch |
|
| 54 | - * |
|
| 55 | - * @return array |
|
| 56 | - */ |
|
| 57 | - public function createFile(string $path, string $message, string $content, |
|
| 58 | - string $branch = AbstractApi::BRANCH_MASTER): array |
|
| 59 | - { |
|
| 60 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/contents/:path?:args', |
|
| 61 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $path, |
|
| 62 | - http_build_query(['message' => $message, 'content' => $content, 'branch' => $branch])), |
|
| 63 | - Request::METHOD_PUT); |
|
| 64 | - } |
|
| 45 | + /** |
|
| 46 | + * Create a file |
|
| 47 | + * |
|
| 48 | + * @link https://developer.github.com/v3/repos/contents/#create-a-file |
|
| 49 | + * |
|
| 50 | + * @param string $path |
|
| 51 | + * @param string $message |
|
| 52 | + * @param string $content |
|
| 53 | + * @param string $branch |
|
| 54 | + * |
|
| 55 | + * @return array |
|
| 56 | + */ |
|
| 57 | + public function createFile(string $path, string $message, string $content, |
|
| 58 | + string $branch = AbstractApi::BRANCH_MASTER): array |
|
| 59 | + { |
|
| 60 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/contents/:path?:args', |
|
| 61 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $path, |
|
| 62 | + http_build_query(['message' => $message, 'content' => $content, 'branch' => $branch])), |
|
| 63 | + Request::METHOD_PUT); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Update a file |
|
| 68 | - * |
|
| 69 | - * @link https://developer.github.com/v3/repos/contents/#update-a-file |
|
| 70 | - * |
|
| 71 | - * @param string $path |
|
| 72 | - * @param string $message |
|
| 73 | - * @param string $content |
|
| 74 | - * @param string $sha |
|
| 75 | - * @param string $branch |
|
| 76 | - * |
|
| 77 | - * @return array |
|
| 78 | - */ |
|
| 79 | - public function updateFile(string $path, string $message, string $content, string $sha, |
|
| 80 | - string $branch = AbstractApi::BRANCH_MASTER): array |
|
| 81 | - { |
|
| 82 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/contents/:path?:args', |
|
| 83 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $path, |
|
| 84 | - http_build_query(['message' => $message, 'content' => $content, 'sha' => $sha, 'branch' => $branch])), |
|
| 85 | - Request::METHOD_PUT); |
|
| 86 | - } |
|
| 66 | + /** |
|
| 67 | + * Update a file |
|
| 68 | + * |
|
| 69 | + * @link https://developer.github.com/v3/repos/contents/#update-a-file |
|
| 70 | + * |
|
| 71 | + * @param string $path |
|
| 72 | + * @param string $message |
|
| 73 | + * @param string $content |
|
| 74 | + * @param string $sha |
|
| 75 | + * @param string $branch |
|
| 76 | + * |
|
| 77 | + * @return array |
|
| 78 | + */ |
|
| 79 | + public function updateFile(string $path, string $message, string $content, string $sha, |
|
| 80 | + string $branch = AbstractApi::BRANCH_MASTER): array |
|
| 81 | + { |
|
| 82 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/contents/:path?:args', |
|
| 83 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $path, |
|
| 84 | + http_build_query(['message' => $message, 'content' => $content, 'sha' => $sha, 'branch' => $branch])), |
|
| 85 | + Request::METHOD_PUT); |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - /** |
|
| 89 | - * Delete a file |
|
| 90 | - * |
|
| 91 | - * @link https://developer.github.com/v3/repos/contents/#delete-a-file |
|
| 92 | - * |
|
| 93 | - * @param string $path |
|
| 94 | - * @param string $message |
|
| 95 | - * @param string $sha |
|
| 96 | - * @param string $branch |
|
| 97 | - * |
|
| 98 | - * @return array |
|
| 99 | - */ |
|
| 100 | - public function deleteFile(string $path, string $message, string $sha, |
|
| 101 | - string $branch = AbstractApi::BRANCH_MASTER): array |
|
| 102 | - { |
|
| 103 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/contents/:path', |
|
| 104 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $path), Request::METHOD_DELETE, [ |
|
| 105 | - 'message' => $message, |
|
| 106 | - 'sha' => $sha, |
|
| 107 | - 'branch' => $branch |
|
| 108 | - ]); |
|
| 109 | - } |
|
| 88 | + /** |
|
| 89 | + * Delete a file |
|
| 90 | + * |
|
| 91 | + * @link https://developer.github.com/v3/repos/contents/#delete-a-file |
|
| 92 | + * |
|
| 93 | + * @param string $path |
|
| 94 | + * @param string $message |
|
| 95 | + * @param string $sha |
|
| 96 | + * @param string $branch |
|
| 97 | + * |
|
| 98 | + * @return array |
|
| 99 | + */ |
|
| 100 | + public function deleteFile(string $path, string $message, string $sha, |
|
| 101 | + string $branch = AbstractApi::BRANCH_MASTER): array |
|
| 102 | + { |
|
| 103 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/contents/:path', |
|
| 104 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $path), Request::METHOD_DELETE, [ |
|
| 105 | + 'message' => $message, |
|
| 106 | + 'sha' => $sha, |
|
| 107 | + 'branch' => $branch |
|
| 108 | + ]); |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - /** |
|
| 112 | - * Get archive link |
|
| 113 | - * |
|
| 114 | - * @link https://developer.github.com/v3/repos/contents/#get-archive-link |
|
| 115 | - * |
|
| 116 | - * @param string $archiveFormat |
|
| 117 | - * @param string $ref |
|
| 118 | - * |
|
| 119 | - * @return array |
|
| 120 | - */ |
|
| 121 | - public function getArchiveLink(string $archiveFormat = AbstractApi::ARCHIVE_TARBALL, |
|
| 122 | - string $ref = AbstractApi::BRANCH_MASTER): array |
|
| 123 | - { |
|
| 124 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/:archive_format/:ref', |
|
| 125 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $archiveFormat, $ref)); |
|
| 126 | - } |
|
| 111 | + /** |
|
| 112 | + * Get archive link |
|
| 113 | + * |
|
| 114 | + * @link https://developer.github.com/v3/repos/contents/#get-archive-link |
|
| 115 | + * |
|
| 116 | + * @param string $archiveFormat |
|
| 117 | + * @param string $ref |
|
| 118 | + * |
|
| 119 | + * @return array |
|
| 120 | + */ |
|
| 121 | + public function getArchiveLink(string $archiveFormat = AbstractApi::ARCHIVE_TARBALL, |
|
| 122 | + string $ref = AbstractApi::BRANCH_MASTER): array |
|
| 123 | + { |
|
| 124 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/:archive_format/:ref', |
|
| 125 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $archiveFormat, $ref)); |
|
| 126 | + } |
|
| 127 | 127 | } |
| 128 | 128 | \ No newline at end of file |
@@ -12,67 +12,67 @@ |
||
| 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('/repos/:owner/:repo/collaborators', |
|
| 24 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 25 | - } |
|
| 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('/repos/:owner/:repo/collaborators', |
|
| 24 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Check if a user is a collaborator |
|
| 29 | - * |
|
| 30 | - * @link https://developer.github.com/v3/repos/collaborators/#get |
|
| 31 | - * |
|
| 32 | - * @param string $username |
|
| 33 | - * |
|
| 34 | - * @return bool |
|
| 35 | - */ |
|
| 36 | - public function checkUserIsACollaborator(string $username): bool |
|
| 37 | - { |
|
| 38 | - $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/collaborators/:username', |
|
| 39 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $username)); |
|
| 27 | + /** |
|
| 28 | + * Check if a user is a collaborator |
|
| 29 | + * |
|
| 30 | + * @link https://developer.github.com/v3/repos/collaborators/#get |
|
| 31 | + * |
|
| 32 | + * @param string $username |
|
| 33 | + * |
|
| 34 | + * @return bool |
|
| 35 | + */ |
|
| 36 | + public function checkUserIsACollaborator(string $username): bool |
|
| 37 | + { |
|
| 38 | + $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/collaborators/:username', |
|
| 39 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $username)); |
|
| 40 | 40 | |
| 41 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 42 | - return true; |
|
| 43 | - } |
|
| 41 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 42 | + return true; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - return false; |
|
| 46 | - } |
|
| 45 | + return false; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Add user as a collaborator |
|
| 50 | - * |
|
| 51 | - * @link https://developer.github.com/v3/repos/collaborators/#add-collaborator |
|
| 52 | - * |
|
| 53 | - * @param string $username |
|
| 54 | - * |
|
| 55 | - * @return array |
|
| 56 | - */ |
|
| 57 | - public function addUserAsCollaborator(string $username): array |
|
| 58 | - { |
|
| 59 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/collaborators/:username', |
|
| 60 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $username), Request::METHOD_PUT); |
|
| 61 | - } |
|
| 48 | + /** |
|
| 49 | + * Add user as a collaborator |
|
| 50 | + * |
|
| 51 | + * @link https://developer.github.com/v3/repos/collaborators/#add-collaborator |
|
| 52 | + * |
|
| 53 | + * @param string $username |
|
| 54 | + * |
|
| 55 | + * @return array |
|
| 56 | + */ |
|
| 57 | + public function addUserAsCollaborator(string $username): array |
|
| 58 | + { |
|
| 59 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/collaborators/:username', |
|
| 60 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $username), Request::METHOD_PUT); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Remove user as a collaborator |
|
| 65 | - * |
|
| 66 | - * @link https://developer.github.com/v3/repos/collaborators/#remove-collaborator |
|
| 67 | - * |
|
| 68 | - * @param string $username |
|
| 69 | - * |
|
| 70 | - * @return array |
|
| 71 | - */ |
|
| 72 | - public function removeUserAsCollaborator(string $username): array |
|
| 73 | - { |
|
| 74 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/collaborators/:username', |
|
| 75 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $username), |
|
| 76 | - Request::METHOD_DELETE); |
|
| 77 | - } |
|
| 63 | + /** |
|
| 64 | + * Remove user as a collaborator |
|
| 65 | + * |
|
| 66 | + * @link https://developer.github.com/v3/repos/collaborators/#remove-collaborator |
|
| 67 | + * |
|
| 68 | + * @param string $username |
|
| 69 | + * |
|
| 70 | + * @return array |
|
| 71 | + */ |
|
| 72 | + public function removeUserAsCollaborator(string $username): array |
|
| 73 | + { |
|
| 74 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/collaborators/:username', |
|
| 75 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $username), |
|
| 76 | + Request::METHOD_DELETE); |
|
| 77 | + } |
|
| 78 | 78 | } |
| 79 | 79 | \ No newline at end of file |
@@ -12,66 +12,66 @@ |
||
| 12 | 12 | abstract class AbstractRepositories |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** Properties */ |
|
| 16 | - protected $repositories; |
|
| 17 | - protected $api; |
|
| 15 | + /** Properties */ |
|
| 16 | + protected $repositories; |
|
| 17 | + protected $api; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Constructor |
|
| 21 | - * |
|
| 22 | - * @param Repositories $repositories |
|
| 23 | - */ |
|
| 24 | - public function __construct(Repositories $repositories) |
|
| 25 | - { |
|
| 26 | - $this->setRepositories($repositories); |
|
| 27 | - $this->setApi($repositories->getApi()); |
|
| 28 | - } |
|
| 19 | + /** |
|
| 20 | + * Constructor |
|
| 21 | + * |
|
| 22 | + * @param Repositories $repositories |
|
| 23 | + */ |
|
| 24 | + public function __construct(Repositories $repositories) |
|
| 25 | + { |
|
| 26 | + $this->setRepositories($repositories); |
|
| 27 | + $this->setApi($repositories->getApi()); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Get repositories |
|
| 32 | - * |
|
| 33 | - * @return Repositories |
|
| 34 | - */ |
|
| 35 | - public function getRepositories(): Repositories |
|
| 36 | - { |
|
| 37 | - return $this->repositories; |
|
| 38 | - } |
|
| 30 | + /** |
|
| 31 | + * Get repositories |
|
| 32 | + * |
|
| 33 | + * @return Repositories |
|
| 34 | + */ |
|
| 35 | + public function getRepositories(): Repositories |
|
| 36 | + { |
|
| 37 | + return $this->repositories; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Set repositories |
|
| 42 | - * |
|
| 43 | - * @param Repositories $repositories |
|
| 44 | - * |
|
| 45 | - * @return AbstractRepositories |
|
| 46 | - */ |
|
| 47 | - public function setRepositories(Repositories $repositories): AbstractRepositories |
|
| 48 | - { |
|
| 49 | - $this->repositories = $repositories; |
|
| 40 | + /** |
|
| 41 | + * Set repositories |
|
| 42 | + * |
|
| 43 | + * @param Repositories $repositories |
|
| 44 | + * |
|
| 45 | + * @return AbstractRepositories |
|
| 46 | + */ |
|
| 47 | + public function setRepositories(Repositories $repositories): AbstractRepositories |
|
| 48 | + { |
|
| 49 | + $this->repositories = $repositories; |
|
| 50 | 50 | |
| 51 | - return $this; |
|
| 52 | - } |
|
| 51 | + return $this; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Get api |
|
| 56 | - * |
|
| 57 | - * @return AbstractApi |
|
| 58 | - */ |
|
| 59 | - public function getApi(): AbstractApi |
|
| 60 | - { |
|
| 61 | - return $this->api; |
|
| 62 | - } |
|
| 54 | + /** |
|
| 55 | + * Get api |
|
| 56 | + * |
|
| 57 | + * @return AbstractApi |
|
| 58 | + */ |
|
| 59 | + public function getApi(): AbstractApi |
|
| 60 | + { |
|
| 61 | + return $this->api; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Set api |
|
| 66 | - * |
|
| 67 | - * @param AbstractApi $api |
|
| 68 | - * |
|
| 69 | - * @return AbstractRepositories |
|
| 70 | - */ |
|
| 71 | - public function setApi(AbstractApi $api): AbstractRepositories |
|
| 72 | - { |
|
| 73 | - $this->api = $api; |
|
| 64 | + /** |
|
| 65 | + * Set api |
|
| 66 | + * |
|
| 67 | + * @param AbstractApi $api |
|
| 68 | + * |
|
| 69 | + * @return AbstractRepositories |
|
| 70 | + */ |
|
| 71 | + public function setApi(AbstractApi $api): AbstractRepositories |
|
| 72 | + { |
|
| 73 | + $this->api = $api; |
|
| 74 | 74 | |
| 75 | - return $this; |
|
| 76 | - } |
|
| 75 | + return $this; |
|
| 76 | + } |
|
| 77 | 77 | } |
| 78 | 78 | \ No newline at end of file |
@@ -13,93 +13,93 @@ |
||
| 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(string $sha = null, string $ref = null, string $task = null, |
|
| 29 | - string $environment = null): array |
|
| 30 | - { |
|
| 31 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/deployments', |
|
| 32 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), |
|
| 33 | - http_build_query(['sha' => $sha, 'ref' => $ref, 'task' => $task, 'environment' => $environment]))); |
|
| 34 | - } |
|
| 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(string $sha = null, string $ref = null, string $task = null, |
|
| 29 | + string $environment = null): array |
|
| 30 | + { |
|
| 31 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/deployments', |
|
| 32 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), |
|
| 33 | + http_build_query(['sha' => $sha, 'ref' => $ref, 'task' => $task, 'environment' => $environment]))); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Create a Deployment |
|
| 38 | - * |
|
| 39 | - * @link https://developer.github.com/v3/repos/deployments/#create-a-deployment |
|
| 40 | - * |
|
| 41 | - * @param string $ref |
|
| 42 | - * @param string $task |
|
| 43 | - * @param bool $autoMerge |
|
| 44 | - * @param array $requiredContexts |
|
| 45 | - * @param string $payload |
|
| 46 | - * @param string $environment |
|
| 47 | - * @param string $description |
|
| 48 | - * |
|
| 49 | - * @return array |
|
| 50 | - */ |
|
| 51 | - public function createDeployement(string $ref, string $task = AbstractApi::TASK_DEPLOY, bool $autoMerge = true, |
|
| 52 | - array $requiredContexts = [], string $payload = '', |
|
| 53 | - string $environment = AbstractApi::ENVIRONMENT_PRODUCTION, |
|
| 54 | - string $description = ''): array |
|
| 55 | - { |
|
| 56 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/deployments', |
|
| 57 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, [ |
|
| 58 | - 'ref' => $ref, |
|
| 59 | - 'task' => $task, |
|
| 60 | - 'auto_merge' => $autoMerge, |
|
| 61 | - 'required_contexts' => $requiredContexts, |
|
| 62 | - 'payload' => $payload, |
|
| 63 | - 'environment' => $environment, |
|
| 64 | - 'description' => $description |
|
| 65 | - ]); |
|
| 66 | - } |
|
| 36 | + /** |
|
| 37 | + * Create a Deployment |
|
| 38 | + * |
|
| 39 | + * @link https://developer.github.com/v3/repos/deployments/#create-a-deployment |
|
| 40 | + * |
|
| 41 | + * @param string $ref |
|
| 42 | + * @param string $task |
|
| 43 | + * @param bool $autoMerge |
|
| 44 | + * @param array $requiredContexts |
|
| 45 | + * @param string $payload |
|
| 46 | + * @param string $environment |
|
| 47 | + * @param string $description |
|
| 48 | + * |
|
| 49 | + * @return array |
|
| 50 | + */ |
|
| 51 | + public function createDeployement(string $ref, string $task = AbstractApi::TASK_DEPLOY, bool $autoMerge = true, |
|
| 52 | + array $requiredContexts = [], string $payload = '', |
|
| 53 | + string $environment = AbstractApi::ENVIRONMENT_PRODUCTION, |
|
| 54 | + string $description = ''): array |
|
| 55 | + { |
|
| 56 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/deployments', |
|
| 57 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, [ |
|
| 58 | + 'ref' => $ref, |
|
| 59 | + 'task' => $task, |
|
| 60 | + 'auto_merge' => $autoMerge, |
|
| 61 | + 'required_contexts' => $requiredContexts, |
|
| 62 | + 'payload' => $payload, |
|
| 63 | + 'environment' => $environment, |
|
| 64 | + 'description' => $description |
|
| 65 | + ]); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * List Deployment Statuses |
|
| 70 | - * |
|
| 71 | - * @link https://developer.github.com/v3/repos/deployments/#list-deployment-statuses |
|
| 72 | - * |
|
| 73 | - * @param int $id |
|
| 74 | - * |
|
| 75 | - * @return array |
|
| 76 | - */ |
|
| 77 | - public function listDeploymentStatus(int $id): array |
|
| 78 | - { |
|
| 79 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/deployments/:id/statuses', |
|
| 80 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id)); |
|
| 81 | - } |
|
| 68 | + /** |
|
| 69 | + * List Deployment Statuses |
|
| 70 | + * |
|
| 71 | + * @link https://developer.github.com/v3/repos/deployments/#list-deployment-statuses |
|
| 72 | + * |
|
| 73 | + * @param int $id |
|
| 74 | + * |
|
| 75 | + * @return array |
|
| 76 | + */ |
|
| 77 | + public function listDeploymentStatus(int $id): array |
|
| 78 | + { |
|
| 79 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/deployments/:id/statuses', |
|
| 80 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id)); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Create a Deployment Status |
|
| 85 | - * |
|
| 86 | - * @link https://developer.github.com/v3/repos/deployments/#create-a-deployment-status |
|
| 87 | - * |
|
| 88 | - * @param int $id |
|
| 89 | - * @param string $state |
|
| 90 | - * @param string $targetUrl |
|
| 91 | - * @param string $description |
|
| 92 | - * |
|
| 93 | - * @return array |
|
| 94 | - */ |
|
| 95 | - public function createDeploymentStatus(int $id, string $state, string $targetUrl = '', |
|
| 96 | - string $description = ''): array |
|
| 97 | - { |
|
| 98 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/deployments/:id/statuses', |
|
| 99 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_POST, [ |
|
| 100 | - 'state' => $state, |
|
| 101 | - 'target_url' => $targetUrl, |
|
| 102 | - 'description' => $description |
|
| 103 | - ]); |
|
| 104 | - } |
|
| 83 | + /** |
|
| 84 | + * Create a Deployment Status |
|
| 85 | + * |
|
| 86 | + * @link https://developer.github.com/v3/repos/deployments/#create-a-deployment-status |
|
| 87 | + * |
|
| 88 | + * @param int $id |
|
| 89 | + * @param string $state |
|
| 90 | + * @param string $targetUrl |
|
| 91 | + * @param string $description |
|
| 92 | + * |
|
| 93 | + * @return array |
|
| 94 | + */ |
|
| 95 | + public function createDeploymentStatus(int $id, string $state, string $targetUrl = '', |
|
| 96 | + string $description = ''): array |
|
| 97 | + { |
|
| 98 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/deployments/:id/statuses', |
|
| 99 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_POST, [ |
|
| 100 | + 'state' => $state, |
|
| 101 | + 'target_url' => $targetUrl, |
|
| 102 | + 'description' => $description |
|
| 103 | + ]); |
|
| 104 | + } |
|
| 105 | 105 | } |
| 106 | 106 | \ No newline at end of file |
@@ -10,63 +10,63 @@ |
||
| 10 | 10 | class Statistics extends AbstractRepositories |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * Get contributors list with additions, deletions, and commit counts |
|
| 15 | - * |
|
| 16 | - * @link https://developer.github.com/v3/repos/statistics/#contributors |
|
| 17 | - * @return array |
|
| 18 | - */ |
|
| 19 | - public function listContributors(): array |
|
| 20 | - { |
|
| 21 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/contributors', |
|
| 22 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 23 | - } |
|
| 13 | + /** |
|
| 14 | + * Get contributors list with additions, deletions, and commit counts |
|
| 15 | + * |
|
| 16 | + * @link https://developer.github.com/v3/repos/statistics/#contributors |
|
| 17 | + * @return array |
|
| 18 | + */ |
|
| 19 | + public function listContributors(): array |
|
| 20 | + { |
|
| 21 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/contributors', |
|
| 22 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Get the last year of commit activity data |
|
| 27 | - * |
|
| 28 | - * @link https://developer.github.com/v3/repos/statistics/#commit-activity |
|
| 29 | - * @return array |
|
| 30 | - */ |
|
| 31 | - public function getCommitActivity(): array |
|
| 32 | - { |
|
| 33 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/commit_activity', |
|
| 34 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 35 | - } |
|
| 25 | + /** |
|
| 26 | + * Get the last year of commit activity data |
|
| 27 | + * |
|
| 28 | + * @link https://developer.github.com/v3/repos/statistics/#commit-activity |
|
| 29 | + * @return array |
|
| 30 | + */ |
|
| 31 | + public function getCommitActivity(): array |
|
| 32 | + { |
|
| 33 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/commit_activity', |
|
| 34 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Get the number of additions and deletions per week |
|
| 39 | - * |
|
| 40 | - * @link https://developer.github.com/v3/repos/statistics/#code-frequency |
|
| 41 | - * @return array |
|
| 42 | - */ |
|
| 43 | - public function getCodeFrequency(): array |
|
| 44 | - { |
|
| 45 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/code_frequency', |
|
| 46 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 47 | - } |
|
| 37 | + /** |
|
| 38 | + * Get the number of additions and deletions per week |
|
| 39 | + * |
|
| 40 | + * @link https://developer.github.com/v3/repos/statistics/#code-frequency |
|
| 41 | + * @return array |
|
| 42 | + */ |
|
| 43 | + public function getCodeFrequency(): array |
|
| 44 | + { |
|
| 45 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/code_frequency', |
|
| 46 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * Get the weekly commit count for the repository owner and everyone else |
|
| 51 | - * |
|
| 52 | - * @link https://developer.github.com/v3/repos/statistics/#participation |
|
| 53 | - * @return array |
|
| 54 | - */ |
|
| 55 | - public function getParticipation(): array |
|
| 56 | - { |
|
| 57 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/participation', |
|
| 58 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 59 | - } |
|
| 49 | + /** |
|
| 50 | + * Get the weekly commit count for the repository owner and everyone else |
|
| 51 | + * |
|
| 52 | + * @link https://developer.github.com/v3/repos/statistics/#participation |
|
| 53 | + * @return array |
|
| 54 | + */ |
|
| 55 | + public function getParticipation(): array |
|
| 56 | + { |
|
| 57 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/participation', |
|
| 58 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Get the number of commits per hour in each day |
|
| 63 | - * |
|
| 64 | - * @link https://developer.github.com/v3/repos/statistics/#punch-card |
|
| 65 | - * @return array |
|
| 66 | - */ |
|
| 67 | - public function getPunchCard(): array |
|
| 68 | - { |
|
| 69 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/punch_card', |
|
| 70 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 71 | - } |
|
| 61 | + /** |
|
| 62 | + * Get the number of commits per hour in each day |
|
| 63 | + * |
|
| 64 | + * @link https://developer.github.com/v3/repos/statistics/#punch-card |
|
| 65 | + * @return array |
|
| 66 | + */ |
|
| 67 | + public function getPunchCard(): array |
|
| 68 | + { |
|
| 69 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/punch_card', |
|
| 70 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 71 | + } |
|
| 72 | 72 | } |
| 73 | 73 | \ No newline at end of file |
@@ -12,125 +12,125 @@ |
||
| 12 | 12 | class Hooks extends AbstractRepositories |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * List hooks |
|
| 17 | - * |
|
| 18 | - * @link https://developer.github.com/v3/repos/hooks/#list-hooks |
|
| 19 | - * @return array |
|
| 20 | - */ |
|
| 21 | - public function listHooks(): array |
|
| 22 | - { |
|
| 23 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/hooks', |
|
| 24 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 25 | - } |
|
| 15 | + /** |
|
| 16 | + * List hooks |
|
| 17 | + * |
|
| 18 | + * @link https://developer.github.com/v3/repos/hooks/#list-hooks |
|
| 19 | + * @return array |
|
| 20 | + */ |
|
| 21 | + public function listHooks(): array |
|
| 22 | + { |
|
| 23 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/hooks', |
|
| 24 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Get single hook |
|
| 29 | - * |
|
| 30 | - * @link https://developer.github.com/v3/repos/hooks/#get-single-hook |
|
| 31 | - * |
|
| 32 | - * @param int $id |
|
| 33 | - * |
|
| 34 | - * @return array |
|
| 35 | - */ |
|
| 36 | - public function getSingleHook(int $id): array |
|
| 37 | - { |
|
| 38 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/hooks/:id', |
|
| 39 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id)); |
|
| 40 | - } |
|
| 27 | + /** |
|
| 28 | + * Get single hook |
|
| 29 | + * |
|
| 30 | + * @link https://developer.github.com/v3/repos/hooks/#get-single-hook |
|
| 31 | + * |
|
| 32 | + * @param int $id |
|
| 33 | + * |
|
| 34 | + * @return array |
|
| 35 | + */ |
|
| 36 | + public function getSingleHook(int $id): array |
|
| 37 | + { |
|
| 38 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/hooks/:id', |
|
| 39 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id)); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Create a hook |
|
| 44 | - * |
|
| 45 | - * @link https://developer.github.com/v3/repos/hooks/#create-a-hook |
|
| 46 | - * |
|
| 47 | - * @param string $name |
|
| 48 | - * @param string $config |
|
| 49 | - * @param array $events |
|
| 50 | - * @param bool $active |
|
| 51 | - * |
|
| 52 | - * @return array |
|
| 53 | - */ |
|
| 54 | - public function createHook(string $name, string $config, array $events = ['push'], bool $active = true): array |
|
| 55 | - { |
|
| 56 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/hooks', |
|
| 57 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, [ |
|
| 58 | - 'name' => $name, |
|
| 59 | - 'config' => $config, |
|
| 60 | - 'events' => $events, |
|
| 61 | - 'active' => $active |
|
| 62 | - ]); |
|
| 63 | - } |
|
| 42 | + /** |
|
| 43 | + * Create a hook |
|
| 44 | + * |
|
| 45 | + * @link https://developer.github.com/v3/repos/hooks/#create-a-hook |
|
| 46 | + * |
|
| 47 | + * @param string $name |
|
| 48 | + * @param string $config |
|
| 49 | + * @param array $events |
|
| 50 | + * @param bool $active |
|
| 51 | + * |
|
| 52 | + * @return array |
|
| 53 | + */ |
|
| 54 | + public function createHook(string $name, string $config, array $events = ['push'], bool $active = true): array |
|
| 55 | + { |
|
| 56 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/hooks', |
|
| 57 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, [ |
|
| 58 | + 'name' => $name, |
|
| 59 | + 'config' => $config, |
|
| 60 | + 'events' => $events, |
|
| 61 | + 'active' => $active |
|
| 62 | + ]); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * Edit a hook |
|
| 67 | - * |
|
| 68 | - * @link https://developer.github.com/v3/repos/hooks/#edit-a-hook |
|
| 69 | - * |
|
| 70 | - * @param int $id |
|
| 71 | - * @param string $config |
|
| 72 | - * @param array $events |
|
| 73 | - * @param array $addEvents |
|
| 74 | - * @param array $removeEvents |
|
| 75 | - * @param bool $active |
|
| 76 | - * |
|
| 77 | - * @return array |
|
| 78 | - */ |
|
| 79 | - public function editHook(int $id, string $config, array $events = ['push'], array $addEvents = [], |
|
| 80 | - array $removeEvents = [], bool $active = true): array |
|
| 81 | - { |
|
| 82 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/hooks/:id', |
|
| 83 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_PATCH, [ |
|
| 84 | - 'config' => $config, |
|
| 85 | - 'events' => $events, |
|
| 86 | - 'add_events' => $addEvents, |
|
| 87 | - 'remove_events' => $removeEvents, |
|
| 88 | - 'active' => $active |
|
| 89 | - ]); |
|
| 90 | - } |
|
| 65 | + /** |
|
| 66 | + * Edit a hook |
|
| 67 | + * |
|
| 68 | + * @link https://developer.github.com/v3/repos/hooks/#edit-a-hook |
|
| 69 | + * |
|
| 70 | + * @param int $id |
|
| 71 | + * @param string $config |
|
| 72 | + * @param array $events |
|
| 73 | + * @param array $addEvents |
|
| 74 | + * @param array $removeEvents |
|
| 75 | + * @param bool $active |
|
| 76 | + * |
|
| 77 | + * @return array |
|
| 78 | + */ |
|
| 79 | + public function editHook(int $id, string $config, array $events = ['push'], array $addEvents = [], |
|
| 80 | + array $removeEvents = [], bool $active = true): array |
|
| 81 | + { |
|
| 82 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/hooks/:id', |
|
| 83 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_PATCH, [ |
|
| 84 | + 'config' => $config, |
|
| 85 | + 'events' => $events, |
|
| 86 | + 'add_events' => $addEvents, |
|
| 87 | + 'remove_events' => $removeEvents, |
|
| 88 | + 'active' => $active |
|
| 89 | + ]); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Test a push hook |
|
| 94 | - * |
|
| 95 | - * @link https://developer.github.com/v3/repos/hooks/#test-a-push-hook |
|
| 96 | - * |
|
| 97 | - * @param int $id |
|
| 98 | - * |
|
| 99 | - * @return array |
|
| 100 | - */ |
|
| 101 | - public function testPushHook(int $id): array |
|
| 102 | - { |
|
| 103 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/hooks/:id/tests', |
|
| 104 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_POST); |
|
| 105 | - } |
|
| 92 | + /** |
|
| 93 | + * Test a push hook |
|
| 94 | + * |
|
| 95 | + * @link https://developer.github.com/v3/repos/hooks/#test-a-push-hook |
|
| 96 | + * |
|
| 97 | + * @param int $id |
|
| 98 | + * |
|
| 99 | + * @return array |
|
| 100 | + */ |
|
| 101 | + public function testPushHook(int $id): array |
|
| 102 | + { |
|
| 103 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/hooks/:id/tests', |
|
| 104 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_POST); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Ping a hook |
|
| 109 | - * |
|
| 110 | - * @link https://developer.github.com/v3/repos/hooks/#ping-a-hook |
|
| 111 | - * |
|
| 112 | - * @param int $id |
|
| 113 | - * |
|
| 114 | - * @return array |
|
| 115 | - */ |
|
| 116 | - public function pingHook(int $id): array |
|
| 117 | - { |
|
| 118 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/hooks/:id/pings', |
|
| 119 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_POST); |
|
| 120 | - } |
|
| 107 | + /** |
|
| 108 | + * Ping a hook |
|
| 109 | + * |
|
| 110 | + * @link https://developer.github.com/v3/repos/hooks/#ping-a-hook |
|
| 111 | + * |
|
| 112 | + * @param int $id |
|
| 113 | + * |
|
| 114 | + * @return array |
|
| 115 | + */ |
|
| 116 | + public function pingHook(int $id): array |
|
| 117 | + { |
|
| 118 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/hooks/:id/pings', |
|
| 119 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_POST); |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - /** |
|
| 123 | - * Delete a hook |
|
| 124 | - * |
|
| 125 | - * @link https://developer.github.com/v3/repos/hooks/#delete-a-hook |
|
| 126 | - * |
|
| 127 | - * @param int $id |
|
| 128 | - * |
|
| 129 | - * @return array |
|
| 130 | - */ |
|
| 131 | - public function deleteHook(int $id): array |
|
| 132 | - { |
|
| 133 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/hooks/:id', |
|
| 134 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_DELETE); |
|
| 135 | - } |
|
| 122 | + /** |
|
| 123 | + * Delete a hook |
|
| 124 | + * |
|
| 125 | + * @link https://developer.github.com/v3/repos/hooks/#delete-a-hook |
|
| 126 | + * |
|
| 127 | + * @param int $id |
|
| 128 | + * |
|
| 129 | + * @return array |
|
| 130 | + */ |
|
| 131 | + public function deleteHook(int $id): array |
|
| 132 | + { |
|
| 133 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/hooks/:id', |
|
| 134 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_DELETE); |
|
| 135 | + } |
|
| 136 | 136 | } |
| 137 | 137 | \ No newline at end of file |
@@ -14,235 +14,235 @@ |
||
| 14 | 14 | class Releases extends AbstractRepositories |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * List releases for a repository |
|
| 19 | - * |
|
| 20 | - * @link https://developer.github.com/v3/repos/releases/#list-releases-for-a-repository |
|
| 21 | - * @return array |
|
| 22 | - */ |
|
| 23 | - public function listReleases(): array |
|
| 24 | - { |
|
| 25 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases', |
|
| 26 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 27 | - } |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * Get a single release |
|
| 31 | - * |
|
| 32 | - * @link https://developer.github.com/v3/repos/releases/#get-a-single-release |
|
| 33 | - * |
|
| 34 | - * @param string $id |
|
| 35 | - * |
|
| 36 | - * @return array |
|
| 37 | - */ |
|
| 38 | - public function getSingleRelease(string $id): array |
|
| 39 | - { |
|
| 40 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/:id', |
|
| 41 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id)); |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Get the latest release |
|
| 46 | - * |
|
| 47 | - * @link https://developer.github.com/v3/repos/releases/#get-the-latest-release |
|
| 48 | - * @return array |
|
| 49 | - * @throws \Exception |
|
| 50 | - */ |
|
| 51 | - public function getLatestRelease(): array |
|
| 52 | - { |
|
| 53 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/latest', |
|
| 54 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * Get a release by tag name |
|
| 59 | - * |
|
| 60 | - * @link https://developer.github.com/v3/repos/releases/#get-a-release-by-tag-name |
|
| 61 | - * |
|
| 62 | - * @param string $tag |
|
| 63 | - * |
|
| 64 | - * @return array |
|
| 65 | - * @throws \Exception |
|
| 66 | - */ |
|
| 67 | - public function getReleaseByTagName(string $tag): array |
|
| 68 | - { |
|
| 69 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/tags/:tag', |
|
| 70 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $tag)); |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * Create a release |
|
| 75 | - * |
|
| 76 | - * @link https://developer.github.com/v3/repos/releases/#create-a-release |
|
| 77 | - * |
|
| 78 | - * @param string $tagName |
|
| 79 | - * @param string $targetCommitish |
|
| 80 | - * @param string $name |
|
| 81 | - * @param string $body |
|
| 82 | - * @param bool $draft |
|
| 83 | - * @param bool $preRelease |
|
| 84 | - * |
|
| 85 | - * @return array |
|
| 86 | - */ |
|
| 87 | - public function createRelease(string $tagName, string $targetCommitish = AbstractApi::BRANCH_MASTER, |
|
| 88 | - string $name = null, string $body = null, bool $draft = false, |
|
| 89 | - bool $preRelease = false): array |
|
| 90 | - { |
|
| 91 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases', |
|
| 92 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, [ |
|
| 93 | - 'tag_name' => $tagName, |
|
| 94 | - 'target_commitish' => $targetCommitish, |
|
| 95 | - 'name' => $name, |
|
| 96 | - 'body' => $body, |
|
| 97 | - 'draft' => $draft, |
|
| 98 | - 'prerelease' => $preRelease |
|
| 99 | - ]); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * Edit a release |
|
| 104 | - * |
|
| 105 | - * @link https://developer.github.com/v3/repos/releases/#edit-a-release |
|
| 106 | - * |
|
| 107 | - * @param string $id |
|
| 108 | - * @param string $tagName |
|
| 109 | - * @param string $targetCommitish |
|
| 110 | - * @param string $name |
|
| 111 | - * @param string $body |
|
| 112 | - * @param bool $draft |
|
| 113 | - * @param bool $preRelease |
|
| 114 | - * |
|
| 115 | - * @return array |
|
| 116 | - */ |
|
| 117 | - public function editRelease(string $id, string $tagName, string $targetCommitish = AbstractApi::BRANCH_MASTER, |
|
| 118 | - string $name, string $body, bool $draft = false, bool $preRelease = false): array |
|
| 119 | - { |
|
| 120 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/:id', |
|
| 121 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_PATCH, [ |
|
| 122 | - 'tag_name' => $tagName, |
|
| 123 | - 'target_commitish' => $targetCommitish, |
|
| 124 | - 'name' => $name, |
|
| 125 | - 'body' => $body, |
|
| 126 | - 'draft' => $draft, |
|
| 127 | - 'prerelease' => $preRelease |
|
| 128 | - ]); |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * Delete a release |
|
| 133 | - * |
|
| 134 | - * @link https://developer.github.com/v3/repos/releases/#delete-a-release |
|
| 135 | - * |
|
| 136 | - * @param string $id |
|
| 137 | - * |
|
| 138 | - * @return bool |
|
| 139 | - */ |
|
| 140 | - public function deleteRelease(string $id): bool |
|
| 141 | - { |
|
| 142 | - $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/:id', |
|
| 143 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_DELETE); |
|
| 144 | - |
|
| 145 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 146 | - return true; |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - return false; |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * List assets for a release |
|
| 154 | - * |
|
| 155 | - * @link https://developer.github.com/v3/repos/releases/#list-assets-for-a-release |
|
| 156 | - * |
|
| 157 | - * @param string $id |
|
| 158 | - * |
|
| 159 | - * @return array |
|
| 160 | - */ |
|
| 161 | - public function getReleaseAssets(string $id): array |
|
| 162 | - { |
|
| 163 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/:id/assets', |
|
| 164 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id)); |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - /** |
|
| 168 | - * Upload a release asset |
|
| 169 | - * |
|
| 170 | - * @link https://developer.github.com/v3/repos/releases/#upload-a-release-asset |
|
| 171 | - * |
|
| 172 | - * @param string $id |
|
| 173 | - * @param string $contentType |
|
| 174 | - * @param string $name |
|
| 175 | - * |
|
| 176 | - * @return array |
|
| 177 | - */ |
|
| 178 | - public function uploadReleaseAsset(string $id, string $contentType, string $name): array |
|
| 179 | - { |
|
| 180 | - |
|
| 181 | - return $this->getApi()->setApiUrl(AbstractApi::API_UPLOADS)->request($this->getApi() |
|
| 182 | - ->sprintf('/repos/:owner/:repo/releases/:id/assets?:arg', |
|
| 183 | - $this->getRepositories() |
|
| 184 | - ->getOwner(), |
|
| 185 | - $this->getRepositories() |
|
| 186 | - ->getRepo(), $id, |
|
| 187 | - http_build_query(['name' => $name])), |
|
| 188 | - Request::METHOD_POST, [ |
|
| 189 | - 'Content-Type' => $contentType |
|
| 190 | - ]); |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - /** |
|
| 194 | - * Get a single release asset |
|
| 195 | - * |
|
| 196 | - * @link https://developer.github.com/v3/repos/releases/#get-a-single-release-asset |
|
| 197 | - * |
|
| 198 | - * @param string $id |
|
| 199 | - * |
|
| 200 | - * @return array |
|
| 201 | - */ |
|
| 202 | - public function getSingleReleaseAsset(string $id): array |
|
| 203 | - { |
|
| 204 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/assets/:id', |
|
| 205 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id)); |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - /** |
|
| 209 | - * Edit a release asset |
|
| 210 | - * |
|
| 211 | - * @link https://developer.github.com/v3/repos/releases/#edit-a-release-asset |
|
| 212 | - * |
|
| 213 | - * @param string $id |
|
| 214 | - * @param string $name |
|
| 215 | - * @param string $label |
|
| 216 | - * |
|
| 217 | - * @return array |
|
| 218 | - */ |
|
| 219 | - public function editReleaseAsset(string $id, string $name, string $label = ''): array |
|
| 220 | - { |
|
| 221 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/assets/:id', |
|
| 222 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_PATCH, [ |
|
| 223 | - 'name' => $name, |
|
| 224 | - 'label' => $label |
|
| 225 | - ]); |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - /** |
|
| 229 | - * Delete a release asset |
|
| 230 | - * |
|
| 231 | - * @link https://developer.github.com/v3/repos/releases/#delete-a-release-asset |
|
| 232 | - * |
|
| 233 | - * @param string $id |
|
| 234 | - * |
|
| 235 | - * @return bool |
|
| 236 | - */ |
|
| 237 | - public function deleteReleaseAsset(string $id): bool |
|
| 238 | - { |
|
| 239 | - $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/assets/:id', |
|
| 240 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_DELETE); |
|
| 241 | - |
|
| 242 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 243 | - return true; |
|
| 244 | - } |
|
| 245 | - |
|
| 246 | - return false; |
|
| 247 | - } |
|
| 17 | + /** |
|
| 18 | + * List releases for a repository |
|
| 19 | + * |
|
| 20 | + * @link https://developer.github.com/v3/repos/releases/#list-releases-for-a-repository |
|
| 21 | + * @return array |
|
| 22 | + */ |
|
| 23 | + public function listReleases(): array |
|
| 24 | + { |
|
| 25 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases', |
|
| 26 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 27 | + } |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * Get a single release |
|
| 31 | + * |
|
| 32 | + * @link https://developer.github.com/v3/repos/releases/#get-a-single-release |
|
| 33 | + * |
|
| 34 | + * @param string $id |
|
| 35 | + * |
|
| 36 | + * @return array |
|
| 37 | + */ |
|
| 38 | + public function getSingleRelease(string $id): array |
|
| 39 | + { |
|
| 40 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/:id', |
|
| 41 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id)); |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * Get the latest release |
|
| 46 | + * |
|
| 47 | + * @link https://developer.github.com/v3/repos/releases/#get-the-latest-release |
|
| 48 | + * @return array |
|
| 49 | + * @throws \Exception |
|
| 50 | + */ |
|
| 51 | + public function getLatestRelease(): array |
|
| 52 | + { |
|
| 53 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/latest', |
|
| 54 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * Get a release by tag name |
|
| 59 | + * |
|
| 60 | + * @link https://developer.github.com/v3/repos/releases/#get-a-release-by-tag-name |
|
| 61 | + * |
|
| 62 | + * @param string $tag |
|
| 63 | + * |
|
| 64 | + * @return array |
|
| 65 | + * @throws \Exception |
|
| 66 | + */ |
|
| 67 | + public function getReleaseByTagName(string $tag): array |
|
| 68 | + { |
|
| 69 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/tags/:tag', |
|
| 70 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $tag)); |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * Create a release |
|
| 75 | + * |
|
| 76 | + * @link https://developer.github.com/v3/repos/releases/#create-a-release |
|
| 77 | + * |
|
| 78 | + * @param string $tagName |
|
| 79 | + * @param string $targetCommitish |
|
| 80 | + * @param string $name |
|
| 81 | + * @param string $body |
|
| 82 | + * @param bool $draft |
|
| 83 | + * @param bool $preRelease |
|
| 84 | + * |
|
| 85 | + * @return array |
|
| 86 | + */ |
|
| 87 | + public function createRelease(string $tagName, string $targetCommitish = AbstractApi::BRANCH_MASTER, |
|
| 88 | + string $name = null, string $body = null, bool $draft = false, |
|
| 89 | + bool $preRelease = false): array |
|
| 90 | + { |
|
| 91 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases', |
|
| 92 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, [ |
|
| 93 | + 'tag_name' => $tagName, |
|
| 94 | + 'target_commitish' => $targetCommitish, |
|
| 95 | + 'name' => $name, |
|
| 96 | + 'body' => $body, |
|
| 97 | + 'draft' => $draft, |
|
| 98 | + 'prerelease' => $preRelease |
|
| 99 | + ]); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * Edit a release |
|
| 104 | + * |
|
| 105 | + * @link https://developer.github.com/v3/repos/releases/#edit-a-release |
|
| 106 | + * |
|
| 107 | + * @param string $id |
|
| 108 | + * @param string $tagName |
|
| 109 | + * @param string $targetCommitish |
|
| 110 | + * @param string $name |
|
| 111 | + * @param string $body |
|
| 112 | + * @param bool $draft |
|
| 113 | + * @param bool $preRelease |
|
| 114 | + * |
|
| 115 | + * @return array |
|
| 116 | + */ |
|
| 117 | + public function editRelease(string $id, string $tagName, string $targetCommitish = AbstractApi::BRANCH_MASTER, |
|
| 118 | + string $name, string $body, bool $draft = false, bool $preRelease = false): array |
|
| 119 | + { |
|
| 120 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/:id', |
|
| 121 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_PATCH, [ |
|
| 122 | + 'tag_name' => $tagName, |
|
| 123 | + 'target_commitish' => $targetCommitish, |
|
| 124 | + 'name' => $name, |
|
| 125 | + 'body' => $body, |
|
| 126 | + 'draft' => $draft, |
|
| 127 | + 'prerelease' => $preRelease |
|
| 128 | + ]); |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * Delete a release |
|
| 133 | + * |
|
| 134 | + * @link https://developer.github.com/v3/repos/releases/#delete-a-release |
|
| 135 | + * |
|
| 136 | + * @param string $id |
|
| 137 | + * |
|
| 138 | + * @return bool |
|
| 139 | + */ |
|
| 140 | + public function deleteRelease(string $id): bool |
|
| 141 | + { |
|
| 142 | + $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/:id', |
|
| 143 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_DELETE); |
|
| 144 | + |
|
| 145 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 146 | + return true; |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + return false; |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * List assets for a release |
|
| 154 | + * |
|
| 155 | + * @link https://developer.github.com/v3/repos/releases/#list-assets-for-a-release |
|
| 156 | + * |
|
| 157 | + * @param string $id |
|
| 158 | + * |
|
| 159 | + * @return array |
|
| 160 | + */ |
|
| 161 | + public function getReleaseAssets(string $id): array |
|
| 162 | + { |
|
| 163 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/:id/assets', |
|
| 164 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id)); |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + /** |
|
| 168 | + * Upload a release asset |
|
| 169 | + * |
|
| 170 | + * @link https://developer.github.com/v3/repos/releases/#upload-a-release-asset |
|
| 171 | + * |
|
| 172 | + * @param string $id |
|
| 173 | + * @param string $contentType |
|
| 174 | + * @param string $name |
|
| 175 | + * |
|
| 176 | + * @return array |
|
| 177 | + */ |
|
| 178 | + public function uploadReleaseAsset(string $id, string $contentType, string $name): array |
|
| 179 | + { |
|
| 180 | + |
|
| 181 | + return $this->getApi()->setApiUrl(AbstractApi::API_UPLOADS)->request($this->getApi() |
|
| 182 | + ->sprintf('/repos/:owner/:repo/releases/:id/assets?:arg', |
|
| 183 | + $this->getRepositories() |
|
| 184 | + ->getOwner(), |
|
| 185 | + $this->getRepositories() |
|
| 186 | + ->getRepo(), $id, |
|
| 187 | + http_build_query(['name' => $name])), |
|
| 188 | + Request::METHOD_POST, [ |
|
| 189 | + 'Content-Type' => $contentType |
|
| 190 | + ]); |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + /** |
|
| 194 | + * Get a single release asset |
|
| 195 | + * |
|
| 196 | + * @link https://developer.github.com/v3/repos/releases/#get-a-single-release-asset |
|
| 197 | + * |
|
| 198 | + * @param string $id |
|
| 199 | + * |
|
| 200 | + * @return array |
|
| 201 | + */ |
|
| 202 | + public function getSingleReleaseAsset(string $id): array |
|
| 203 | + { |
|
| 204 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/assets/:id', |
|
| 205 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id)); |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + /** |
|
| 209 | + * Edit a release asset |
|
| 210 | + * |
|
| 211 | + * @link https://developer.github.com/v3/repos/releases/#edit-a-release-asset |
|
| 212 | + * |
|
| 213 | + * @param string $id |
|
| 214 | + * @param string $name |
|
| 215 | + * @param string $label |
|
| 216 | + * |
|
| 217 | + * @return array |
|
| 218 | + */ |
|
| 219 | + public function editReleaseAsset(string $id, string $name, string $label = ''): array |
|
| 220 | + { |
|
| 221 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/assets/:id', |
|
| 222 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_PATCH, [ |
|
| 223 | + 'name' => $name, |
|
| 224 | + 'label' => $label |
|
| 225 | + ]); |
|
| 226 | + } |
|
| 227 | + |
|
| 228 | + /** |
|
| 229 | + * Delete a release asset |
|
| 230 | + * |
|
| 231 | + * @link https://developer.github.com/v3/repos/releases/#delete-a-release-asset |
|
| 232 | + * |
|
| 233 | + * @param string $id |
|
| 234 | + * |
|
| 235 | + * @return bool |
|
| 236 | + */ |
|
| 237 | + public function deleteReleaseAsset(string $id): bool |
|
| 238 | + { |
|
| 239 | + $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/assets/:id', |
|
| 240 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_DELETE); |
|
| 241 | + |
|
| 242 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 243 | + return true; |
|
| 244 | + } |
|
| 245 | + |
|
| 246 | + return false; |
|
| 247 | + } |
|
| 248 | 248 | } |
| 249 | 249 | \ No newline at end of file |
@@ -12,24 +12,24 @@ |
||
| 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('/repos/:owner/:repo/merges', |
|
| 29 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, [ |
|
| 30 | - 'base' => $base, |
|
| 31 | - 'head' => $head, |
|
| 32 | - 'commit_message' => $commitMessage |
|
| 33 | - ]); |
|
| 34 | - } |
|
| 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('/repos/:owner/:repo/merges', |
|
| 29 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, [ |
|
| 30 | + 'base' => $base, |
|
| 31 | + 'head' => $head, |
|
| 32 | + 'commit_message' => $commitMessage |
|
| 33 | + ]); |
|
| 34 | + } |
|
| 35 | 35 | } |
| 36 | 36 | \ No newline at end of file |
@@ -10,39 +10,39 @@ |
||
| 10 | 10 | class Pages extends AbstractRepositories |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * Get information about a Pages site |
|
| 15 | - * |
|
| 16 | - * @link https://developer.github.com/v3/repos/pages/#get-information-about-a-pages-site |
|
| 17 | - * @return array |
|
| 18 | - */ |
|
| 19 | - public function getInformation(): array |
|
| 20 | - { |
|
| 21 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pages', |
|
| 22 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 23 | - } |
|
| 13 | + /** |
|
| 14 | + * Get information about a Pages site |
|
| 15 | + * |
|
| 16 | + * @link https://developer.github.com/v3/repos/pages/#get-information-about-a-pages-site |
|
| 17 | + * @return array |
|
| 18 | + */ |
|
| 19 | + public function getInformation(): array |
|
| 20 | + { |
|
| 21 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pages', |
|
| 22 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * List Pages builds |
|
| 27 | - * |
|
| 28 | - * @link https://developer.github.com/v3/repos/pages/#list-pages-builds |
|
| 29 | - * @return array |
|
| 30 | - */ |
|
| 31 | - public function listPagesBuilds(): array |
|
| 32 | - { |
|
| 33 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pages/builds', |
|
| 34 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 35 | - } |
|
| 25 | + /** |
|
| 26 | + * List Pages builds |
|
| 27 | + * |
|
| 28 | + * @link https://developer.github.com/v3/repos/pages/#list-pages-builds |
|
| 29 | + * @return array |
|
| 30 | + */ |
|
| 31 | + public function listPagesBuilds(): array |
|
| 32 | + { |
|
| 33 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pages/builds', |
|
| 34 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * List latest Pages build |
|
| 39 | - * |
|
| 40 | - * @link https://developer.github.com/v3/repos/pages/#list-latest-pages-build |
|
| 41 | - * @return array |
|
| 42 | - */ |
|
| 43 | - public function listLatestPagesBuilds(): array |
|
| 44 | - { |
|
| 45 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pages/builds/latest', |
|
| 46 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 47 | - } |
|
| 37 | + /** |
|
| 38 | + * List latest Pages build |
|
| 39 | + * |
|
| 40 | + * @link https://developer.github.com/v3/repos/pages/#list-latest-pages-build |
|
| 41 | + * @return array |
|
| 42 | + */ |
|
| 43 | + public function listLatestPagesBuilds(): array |
|
| 44 | + { |
|
| 45 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pages/builds/latest', |
|
| 46 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
| 47 | + } |
|
| 48 | 48 | } |
| 49 | 49 | \ No newline at end of file |