@@ -10,78 +10,78 @@ |
||
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( |
|
22 | - '/repos/:owner/:repo/stats/contributors', |
|
23 | - $this->getRepositories()->getOwner(), |
|
24 | - $this->getRepositories()->getRepo() |
|
25 | - )); |
|
26 | - } |
|
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( |
|
22 | + '/repos/:owner/:repo/stats/contributors', |
|
23 | + $this->getRepositories()->getOwner(), |
|
24 | + $this->getRepositories()->getRepo() |
|
25 | + )); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * Get the last year of commit activity data |
|
30 | - * |
|
31 | - * @link https://developer.github.com/v3/repos/statistics/#commit-activity |
|
32 | - * @return array |
|
33 | - */ |
|
34 | - public function getCommitActivity(): array |
|
35 | - { |
|
36 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
37 | - '/repos/:owner/:repo/stats/commit_activity', |
|
38 | - $this->getRepositories()->getOwner(), |
|
39 | - $this->getRepositories()->getRepo() |
|
40 | - )); |
|
41 | - } |
|
28 | + /** |
|
29 | + * Get the last year of commit activity data |
|
30 | + * |
|
31 | + * @link https://developer.github.com/v3/repos/statistics/#commit-activity |
|
32 | + * @return array |
|
33 | + */ |
|
34 | + public function getCommitActivity(): array |
|
35 | + { |
|
36 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
37 | + '/repos/:owner/:repo/stats/commit_activity', |
|
38 | + $this->getRepositories()->getOwner(), |
|
39 | + $this->getRepositories()->getRepo() |
|
40 | + )); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * Get the number of additions and deletions per week |
|
45 | - * |
|
46 | - * @link https://developer.github.com/v3/repos/statistics/#code-frequency |
|
47 | - * @return array |
|
48 | - */ |
|
49 | - public function getCodeFrequency(): array |
|
50 | - { |
|
51 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
52 | - '/repos/:owner/:repo/stats/code_frequency', |
|
53 | - $this->getRepositories()->getOwner(), |
|
54 | - $this->getRepositories()->getRepo() |
|
55 | - )); |
|
56 | - } |
|
43 | + /** |
|
44 | + * Get the number of additions and deletions per week |
|
45 | + * |
|
46 | + * @link https://developer.github.com/v3/repos/statistics/#code-frequency |
|
47 | + * @return array |
|
48 | + */ |
|
49 | + public function getCodeFrequency(): array |
|
50 | + { |
|
51 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
52 | + '/repos/:owner/:repo/stats/code_frequency', |
|
53 | + $this->getRepositories()->getOwner(), |
|
54 | + $this->getRepositories()->getRepo() |
|
55 | + )); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * Get the weekly commit count for the repository owner and everyone else |
|
60 | - * |
|
61 | - * @link https://developer.github.com/v3/repos/statistics/#participation |
|
62 | - * @return array |
|
63 | - */ |
|
64 | - public function getParticipation(): array |
|
65 | - { |
|
66 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
67 | - '/repos/:owner/:repo/stats/participation', |
|
68 | - $this->getRepositories()->getOwner(), |
|
69 | - $this->getRepositories()->getRepo() |
|
70 | - )); |
|
71 | - } |
|
58 | + /** |
|
59 | + * Get the weekly commit count for the repository owner and everyone else |
|
60 | + * |
|
61 | + * @link https://developer.github.com/v3/repos/statistics/#participation |
|
62 | + * @return array |
|
63 | + */ |
|
64 | + public function getParticipation(): array |
|
65 | + { |
|
66 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
67 | + '/repos/:owner/:repo/stats/participation', |
|
68 | + $this->getRepositories()->getOwner(), |
|
69 | + $this->getRepositories()->getRepo() |
|
70 | + )); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Get the number of commits per hour in each day |
|
75 | - * |
|
76 | - * @link https://developer.github.com/v3/repos/statistics/#punch-card |
|
77 | - * @return array |
|
78 | - */ |
|
79 | - public function getPunchCard(): array |
|
80 | - { |
|
81 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
82 | - '/repos/:owner/:repo/stats/punch_card', |
|
83 | - $this->getRepositories()->getOwner(), |
|
84 | - $this->getRepositories()->getRepo() |
|
85 | - )); |
|
86 | - } |
|
73 | + /** |
|
74 | + * Get the number of commits per hour in each day |
|
75 | + * |
|
76 | + * @link https://developer.github.com/v3/repos/statistics/#punch-card |
|
77 | + * @return array |
|
78 | + */ |
|
79 | + public function getPunchCard(): array |
|
80 | + { |
|
81 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
82 | + '/repos/:owner/:repo/stats/punch_card', |
|
83 | + $this->getRepositories()->getOwner(), |
|
84 | + $this->getRepositories()->getRepo() |
|
85 | + )); |
|
86 | + } |
|
87 | 87 | } |
@@ -12,77 +12,77 @@ |
||
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( |
|
29 | - string $sha = AbstractApi::BRANCH_MASTER, |
|
30 | - string $path = null, |
|
31 | - string $author = null, |
|
32 | - string $since = null, |
|
33 | - string $until = null |
|
34 | - ): array { |
|
35 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
36 | - '/repos/:owner/:repo/commits?:args', |
|
37 | - $this->getRepositories()->getOwner(), |
|
38 | - $this->getRepositories()->getRepo(), |
|
39 | - http_build_query([ |
|
40 | - "sha" => $sha, |
|
41 | - "path" => $path, |
|
42 | - "author" => $author, |
|
43 | - "since" => $since, |
|
44 | - "until" => $until |
|
45 | - ]) |
|
46 | - )); |
|
47 | - } |
|
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( |
|
29 | + string $sha = AbstractApi::BRANCH_MASTER, |
|
30 | + string $path = null, |
|
31 | + string $author = null, |
|
32 | + string $since = null, |
|
33 | + string $until = null |
|
34 | + ): array { |
|
35 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
36 | + '/repos/:owner/:repo/commits?:args', |
|
37 | + $this->getRepositories()->getOwner(), |
|
38 | + $this->getRepositories()->getRepo(), |
|
39 | + http_build_query([ |
|
40 | + "sha" => $sha, |
|
41 | + "path" => $path, |
|
42 | + "author" => $author, |
|
43 | + "since" => $since, |
|
44 | + "until" => $until |
|
45 | + ]) |
|
46 | + )); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Get a single commit |
|
51 | - * |
|
52 | - * @link https://developer.github.com/v3/repos/commits/#get-a-single-commit |
|
53 | - * |
|
54 | - * @param string $sha |
|
55 | - * |
|
56 | - * @return array |
|
57 | - */ |
|
58 | - public function getSingleCommit(string $sha): array |
|
59 | - { |
|
60 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
61 | - '/repos/:owner/:repo/commits/:sha', |
|
62 | - $this->getRepositories()->getOwner(), |
|
63 | - $this->getRepositories()->getRepo(), |
|
64 | - $sha |
|
65 | - )); |
|
66 | - } |
|
49 | + /** |
|
50 | + * Get a single commit |
|
51 | + * |
|
52 | + * @link https://developer.github.com/v3/repos/commits/#get-a-single-commit |
|
53 | + * |
|
54 | + * @param string $sha |
|
55 | + * |
|
56 | + * @return array |
|
57 | + */ |
|
58 | + public function getSingleCommit(string $sha): array |
|
59 | + { |
|
60 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
61 | + '/repos/:owner/:repo/commits/:sha', |
|
62 | + $this->getRepositories()->getOwner(), |
|
63 | + $this->getRepositories()->getRepo(), |
|
64 | + $sha |
|
65 | + )); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Compare two commits |
|
70 | - * |
|
71 | - * @link https://developer.github.com/v3/repos/commits/#compare-two-commits |
|
72 | - * |
|
73 | - * @param string $base |
|
74 | - * @param string $head |
|
75 | - * |
|
76 | - * @return array |
|
77 | - */ |
|
78 | - public function compareTwoCommits(string $base, string $head): array |
|
79 | - { |
|
80 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
81 | - '/repos/:owner/:repo/compare/:base...:head', |
|
82 | - $this->getRepositories()->getOwner(), |
|
83 | - $this->getRepositories()->getRepo(), |
|
84 | - $base, |
|
85 | - $head |
|
86 | - )); |
|
87 | - } |
|
68 | + /** |
|
69 | + * Compare two commits |
|
70 | + * |
|
71 | + * @link https://developer.github.com/v3/repos/commits/#compare-two-commits |
|
72 | + * |
|
73 | + * @param string $base |
|
74 | + * @param string $head |
|
75 | + * |
|
76 | + * @return array |
|
77 | + */ |
|
78 | + public function compareTwoCommits(string $base, string $head): array |
|
79 | + { |
|
80 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
81 | + '/repos/:owner/:repo/compare/:base...:head', |
|
82 | + $this->getRepositories()->getOwner(), |
|
83 | + $this->getRepositories()->getRepo(), |
|
84 | + $base, |
|
85 | + $head |
|
86 | + )); |
|
87 | + } |
|
88 | 88 | } |
@@ -12,74 +12,74 @@ |
||
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( |
|
29 | - string $sha, |
|
30 | - string $state, |
|
31 | - string $targetUrl = null, |
|
32 | - string $description = null, |
|
33 | - string $context = 'default' |
|
34 | - ): array { |
|
35 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
36 | - '/repos/:owner/:repo/statuses/:sha', |
|
37 | - $this->getRepositories()->getOwner(), |
|
38 | - $this->getRepositories()->getRepo(), |
|
39 | - $sha |
|
40 | - ), Request::METHOD_POST, [ |
|
41 | - 'state' => $state, |
|
42 | - 'target_url' => $targetUrl, |
|
43 | - 'description' => $description, |
|
44 | - 'context' => $context |
|
45 | - ]); |
|
46 | - } |
|
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( |
|
29 | + string $sha, |
|
30 | + string $state, |
|
31 | + string $targetUrl = null, |
|
32 | + string $description = null, |
|
33 | + string $context = 'default' |
|
34 | + ): array { |
|
35 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
36 | + '/repos/:owner/:repo/statuses/:sha', |
|
37 | + $this->getRepositories()->getOwner(), |
|
38 | + $this->getRepositories()->getRepo(), |
|
39 | + $sha |
|
40 | + ), Request::METHOD_POST, [ |
|
41 | + 'state' => $state, |
|
42 | + 'target_url' => $targetUrl, |
|
43 | + 'description' => $description, |
|
44 | + 'context' => $context |
|
45 | + ]); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * List Statuses for a specific Ref |
|
50 | - * |
|
51 | - * @link https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref |
|
52 | - * |
|
53 | - * @param string $ref |
|
54 | - * |
|
55 | - * @return array |
|
56 | - */ |
|
57 | - public function listStatuses(string $ref): array |
|
58 | - { |
|
59 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
60 | - '/repos/:owner/:repo/commits/:ref/statuses', |
|
61 | - $this->getRepositories()->getOwner(), |
|
62 | - $this->getRepositories()->getRepo(), |
|
63 | - $ref |
|
64 | - )); |
|
65 | - } |
|
48 | + /** |
|
49 | + * List Statuses for a specific Ref |
|
50 | + * |
|
51 | + * @link https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref |
|
52 | + * |
|
53 | + * @param string $ref |
|
54 | + * |
|
55 | + * @return array |
|
56 | + */ |
|
57 | + public function listStatuses(string $ref): array |
|
58 | + { |
|
59 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
60 | + '/repos/:owner/:repo/commits/:ref/statuses', |
|
61 | + $this->getRepositories()->getOwner(), |
|
62 | + $this->getRepositories()->getRepo(), |
|
63 | + $ref |
|
64 | + )); |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * Get the combined Status for a specific Ref |
|
69 | - * |
|
70 | - * @link https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref |
|
71 | - * |
|
72 | - * @param string $ref |
|
73 | - * |
|
74 | - * @return array |
|
75 | - */ |
|
76 | - public function getCombinedStatus(string $ref): array |
|
77 | - { |
|
78 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
79 | - '/repos/:owner/:repo/commits/:ref/status', |
|
80 | - $this->getRepositories()->getOwner(), |
|
81 | - $this->getRepositories()->getRepo(), |
|
82 | - $ref |
|
83 | - )); |
|
84 | - } |
|
67 | + /** |
|
68 | + * Get the combined Status for a specific Ref |
|
69 | + * |
|
70 | + * @link https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref |
|
71 | + * |
|
72 | + * @param string $ref |
|
73 | + * |
|
74 | + * @return array |
|
75 | + */ |
|
76 | + public function getCombinedStatus(string $ref): array |
|
77 | + { |
|
78 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
79 | + '/repos/:owner/:repo/commits/:ref/status', |
|
80 | + $this->getRepositories()->getOwner(), |
|
81 | + $this->getRepositories()->getRepo(), |
|
82 | + $ref |
|
83 | + )); |
|
84 | + } |
|
85 | 85 | } |
@@ -12,156 +12,156 @@ |
||
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( |
|
24 | - '/repos/:owner/:repo/hooks', |
|
25 | - $this->getRepositories()->getOwner(), |
|
26 | - $this->getRepositories()->getRepo() |
|
27 | - )); |
|
28 | - } |
|
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( |
|
24 | + '/repos/:owner/:repo/hooks', |
|
25 | + $this->getRepositories()->getOwner(), |
|
26 | + $this->getRepositories()->getRepo() |
|
27 | + )); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Get single hook |
|
32 | - * |
|
33 | - * @link https://developer.github.com/v3/repos/hooks/#get-single-hook |
|
34 | - * |
|
35 | - * @param int $id |
|
36 | - * |
|
37 | - * @return array |
|
38 | - */ |
|
39 | - public function getSingleHook(int $id): array |
|
40 | - { |
|
41 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
42 | - '/repos/:owner/:repo/hooks/:id', |
|
43 | - $this->getRepositories()->getOwner(), |
|
44 | - $this->getRepositories()->getRepo(), |
|
45 | - $id |
|
46 | - )); |
|
47 | - } |
|
30 | + /** |
|
31 | + * Get single hook |
|
32 | + * |
|
33 | + * @link https://developer.github.com/v3/repos/hooks/#get-single-hook |
|
34 | + * |
|
35 | + * @param int $id |
|
36 | + * |
|
37 | + * @return array |
|
38 | + */ |
|
39 | + public function getSingleHook(int $id): array |
|
40 | + { |
|
41 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
42 | + '/repos/:owner/:repo/hooks/:id', |
|
43 | + $this->getRepositories()->getOwner(), |
|
44 | + $this->getRepositories()->getRepo(), |
|
45 | + $id |
|
46 | + )); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Create a hook |
|
51 | - * |
|
52 | - * @link https://developer.github.com/v3/repos/hooks/#create-a-hook |
|
53 | - * |
|
54 | - * @param string $name |
|
55 | - * @param string $config |
|
56 | - * @param array $events |
|
57 | - * @param bool $active |
|
58 | - * |
|
59 | - * @return array |
|
60 | - */ |
|
61 | - public function createHook(string $name, string $config, array $events = ['push'], bool $active = true): array |
|
62 | - { |
|
63 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
64 | - '/repos/:owner/:repo/hooks', |
|
65 | - $this->getRepositories()->getOwner(), |
|
66 | - $this->getRepositories()->getRepo() |
|
67 | - ), Request::METHOD_POST, [ |
|
68 | - 'name' => $name, |
|
69 | - 'config' => $config, |
|
70 | - 'events' => $events, |
|
71 | - 'active' => $active |
|
72 | - ]); |
|
73 | - } |
|
49 | + /** |
|
50 | + * Create a hook |
|
51 | + * |
|
52 | + * @link https://developer.github.com/v3/repos/hooks/#create-a-hook |
|
53 | + * |
|
54 | + * @param string $name |
|
55 | + * @param string $config |
|
56 | + * @param array $events |
|
57 | + * @param bool $active |
|
58 | + * |
|
59 | + * @return array |
|
60 | + */ |
|
61 | + public function createHook(string $name, string $config, array $events = ['push'], bool $active = true): array |
|
62 | + { |
|
63 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
64 | + '/repos/:owner/:repo/hooks', |
|
65 | + $this->getRepositories()->getOwner(), |
|
66 | + $this->getRepositories()->getRepo() |
|
67 | + ), Request::METHOD_POST, [ |
|
68 | + 'name' => $name, |
|
69 | + 'config' => $config, |
|
70 | + 'events' => $events, |
|
71 | + 'active' => $active |
|
72 | + ]); |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * Edit a hook |
|
77 | - * |
|
78 | - * @link https://developer.github.com/v3/repos/hooks/#edit-a-hook |
|
79 | - * |
|
80 | - * @param int $id |
|
81 | - * @param string $config |
|
82 | - * @param array $events |
|
83 | - * @param array $addEvents |
|
84 | - * @param array $removeEvents |
|
85 | - * @param bool $active |
|
86 | - * |
|
87 | - * @return array |
|
88 | - */ |
|
89 | - public function editHook( |
|
90 | - int $id, |
|
91 | - string $config, |
|
92 | - array $events = ['push'], |
|
93 | - array $addEvents = [], |
|
94 | - array $removeEvents = [], |
|
95 | - bool $active = true |
|
96 | - ): array { |
|
97 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
98 | - '/repos/:owner/:repo/hooks/:id', |
|
99 | - $this->getRepositories()->getOwner(), |
|
100 | - $this->getRepositories()->getRepo(), |
|
101 | - $id |
|
102 | - ), Request::METHOD_PATCH, [ |
|
103 | - 'config' => $config, |
|
104 | - 'events' => $events, |
|
105 | - 'add_events' => $addEvents, |
|
106 | - 'remove_events' => $removeEvents, |
|
107 | - 'active' => $active |
|
108 | - ]); |
|
109 | - } |
|
75 | + /** |
|
76 | + * Edit a hook |
|
77 | + * |
|
78 | + * @link https://developer.github.com/v3/repos/hooks/#edit-a-hook |
|
79 | + * |
|
80 | + * @param int $id |
|
81 | + * @param string $config |
|
82 | + * @param array $events |
|
83 | + * @param array $addEvents |
|
84 | + * @param array $removeEvents |
|
85 | + * @param bool $active |
|
86 | + * |
|
87 | + * @return array |
|
88 | + */ |
|
89 | + public function editHook( |
|
90 | + int $id, |
|
91 | + string $config, |
|
92 | + array $events = ['push'], |
|
93 | + array $addEvents = [], |
|
94 | + array $removeEvents = [], |
|
95 | + bool $active = true |
|
96 | + ): array { |
|
97 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
98 | + '/repos/:owner/:repo/hooks/:id', |
|
99 | + $this->getRepositories()->getOwner(), |
|
100 | + $this->getRepositories()->getRepo(), |
|
101 | + $id |
|
102 | + ), Request::METHOD_PATCH, [ |
|
103 | + 'config' => $config, |
|
104 | + 'events' => $events, |
|
105 | + 'add_events' => $addEvents, |
|
106 | + 'remove_events' => $removeEvents, |
|
107 | + 'active' => $active |
|
108 | + ]); |
|
109 | + } |
|
110 | 110 | |
111 | - /** |
|
112 | - * Test a push hook |
|
113 | - * |
|
114 | - * @link https://developer.github.com/v3/repos/hooks/#test-a-push-hook |
|
115 | - * |
|
116 | - * @param int $id |
|
117 | - * |
|
118 | - * @return array |
|
119 | - */ |
|
120 | - public function testPushHook(int $id): array |
|
121 | - { |
|
122 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
123 | - '/repos/:owner/:repo/hooks/:id/tests', |
|
124 | - $this->getRepositories()->getOwner(), |
|
125 | - $this->getRepositories()->getRepo(), |
|
126 | - $id |
|
127 | - ), Request::METHOD_POST); |
|
128 | - } |
|
111 | + /** |
|
112 | + * Test a push hook |
|
113 | + * |
|
114 | + * @link https://developer.github.com/v3/repos/hooks/#test-a-push-hook |
|
115 | + * |
|
116 | + * @param int $id |
|
117 | + * |
|
118 | + * @return array |
|
119 | + */ |
|
120 | + public function testPushHook(int $id): array |
|
121 | + { |
|
122 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
123 | + '/repos/:owner/:repo/hooks/:id/tests', |
|
124 | + $this->getRepositories()->getOwner(), |
|
125 | + $this->getRepositories()->getRepo(), |
|
126 | + $id |
|
127 | + ), Request::METHOD_POST); |
|
128 | + } |
|
129 | 129 | |
130 | - /** |
|
131 | - * Ping a hook |
|
132 | - * |
|
133 | - * @link https://developer.github.com/v3/repos/hooks/#ping-a-hook |
|
134 | - * |
|
135 | - * @param int $id |
|
136 | - * |
|
137 | - * @return array |
|
138 | - */ |
|
139 | - public function pingHook(int $id): array |
|
140 | - { |
|
141 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
142 | - '/repos/:owner/:repo/hooks/:id/pings', |
|
143 | - $this->getRepositories()->getOwner(), |
|
144 | - $this->getRepositories()->getRepo(), |
|
145 | - $id |
|
146 | - ), Request::METHOD_POST); |
|
147 | - } |
|
130 | + /** |
|
131 | + * Ping a hook |
|
132 | + * |
|
133 | + * @link https://developer.github.com/v3/repos/hooks/#ping-a-hook |
|
134 | + * |
|
135 | + * @param int $id |
|
136 | + * |
|
137 | + * @return array |
|
138 | + */ |
|
139 | + public function pingHook(int $id): array |
|
140 | + { |
|
141 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
142 | + '/repos/:owner/:repo/hooks/:id/pings', |
|
143 | + $this->getRepositories()->getOwner(), |
|
144 | + $this->getRepositories()->getRepo(), |
|
145 | + $id |
|
146 | + ), Request::METHOD_POST); |
|
147 | + } |
|
148 | 148 | |
149 | - /** |
|
150 | - * Delete a hook |
|
151 | - * |
|
152 | - * @link https://developer.github.com/v3/repos/hooks/#delete-a-hook |
|
153 | - * |
|
154 | - * @param int $id |
|
155 | - * |
|
156 | - * @return array |
|
157 | - */ |
|
158 | - public function deleteHook(int $id): array |
|
159 | - { |
|
160 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
161 | - '/repos/:owner/:repo/hooks/:id', |
|
162 | - $this->getRepositories()->getOwner(), |
|
163 | - $this->getRepositories()->getRepo(), |
|
164 | - $id |
|
165 | - ), Request::METHOD_DELETE); |
|
166 | - } |
|
149 | + /** |
|
150 | + * Delete a hook |
|
151 | + * |
|
152 | + * @link https://developer.github.com/v3/repos/hooks/#delete-a-hook |
|
153 | + * |
|
154 | + * @param int $id |
|
155 | + * |
|
156 | + * @return array |
|
157 | + */ |
|
158 | + public function deleteHook(int $id): array |
|
159 | + { |
|
160 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
161 | + '/repos/:owner/:repo/hooks/:id', |
|
162 | + $this->getRepositories()->getOwner(), |
|
163 | + $this->getRepositories()->getRepo(), |
|
164 | + $id |
|
165 | + ), Request::METHOD_DELETE); |
|
166 | + } |
|
167 | 167 | } |
@@ -14,292 +14,292 @@ |
||
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( |
|
26 | - '/repos/:owner/:repo/releases', |
|
27 | - $this->getRepositories()->getOwner(), |
|
28 | - $this->getRepositories()->getRepo() |
|
29 | - )); |
|
30 | - } |
|
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( |
|
26 | + '/repos/:owner/:repo/releases', |
|
27 | + $this->getRepositories()->getOwner(), |
|
28 | + $this->getRepositories()->getRepo() |
|
29 | + )); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * Get a single release |
|
34 | - * |
|
35 | - * @link https://developer.github.com/v3/repos/releases/#get-a-single-release |
|
36 | - * |
|
37 | - * @param string $id |
|
38 | - * |
|
39 | - * @return array |
|
40 | - */ |
|
41 | - public function getSingleRelease(string $id): array |
|
42 | - { |
|
43 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
44 | - '/repos/:owner/:repo/releases/:id', |
|
45 | - $this->getRepositories()->getOwner(), |
|
46 | - $this->getRepositories()->getRepo(), |
|
47 | - $id |
|
48 | - )); |
|
49 | - } |
|
32 | + /** |
|
33 | + * Get a single release |
|
34 | + * |
|
35 | + * @link https://developer.github.com/v3/repos/releases/#get-a-single-release |
|
36 | + * |
|
37 | + * @param string $id |
|
38 | + * |
|
39 | + * @return array |
|
40 | + */ |
|
41 | + public function getSingleRelease(string $id): array |
|
42 | + { |
|
43 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
44 | + '/repos/:owner/:repo/releases/:id', |
|
45 | + $this->getRepositories()->getOwner(), |
|
46 | + $this->getRepositories()->getRepo(), |
|
47 | + $id |
|
48 | + )); |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Get the latest release |
|
53 | - * |
|
54 | - * @link https://developer.github.com/v3/repos/releases/#get-the-latest-release |
|
55 | - * @return array |
|
56 | - * @throws \Exception |
|
57 | - */ |
|
58 | - public function getLatestRelease(): array |
|
59 | - { |
|
60 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
61 | - '/repos/:owner/:repo/releases/latest', |
|
62 | - $this->getRepositories()->getOwner(), |
|
63 | - $this->getRepositories()->getRepo() |
|
64 | - )); |
|
65 | - } |
|
51 | + /** |
|
52 | + * Get the latest release |
|
53 | + * |
|
54 | + * @link https://developer.github.com/v3/repos/releases/#get-the-latest-release |
|
55 | + * @return array |
|
56 | + * @throws \Exception |
|
57 | + */ |
|
58 | + public function getLatestRelease(): array |
|
59 | + { |
|
60 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
61 | + '/repos/:owner/:repo/releases/latest', |
|
62 | + $this->getRepositories()->getOwner(), |
|
63 | + $this->getRepositories()->getRepo() |
|
64 | + )); |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * Get a release by tag name |
|
69 | - * |
|
70 | - * @link https://developer.github.com/v3/repos/releases/#get-a-release-by-tag-name |
|
71 | - * |
|
72 | - * @param string $tag |
|
73 | - * |
|
74 | - * @return array |
|
75 | - * @throws \Exception |
|
76 | - */ |
|
77 | - public function getReleaseByTagName(string $tag): array |
|
78 | - { |
|
79 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
80 | - '/repos/:owner/:repo/releases/tags/:tag', |
|
81 | - $this->getRepositories()->getOwner(), |
|
82 | - $this->getRepositories()->getRepo(), |
|
83 | - $tag |
|
84 | - )); |
|
85 | - } |
|
67 | + /** |
|
68 | + * Get a release by tag name |
|
69 | + * |
|
70 | + * @link https://developer.github.com/v3/repos/releases/#get-a-release-by-tag-name |
|
71 | + * |
|
72 | + * @param string $tag |
|
73 | + * |
|
74 | + * @return array |
|
75 | + * @throws \Exception |
|
76 | + */ |
|
77 | + public function getReleaseByTagName(string $tag): array |
|
78 | + { |
|
79 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
80 | + '/repos/:owner/:repo/releases/tags/:tag', |
|
81 | + $this->getRepositories()->getOwner(), |
|
82 | + $this->getRepositories()->getRepo(), |
|
83 | + $tag |
|
84 | + )); |
|
85 | + } |
|
86 | 86 | |
87 | - /** |
|
88 | - * Create a release |
|
89 | - * |
|
90 | - * @link https://developer.github.com/v3/repos/releases/#create-a-release |
|
91 | - * |
|
92 | - * @param string $tagName |
|
93 | - * @param string $targetCommitish |
|
94 | - * @param string $name |
|
95 | - * @param string $body |
|
96 | - * @param bool $draft |
|
97 | - * @param bool $preRelease |
|
98 | - * |
|
99 | - * @return array |
|
100 | - */ |
|
101 | - public function createRelease( |
|
102 | - string $tagName, |
|
103 | - string $targetCommitish = AbstractApi::BRANCH_MASTER, |
|
104 | - string $name = null, |
|
105 | - string $body = null, |
|
106 | - bool $draft = false, |
|
107 | - bool $preRelease = false |
|
108 | - ): array { |
|
109 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
110 | - '/repos/:owner/:repo/releases', |
|
111 | - $this->getRepositories()->getOwner(), |
|
112 | - $this->getRepositories()->getRepo() |
|
113 | - ), Request::METHOD_POST, [ |
|
114 | - 'tag_name' => $tagName, |
|
115 | - 'target_commitish' => $targetCommitish, |
|
116 | - 'name' => $name, |
|
117 | - 'body' => $body, |
|
118 | - 'draft' => $draft, |
|
119 | - 'prerelease' => $preRelease |
|
120 | - ]); |
|
121 | - } |
|
87 | + /** |
|
88 | + * Create a release |
|
89 | + * |
|
90 | + * @link https://developer.github.com/v3/repos/releases/#create-a-release |
|
91 | + * |
|
92 | + * @param string $tagName |
|
93 | + * @param string $targetCommitish |
|
94 | + * @param string $name |
|
95 | + * @param string $body |
|
96 | + * @param bool $draft |
|
97 | + * @param bool $preRelease |
|
98 | + * |
|
99 | + * @return array |
|
100 | + */ |
|
101 | + public function createRelease( |
|
102 | + string $tagName, |
|
103 | + string $targetCommitish = AbstractApi::BRANCH_MASTER, |
|
104 | + string $name = null, |
|
105 | + string $body = null, |
|
106 | + bool $draft = false, |
|
107 | + bool $preRelease = false |
|
108 | + ): array { |
|
109 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
110 | + '/repos/:owner/:repo/releases', |
|
111 | + $this->getRepositories()->getOwner(), |
|
112 | + $this->getRepositories()->getRepo() |
|
113 | + ), Request::METHOD_POST, [ |
|
114 | + 'tag_name' => $tagName, |
|
115 | + 'target_commitish' => $targetCommitish, |
|
116 | + 'name' => $name, |
|
117 | + 'body' => $body, |
|
118 | + 'draft' => $draft, |
|
119 | + 'prerelease' => $preRelease |
|
120 | + ]); |
|
121 | + } |
|
122 | 122 | |
123 | - /** |
|
124 | - * Edit a release |
|
125 | - * |
|
126 | - * @link https://developer.github.com/v3/repos/releases/#edit-a-release |
|
127 | - * |
|
128 | - * @param string $id |
|
129 | - * @param string $tagName |
|
130 | - * @param string $targetCommitish |
|
131 | - * @param string $name |
|
132 | - * @param string $body |
|
133 | - * @param bool $draft |
|
134 | - * @param bool $preRelease |
|
135 | - * |
|
136 | - * @return array |
|
137 | - */ |
|
138 | - public function editRelease( |
|
139 | - string $id, |
|
140 | - string $tagName, |
|
141 | - string $targetCommitish = AbstractApi::BRANCH_MASTER, |
|
142 | - string $name, |
|
143 | - string $body, |
|
144 | - bool $draft = false, |
|
145 | - bool $preRelease = false |
|
146 | - ): array { |
|
147 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
148 | - '/repos/:owner/:repo/releases/:id', |
|
149 | - $this->getRepositories()->getOwner(), |
|
150 | - $this->getRepositories()->getRepo(), |
|
151 | - $id |
|
152 | - ), Request::METHOD_PATCH, [ |
|
153 | - 'tag_name' => $tagName, |
|
154 | - 'target_commitish' => $targetCommitish, |
|
155 | - 'name' => $name, |
|
156 | - 'body' => $body, |
|
157 | - 'draft' => $draft, |
|
158 | - 'prerelease' => $preRelease |
|
159 | - ]); |
|
160 | - } |
|
123 | + /** |
|
124 | + * Edit a release |
|
125 | + * |
|
126 | + * @link https://developer.github.com/v3/repos/releases/#edit-a-release |
|
127 | + * |
|
128 | + * @param string $id |
|
129 | + * @param string $tagName |
|
130 | + * @param string $targetCommitish |
|
131 | + * @param string $name |
|
132 | + * @param string $body |
|
133 | + * @param bool $draft |
|
134 | + * @param bool $preRelease |
|
135 | + * |
|
136 | + * @return array |
|
137 | + */ |
|
138 | + public function editRelease( |
|
139 | + string $id, |
|
140 | + string $tagName, |
|
141 | + string $targetCommitish = AbstractApi::BRANCH_MASTER, |
|
142 | + string $name, |
|
143 | + string $body, |
|
144 | + bool $draft = false, |
|
145 | + bool $preRelease = false |
|
146 | + ): array { |
|
147 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
148 | + '/repos/:owner/:repo/releases/:id', |
|
149 | + $this->getRepositories()->getOwner(), |
|
150 | + $this->getRepositories()->getRepo(), |
|
151 | + $id |
|
152 | + ), Request::METHOD_PATCH, [ |
|
153 | + 'tag_name' => $tagName, |
|
154 | + 'target_commitish' => $targetCommitish, |
|
155 | + 'name' => $name, |
|
156 | + 'body' => $body, |
|
157 | + 'draft' => $draft, |
|
158 | + 'prerelease' => $preRelease |
|
159 | + ]); |
|
160 | + } |
|
161 | 161 | |
162 | - /** |
|
163 | - * Delete a release |
|
164 | - * |
|
165 | - * @link https://developer.github.com/v3/repos/releases/#delete-a-release |
|
166 | - * |
|
167 | - * @param string $id |
|
168 | - * |
|
169 | - * @return bool |
|
170 | - */ |
|
171 | - public function deleteRelease(string $id): bool |
|
172 | - { |
|
173 | - $this->getApi()->request($this->getApi()->sprintf( |
|
174 | - '/repos/:owner/:repo/releases/:id', |
|
175 | - $this->getRepositories()->getOwner(), |
|
176 | - $this->getRepositories()->getRepo(), |
|
177 | - $id |
|
178 | - ), Request::METHOD_DELETE); |
|
162 | + /** |
|
163 | + * Delete a release |
|
164 | + * |
|
165 | + * @link https://developer.github.com/v3/repos/releases/#delete-a-release |
|
166 | + * |
|
167 | + * @param string $id |
|
168 | + * |
|
169 | + * @return bool |
|
170 | + */ |
|
171 | + public function deleteRelease(string $id): bool |
|
172 | + { |
|
173 | + $this->getApi()->request($this->getApi()->sprintf( |
|
174 | + '/repos/:owner/:repo/releases/:id', |
|
175 | + $this->getRepositories()->getOwner(), |
|
176 | + $this->getRepositories()->getRepo(), |
|
177 | + $id |
|
178 | + ), Request::METHOD_DELETE); |
|
179 | 179 | |
180 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
181 | - return true; |
|
182 | - } |
|
180 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
181 | + return true; |
|
182 | + } |
|
183 | 183 | |
184 | - return false; |
|
185 | - } |
|
184 | + return false; |
|
185 | + } |
|
186 | 186 | |
187 | - /** |
|
188 | - * List assets for a release |
|
189 | - * |
|
190 | - * @link https://developer.github.com/v3/repos/releases/#list-assets-for-a-release |
|
191 | - * |
|
192 | - * @param string $id |
|
193 | - * |
|
194 | - * @return array |
|
195 | - */ |
|
196 | - public function getReleaseAssets(string $id): array |
|
197 | - { |
|
198 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
199 | - '/repos/:owner/:repo/releases/:id/assets', |
|
200 | - $this->getRepositories()->getOwner(), |
|
201 | - $this->getRepositories()->getRepo(), |
|
202 | - $id |
|
203 | - )); |
|
204 | - } |
|
187 | + /** |
|
188 | + * List assets for a release |
|
189 | + * |
|
190 | + * @link https://developer.github.com/v3/repos/releases/#list-assets-for-a-release |
|
191 | + * |
|
192 | + * @param string $id |
|
193 | + * |
|
194 | + * @return array |
|
195 | + */ |
|
196 | + public function getReleaseAssets(string $id): array |
|
197 | + { |
|
198 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
199 | + '/repos/:owner/:repo/releases/:id/assets', |
|
200 | + $this->getRepositories()->getOwner(), |
|
201 | + $this->getRepositories()->getRepo(), |
|
202 | + $id |
|
203 | + )); |
|
204 | + } |
|
205 | 205 | |
206 | - /** |
|
207 | - * Upload a release asset |
|
208 | - * |
|
209 | - * @link https://developer.github.com/v3/repos/releases/#upload-a-release-asset |
|
210 | - * |
|
211 | - * @param string $id |
|
212 | - * @param string $contentType |
|
213 | - * @param string $name |
|
214 | - * |
|
215 | - * @return array |
|
216 | - */ |
|
217 | - public function uploadReleaseAsset(string $id, string $contentType, string $name): array |
|
218 | - { |
|
206 | + /** |
|
207 | + * Upload a release asset |
|
208 | + * |
|
209 | + * @link https://developer.github.com/v3/repos/releases/#upload-a-release-asset |
|
210 | + * |
|
211 | + * @param string $id |
|
212 | + * @param string $contentType |
|
213 | + * @param string $name |
|
214 | + * |
|
215 | + * @return array |
|
216 | + */ |
|
217 | + public function uploadReleaseAsset(string $id, string $contentType, string $name): array |
|
218 | + { |
|
219 | 219 | |
220 | - return $this->getApi()->setApiUrl(AbstractApi::API_UPLOADS)->request( |
|
221 | - $this->getApi() |
|
222 | - ->sprintf( |
|
223 | - '/repos/:owner/:repo/releases/:id/assets?:arg', |
|
224 | - $this->getRepositories() |
|
225 | - ->getOwner(), |
|
226 | - $this->getRepositories() |
|
227 | - ->getRepo(), |
|
228 | - $id, |
|
229 | - http_build_query(['name' => $name]) |
|
230 | - ), |
|
231 | - Request::METHOD_POST, |
|
232 | - [ |
|
233 | - 'Content-Type' => $contentType |
|
234 | - ] |
|
235 | - ); |
|
236 | - } |
|
220 | + return $this->getApi()->setApiUrl(AbstractApi::API_UPLOADS)->request( |
|
221 | + $this->getApi() |
|
222 | + ->sprintf( |
|
223 | + '/repos/:owner/:repo/releases/:id/assets?:arg', |
|
224 | + $this->getRepositories() |
|
225 | + ->getOwner(), |
|
226 | + $this->getRepositories() |
|
227 | + ->getRepo(), |
|
228 | + $id, |
|
229 | + http_build_query(['name' => $name]) |
|
230 | + ), |
|
231 | + Request::METHOD_POST, |
|
232 | + [ |
|
233 | + 'Content-Type' => $contentType |
|
234 | + ] |
|
235 | + ); |
|
236 | + } |
|
237 | 237 | |
238 | - /** |
|
239 | - * Get a single release asset |
|
240 | - * |
|
241 | - * @link https://developer.github.com/v3/repos/releases/#get-a-single-release-asset |
|
242 | - * |
|
243 | - * @param string $id |
|
244 | - * |
|
245 | - * @return array |
|
246 | - */ |
|
247 | - public function getSingleReleaseAsset(string $id): array |
|
248 | - { |
|
249 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
250 | - '/repos/:owner/:repo/releases/assets/:id', |
|
251 | - $this->getRepositories()->getOwner(), |
|
252 | - $this->getRepositories()->getRepo(), |
|
253 | - $id |
|
254 | - )); |
|
255 | - } |
|
238 | + /** |
|
239 | + * Get a single release asset |
|
240 | + * |
|
241 | + * @link https://developer.github.com/v3/repos/releases/#get-a-single-release-asset |
|
242 | + * |
|
243 | + * @param string $id |
|
244 | + * |
|
245 | + * @return array |
|
246 | + */ |
|
247 | + public function getSingleReleaseAsset(string $id): array |
|
248 | + { |
|
249 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
250 | + '/repos/:owner/:repo/releases/assets/:id', |
|
251 | + $this->getRepositories()->getOwner(), |
|
252 | + $this->getRepositories()->getRepo(), |
|
253 | + $id |
|
254 | + )); |
|
255 | + } |
|
256 | 256 | |
257 | - /** |
|
258 | - * Edit a release asset |
|
259 | - * |
|
260 | - * @link https://developer.github.com/v3/repos/releases/#edit-a-release-asset |
|
261 | - * |
|
262 | - * @param string $id |
|
263 | - * @param string $name |
|
264 | - * @param string $label |
|
265 | - * |
|
266 | - * @return array |
|
267 | - */ |
|
268 | - public function editReleaseAsset(string $id, string $name, string $label = ''): array |
|
269 | - { |
|
270 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
271 | - '/repos/:owner/:repo/releases/assets/:id', |
|
272 | - $this->getRepositories()->getOwner(), |
|
273 | - $this->getRepositories()->getRepo(), |
|
274 | - $id |
|
275 | - ), Request::METHOD_PATCH, [ |
|
276 | - 'name' => $name, |
|
277 | - 'label' => $label |
|
278 | - ]); |
|
279 | - } |
|
257 | + /** |
|
258 | + * Edit a release asset |
|
259 | + * |
|
260 | + * @link https://developer.github.com/v3/repos/releases/#edit-a-release-asset |
|
261 | + * |
|
262 | + * @param string $id |
|
263 | + * @param string $name |
|
264 | + * @param string $label |
|
265 | + * |
|
266 | + * @return array |
|
267 | + */ |
|
268 | + public function editReleaseAsset(string $id, string $name, string $label = ''): array |
|
269 | + { |
|
270 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
271 | + '/repos/:owner/:repo/releases/assets/:id', |
|
272 | + $this->getRepositories()->getOwner(), |
|
273 | + $this->getRepositories()->getRepo(), |
|
274 | + $id |
|
275 | + ), Request::METHOD_PATCH, [ |
|
276 | + 'name' => $name, |
|
277 | + 'label' => $label |
|
278 | + ]); |
|
279 | + } |
|
280 | 280 | |
281 | - /** |
|
282 | - * Delete a release asset |
|
283 | - * |
|
284 | - * @link https://developer.github.com/v3/repos/releases/#delete-a-release-asset |
|
285 | - * |
|
286 | - * @param string $id |
|
287 | - * |
|
288 | - * @return bool |
|
289 | - */ |
|
290 | - public function deleteReleaseAsset(string $id): bool |
|
291 | - { |
|
292 | - $this->getApi()->request($this->getApi()->sprintf( |
|
293 | - '/repos/:owner/:repo/releases/assets/:id', |
|
294 | - $this->getRepositories()->getOwner(), |
|
295 | - $this->getRepositories()->getRepo(), |
|
296 | - $id |
|
297 | - ), Request::METHOD_DELETE); |
|
281 | + /** |
|
282 | + * Delete a release asset |
|
283 | + * |
|
284 | + * @link https://developer.github.com/v3/repos/releases/#delete-a-release-asset |
|
285 | + * |
|
286 | + * @param string $id |
|
287 | + * |
|
288 | + * @return bool |
|
289 | + */ |
|
290 | + public function deleteReleaseAsset(string $id): bool |
|
291 | + { |
|
292 | + $this->getApi()->request($this->getApi()->sprintf( |
|
293 | + '/repos/:owner/:repo/releases/assets/:id', |
|
294 | + $this->getRepositories()->getOwner(), |
|
295 | + $this->getRepositories()->getRepo(), |
|
296 | + $id |
|
297 | + ), Request::METHOD_DELETE); |
|
298 | 298 | |
299 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
300 | - return true; |
|
301 | - } |
|
299 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
300 | + return true; |
|
301 | + } |
|
302 | 302 | |
303 | - return false; |
|
304 | - } |
|
303 | + return false; |
|
304 | + } |
|
305 | 305 | } |
@@ -11,14 +11,14 @@ |
||
11 | 11 | class Meta extends AbstractMiscellaneous |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * Meta, provides information about GitHub.com, the service. |
|
16 | - * |
|
17 | - * @link https://developer.github.com/v3/meta/#meta |
|
18 | - * @return array |
|
19 | - */ |
|
20 | - public function get(): array |
|
21 | - { |
|
22 | - return $this->getApi()->request('/meta'); |
|
23 | - } |
|
14 | + /** |
|
15 | + * Meta, provides information about GitHub.com, the service. |
|
16 | + * |
|
17 | + * @link https://developer.github.com/v3/meta/#meta |
|
18 | + * @return array |
|
19 | + */ |
|
20 | + public function get(): array |
|
21 | + { |
|
22 | + return $this->getApi()->request('/meta'); |
|
23 | + } |
|
24 | 24 | } |
@@ -10,28 +10,28 @@ |
||
10 | 10 | class Gitignore extends AbstractMiscellaneous |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * Listing available templates |
|
15 | - * |
|
16 | - * @link https://developer.github.com/v3/gitignore/#listing-available-templates |
|
17 | - * @return array |
|
18 | - */ |
|
19 | - public function listingAvailableTemplates(): array |
|
20 | - { |
|
21 | - return $this->getApi()->request('/gitignore/templates'); |
|
22 | - } |
|
13 | + /** |
|
14 | + * Listing available templates |
|
15 | + * |
|
16 | + * @link https://developer.github.com/v3/gitignore/#listing-available-templates |
|
17 | + * @return array |
|
18 | + */ |
|
19 | + public function listingAvailableTemplates(): array |
|
20 | + { |
|
21 | + return $this->getApi()->request('/gitignore/templates'); |
|
22 | + } |
|
23 | 23 | |
24 | - /** |
|
25 | - * Get a single template |
|
26 | - * |
|
27 | - * @link https://developer.github.com/v3/gitignore/#get-a-single-template |
|
28 | - * |
|
29 | - * @param string $name |
|
30 | - * |
|
31 | - * @return array |
|
32 | - */ |
|
33 | - public function getSingleTemplate(string $name): array |
|
34 | - { |
|
35 | - return $this->getApi()->request($this->getApi()->sprintf('/gitignore/templates/:name', $name)); |
|
36 | - } |
|
24 | + /** |
|
25 | + * Get a single template |
|
26 | + * |
|
27 | + * @link https://developer.github.com/v3/gitignore/#get-a-single-template |
|
28 | + * |
|
29 | + * @param string $name |
|
30 | + * |
|
31 | + * @return array |
|
32 | + */ |
|
33 | + public function getSingleTemplate(string $name): array |
|
34 | + { |
|
35 | + return $this->getApi()->request($this->getApi()->sprintf('/gitignore/templates/:name', $name)); |
|
36 | + } |
|
37 | 37 | } |
@@ -13,38 +13,38 @@ |
||
13 | 13 | class Markdown extends AbstractMiscellaneous |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * Render an arbitrary Markdown document |
|
18 | - * |
|
19 | - * @link https://developer.github.com/v3/markdown/#render-an-arbitrary-markdown-document |
|
20 | - * |
|
21 | - * @param string $text The Markdown text to render |
|
22 | - * @param string $mode The rendering mode. |
|
23 | - * @param string $context The repository context. Only taken into account when rendering as gfm |
|
24 | - * |
|
25 | - * @return array |
|
26 | - */ |
|
27 | - public function render(string $text, string $mode = AbstractApi::MODE_MARKDOWN, string $context = ''): array |
|
28 | - { |
|
29 | - return $this->getApi()->request('/markdown', Request::METHOD_POST, [ |
|
30 | - 'text' => $text, |
|
31 | - 'mode' => $mode, |
|
32 | - 'context' => $context |
|
33 | - ]); |
|
34 | - } |
|
16 | + /** |
|
17 | + * Render an arbitrary Markdown document |
|
18 | + * |
|
19 | + * @link https://developer.github.com/v3/markdown/#render-an-arbitrary-markdown-document |
|
20 | + * |
|
21 | + * @param string $text The Markdown text to render |
|
22 | + * @param string $mode The rendering mode. |
|
23 | + * @param string $context The repository context. Only taken into account when rendering as gfm |
|
24 | + * |
|
25 | + * @return array |
|
26 | + */ |
|
27 | + public function render(string $text, string $mode = AbstractApi::MODE_MARKDOWN, string $context = ''): array |
|
28 | + { |
|
29 | + return $this->getApi()->request('/markdown', Request::METHOD_POST, [ |
|
30 | + 'text' => $text, |
|
31 | + 'mode' => $mode, |
|
32 | + 'context' => $context |
|
33 | + ]); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * Render a Markdown document in raw mode |
|
38 | - * |
|
39 | - * @link https://developer.github.com/v3/markdown/#render-a-markdown-document-in-raw-mode |
|
40 | - * |
|
41 | - * @param string $string |
|
42 | - * |
|
43 | - * @return array |
|
44 | - */ |
|
45 | - public function renderRaw(string $string): array |
|
46 | - { |
|
47 | - return $this->getApi()->setContentType('text/plain') |
|
48 | - ->request('/markdown/raw', Request::METHOD_POST, ['file' => $string]); |
|
49 | - } |
|
36 | + /** |
|
37 | + * Render a Markdown document in raw mode |
|
38 | + * |
|
39 | + * @link https://developer.github.com/v3/markdown/#render-a-markdown-document-in-raw-mode |
|
40 | + * |
|
41 | + * @param string $string |
|
42 | + * |
|
43 | + * @return array |
|
44 | + */ |
|
45 | + public function renderRaw(string $string): array |
|
46 | + { |
|
47 | + return $this->getApi()->setContentType('text/plain') |
|
48 | + ->request('/markdown/raw', Request::METHOD_POST, ['file' => $string]); |
|
49 | + } |
|
50 | 50 | } |
@@ -11,32 +11,32 @@ |
||
11 | 11 | class Licenses extends AbstractMiscellaneous |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * List all licenses |
|
16 | - * |
|
17 | - * @link https://developer.github.com/v3/licenses/#list-all-licenses |
|
18 | - * @return array |
|
19 | - */ |
|
20 | - public function listAllLicenses(): array |
|
21 | - { |
|
22 | - return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request('/licenses'); |
|
23 | - } |
|
14 | + /** |
|
15 | + * List all licenses |
|
16 | + * |
|
17 | + * @link https://developer.github.com/v3/licenses/#list-all-licenses |
|
18 | + * @return array |
|
19 | + */ |
|
20 | + public function listAllLicenses(): array |
|
21 | + { |
|
22 | + return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request('/licenses'); |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * Get an individual license |
|
27 | - * |
|
28 | - * @link https://developer.github.com/v3/licenses/#get-an-individual-license |
|
29 | - * |
|
30 | - * @param string $license |
|
31 | - * |
|
32 | - * @return array |
|
33 | - */ |
|
34 | - public function getIndividualLicense(string $license): array |
|
35 | - { |
|
36 | - return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request($this->getApi() |
|
37 | - ->sprintf( |
|
38 | - '/licenses/:license', |
|
39 | - $license |
|
40 | - )); |
|
41 | - } |
|
25 | + /** |
|
26 | + * Get an individual license |
|
27 | + * |
|
28 | + * @link https://developer.github.com/v3/licenses/#get-an-individual-license |
|
29 | + * |
|
30 | + * @param string $license |
|
31 | + * |
|
32 | + * @return array |
|
33 | + */ |
|
34 | + public function getIndividualLicense(string $license): array |
|
35 | + { |
|
36 | + return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request($this->getApi() |
|
37 | + ->sprintf( |
|
38 | + '/licenses/:license', |
|
39 | + $license |
|
40 | + )); |
|
41 | + } |
|
42 | 42 | } |