@@ -13,35 +13,35 @@ |
||
13 | 13 | class Forks extends AbstractRepositories |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * List forks |
|
18 | - * |
|
19 | - * @link https://developer.github.com/v3/repos/forks/#list-forks |
|
20 | - * |
|
21 | - * @param string $sort |
|
22 | - * |
|
23 | - * @return array |
|
24 | - */ |
|
25 | - public function listForks(string $sort = AbstractApi::SORT_NEWEST): array |
|
26 | - { |
|
27 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/forks?:arg', |
|
28 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), |
|
29 | - http_build_query(['sort' => $sort]))); |
|
30 | - } |
|
16 | + /** |
|
17 | + * List forks |
|
18 | + * |
|
19 | + * @link https://developer.github.com/v3/repos/forks/#list-forks |
|
20 | + * |
|
21 | + * @param string $sort |
|
22 | + * |
|
23 | + * @return array |
|
24 | + */ |
|
25 | + public function listForks(string $sort = AbstractApi::SORT_NEWEST): array |
|
26 | + { |
|
27 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/forks?:arg', |
|
28 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), |
|
29 | + http_build_query(['sort' => $sort]))); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * Create a fork |
|
34 | - * |
|
35 | - * @link https://developer.github.com/v3/repos/forks/#create-a-fork |
|
36 | - * |
|
37 | - * @param string $organization |
|
38 | - * |
|
39 | - * @return array |
|
40 | - */ |
|
41 | - public function createFork(string $organization = ''): array |
|
42 | - { |
|
43 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/forks', |
|
44 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, |
|
45 | - ['organization' => $organization]); |
|
46 | - } |
|
32 | + /** |
|
33 | + * Create a fork |
|
34 | + * |
|
35 | + * @link https://developer.github.com/v3/repos/forks/#create-a-fork |
|
36 | + * |
|
37 | + * @param string $organization |
|
38 | + * |
|
39 | + * @return array |
|
40 | + */ |
|
41 | + public function createFork(string $organization = ''): array |
|
42 | + { |
|
43 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/forks', |
|
44 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, |
|
45 | + ['organization' => $organization]); |
|
46 | + } |
|
47 | 47 | } |
48 | 48 | \ No newline at end of file |
@@ -12,66 +12,66 @@ |
||
12 | 12 | class DeployKeys extends AbstractRepositories |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * List deploy keys |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/repos/keys/#list |
|
19 | - * @return array |
|
20 | - */ |
|
21 | - public function listDeployKeys(): array |
|
22 | - { |
|
23 | - return $this->getApi()->request($this->getApi() |
|
24 | - ->sprintf('/repos/:owner/:repo/keys', $this->getRepositories()->getOwner(), |
|
25 | - $this->getRepositories()->getRepo())); |
|
26 | - } |
|
15 | + /** |
|
16 | + * List deploy keys |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/repos/keys/#list |
|
19 | + * @return array |
|
20 | + */ |
|
21 | + public function listDeployKeys(): array |
|
22 | + { |
|
23 | + return $this->getApi()->request($this->getApi() |
|
24 | + ->sprintf('/repos/:owner/:repo/keys', $this->getRepositories()->getOwner(), |
|
25 | + $this->getRepositories()->getRepo())); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * Get a deploy key |
|
30 | - * |
|
31 | - * @link https://developer.github.com/v3/repos/keys/#get |
|
32 | - * |
|
33 | - * @param int $id |
|
34 | - * |
|
35 | - * @return array |
|
36 | - */ |
|
37 | - public function getDeployKey(int $id): array |
|
38 | - { |
|
39 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/keys/:id', |
|
40 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id)); |
|
41 | - } |
|
28 | + /** |
|
29 | + * Get a deploy key |
|
30 | + * |
|
31 | + * @link https://developer.github.com/v3/repos/keys/#get |
|
32 | + * |
|
33 | + * @param int $id |
|
34 | + * |
|
35 | + * @return array |
|
36 | + */ |
|
37 | + public function getDeployKey(int $id): array |
|
38 | + { |
|
39 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/keys/:id', |
|
40 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id)); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * Add a new deploy key |
|
45 | - * |
|
46 | - * @link https://developer.github.com/v3/repos/keys/#create |
|
47 | - * |
|
48 | - * @param string $title |
|
49 | - * @param string $key |
|
50 | - * |
|
51 | - * @return array |
|
52 | - */ |
|
53 | - public function addNewDeployKey(string $title, string $key): array |
|
54 | - { |
|
55 | - return $this->getApi()->request($this->getApi() |
|
56 | - ->sprintf('/repos/:owner/:repo/keys', $this->getRepositories()->getOwner(), |
|
57 | - $this->getRepositories()->getRepo()), Request::METHOD_POST, [ |
|
58 | - 'title' => $title, |
|
59 | - 'key' => $key |
|
60 | - ]); |
|
61 | - } |
|
43 | + /** |
|
44 | + * Add a new deploy key |
|
45 | + * |
|
46 | + * @link https://developer.github.com/v3/repos/keys/#create |
|
47 | + * |
|
48 | + * @param string $title |
|
49 | + * @param string $key |
|
50 | + * |
|
51 | + * @return array |
|
52 | + */ |
|
53 | + public function addNewDeployKey(string $title, string $key): array |
|
54 | + { |
|
55 | + return $this->getApi()->request($this->getApi() |
|
56 | + ->sprintf('/repos/:owner/:repo/keys', $this->getRepositories()->getOwner(), |
|
57 | + $this->getRepositories()->getRepo()), Request::METHOD_POST, [ |
|
58 | + 'title' => $title, |
|
59 | + 'key' => $key |
|
60 | + ]); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Remove a deploy key |
|
65 | - * |
|
66 | - * @link https://developer.github.com/v3/repos/keys/#delete |
|
67 | - * |
|
68 | - * @param int $id |
|
69 | - * |
|
70 | - * @return array |
|
71 | - */ |
|
72 | - public function removeDeployKey(int $id): array |
|
73 | - { |
|
74 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/keys/:id', |
|
75 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_DELETE); |
|
76 | - } |
|
63 | + /** |
|
64 | + * Remove a deploy key |
|
65 | + * |
|
66 | + * @link https://developer.github.com/v3/repos/keys/#delete |
|
67 | + * |
|
68 | + * @param int $id |
|
69 | + * |
|
70 | + * @return array |
|
71 | + */ |
|
72 | + public function removeDeployKey(int $id): array |
|
73 | + { |
|
74 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/keys/:id', |
|
75 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_DELETE); |
|
76 | + } |
|
77 | 77 | } |
78 | 78 | \ No newline at end of file |
@@ -12,58 +12,58 @@ |
||
12 | 12 | class Statuses extends AbstractRepositories |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Create a Status |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/repos/statuses/#create-a-status |
|
19 | - * |
|
20 | - * @param string $sha |
|
21 | - * @param string $state |
|
22 | - * @param string $targetUrl |
|
23 | - * @param string $description |
|
24 | - * @param string $context |
|
25 | - * |
|
26 | - * @return array |
|
27 | - */ |
|
28 | - public function createStatus(string $sha, string $state, string $targetUrl = null, string $description = null, |
|
29 | - string $context = 'default'): array |
|
30 | - { |
|
31 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/statuses/:sha', |
|
32 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $sha), Request::METHOD_POST, [ |
|
33 | - 'state' => $state, |
|
34 | - 'target_url' => $targetUrl, |
|
35 | - 'description' => $description, |
|
36 | - 'context' => $context |
|
37 | - ]); |
|
38 | - } |
|
15 | + /** |
|
16 | + * Create a Status |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/repos/statuses/#create-a-status |
|
19 | + * |
|
20 | + * @param string $sha |
|
21 | + * @param string $state |
|
22 | + * @param string $targetUrl |
|
23 | + * @param string $description |
|
24 | + * @param string $context |
|
25 | + * |
|
26 | + * @return array |
|
27 | + */ |
|
28 | + public function createStatus(string $sha, string $state, string $targetUrl = null, string $description = null, |
|
29 | + string $context = 'default'): array |
|
30 | + { |
|
31 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/statuses/:sha', |
|
32 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $sha), Request::METHOD_POST, [ |
|
33 | + 'state' => $state, |
|
34 | + 'target_url' => $targetUrl, |
|
35 | + 'description' => $description, |
|
36 | + 'context' => $context |
|
37 | + ]); |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * List Statuses for a specific Ref |
|
42 | - * |
|
43 | - * @link https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref |
|
44 | - * |
|
45 | - * @param string $ref |
|
46 | - * |
|
47 | - * @return array |
|
48 | - */ |
|
49 | - public function listStatuses(string $ref): array |
|
50 | - { |
|
51 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits/:ref/statuses', |
|
52 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $ref)); |
|
53 | - } |
|
40 | + /** |
|
41 | + * List Statuses for a specific Ref |
|
42 | + * |
|
43 | + * @link https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref |
|
44 | + * |
|
45 | + * @param string $ref |
|
46 | + * |
|
47 | + * @return array |
|
48 | + */ |
|
49 | + public function listStatuses(string $ref): array |
|
50 | + { |
|
51 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits/:ref/statuses', |
|
52 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $ref)); |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * Get the combined Status for a specific Ref |
|
57 | - * |
|
58 | - * @link https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref |
|
59 | - * |
|
60 | - * @param string $ref |
|
61 | - * |
|
62 | - * @return array |
|
63 | - */ |
|
64 | - public function getCombinedStatus(string $ref): array |
|
65 | - { |
|
66 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits/:ref/status', |
|
67 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $ref)); |
|
68 | - } |
|
55 | + /** |
|
56 | + * Get the combined Status for a specific Ref |
|
57 | + * |
|
58 | + * @link https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref |
|
59 | + * |
|
60 | + * @param string $ref |
|
61 | + * |
|
62 | + * @return array |
|
63 | + */ |
|
64 | + public function getCombinedStatus(string $ref): array |
|
65 | + { |
|
66 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits/:ref/status', |
|
67 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $ref)); |
|
68 | + } |
|
69 | 69 | } |
70 | 70 | \ No newline at end of file |
@@ -12,60 +12,60 @@ |
||
12 | 12 | class Commits extends AbstractRepositories |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * List commits on a repository |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository |
|
19 | - * |
|
20 | - * @param string $sha |
|
21 | - * @param string|null $path |
|
22 | - * @param string|null $author |
|
23 | - * @param string|null $since |
|
24 | - * @param string|null $until |
|
25 | - * |
|
26 | - * @return array |
|
27 | - */ |
|
28 | - public function listCommits(string $sha = AbstractApi::BRANCH_MASTER, string $path = null, string $author = null, |
|
29 | - string $since = null, string $until = null): array |
|
30 | - { |
|
31 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits?:args', |
|
32 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), http_build_query([ |
|
33 | - "sha" => $sha, |
|
34 | - "path" => $path, |
|
35 | - "author" => $author, |
|
36 | - "since" => $since, |
|
37 | - "until" => $until |
|
38 | - ]))); |
|
39 | - } |
|
15 | + /** |
|
16 | + * List commits on a repository |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository |
|
19 | + * |
|
20 | + * @param string $sha |
|
21 | + * @param string|null $path |
|
22 | + * @param string|null $author |
|
23 | + * @param string|null $since |
|
24 | + * @param string|null $until |
|
25 | + * |
|
26 | + * @return array |
|
27 | + */ |
|
28 | + public function listCommits(string $sha = AbstractApi::BRANCH_MASTER, string $path = null, string $author = null, |
|
29 | + string $since = null, string $until = null): array |
|
30 | + { |
|
31 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits?:args', |
|
32 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), http_build_query([ |
|
33 | + "sha" => $sha, |
|
34 | + "path" => $path, |
|
35 | + "author" => $author, |
|
36 | + "since" => $since, |
|
37 | + "until" => $until |
|
38 | + ]))); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * Get a single commit |
|
43 | - * |
|
44 | - * @link https://developer.github.com/v3/repos/commits/#get-a-single-commit |
|
45 | - * |
|
46 | - * @param string $sha |
|
47 | - * |
|
48 | - * @return array |
|
49 | - */ |
|
50 | - public function getSingleCommit(string $sha): array |
|
51 | - { |
|
52 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits/:sha', |
|
53 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $sha)); |
|
54 | - } |
|
41 | + /** |
|
42 | + * Get a single commit |
|
43 | + * |
|
44 | + * @link https://developer.github.com/v3/repos/commits/#get-a-single-commit |
|
45 | + * |
|
46 | + * @param string $sha |
|
47 | + * |
|
48 | + * @return array |
|
49 | + */ |
|
50 | + public function getSingleCommit(string $sha): array |
|
51 | + { |
|
52 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits/:sha', |
|
53 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $sha)); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * Compare two commits |
|
58 | - * |
|
59 | - * @link https://developer.github.com/v3/repos/commits/#compare-two-commits |
|
60 | - * |
|
61 | - * @param string $base |
|
62 | - * @param string $head |
|
63 | - * |
|
64 | - * @return array |
|
65 | - */ |
|
66 | - public function compareTwoCommits(string $base, string $head): array |
|
67 | - { |
|
68 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/compare/:base...:head', |
|
69 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $base, $head)); |
|
70 | - } |
|
56 | + /** |
|
57 | + * Compare two commits |
|
58 | + * |
|
59 | + * @link https://developer.github.com/v3/repos/commits/#compare-two-commits |
|
60 | + * |
|
61 | + * @param string $base |
|
62 | + * @param string $head |
|
63 | + * |
|
64 | + * @return array |
|
65 | + */ |
|
66 | + public function compareTwoCommits(string $base, string $head): array |
|
67 | + { |
|
68 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/compare/:base...:head', |
|
69 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $base, $head)); |
|
70 | + } |
|
71 | 71 | } |
@@ -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 |
@@ -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 |