@@ -10,14 +10,14 @@ |
||
10 | 10 | class RateLimit extends AbstractMiscellaneous |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * Check your current rate limit status at any time using the Rate Limit API described below. |
|
15 | - * |
|
16 | - * @link https://developer.github.com/v3/rate_limit/#rate-limit |
|
17 | - * @return array |
|
18 | - */ |
|
19 | - public function get(): array |
|
20 | - { |
|
21 | - return $this->getApi()->request('/rate_limit'); |
|
22 | - } |
|
13 | + /** |
|
14 | + * Check your current rate limit status at any time using the Rate Limit API described below. |
|
15 | + * |
|
16 | + * @link https://developer.github.com/v3/rate_limit/#rate-limit |
|
17 | + * @return array |
|
18 | + */ |
|
19 | + public function get(): array |
|
20 | + { |
|
21 | + return $this->getApi()->request('/rate_limit'); |
|
22 | + } |
|
23 | 23 | } |
@@ -10,14 +10,14 @@ |
||
10 | 10 | class Emojis extends AbstractMiscellaneous |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * Lists all the emojis available to use on GitHub. |
|
15 | - * |
|
16 | - * @link https://developer.github.com/v3/emojis/#emojis |
|
17 | - * @return array |
|
18 | - */ |
|
19 | - public function get(): array |
|
20 | - { |
|
21 | - return $this->getApi()->request('/emojis'); |
|
22 | - } |
|
13 | + /** |
|
14 | + * Lists all the emojis available to use on GitHub. |
|
15 | + * |
|
16 | + * @link https://developer.github.com/v3/emojis/#emojis |
|
17 | + * @return array |
|
18 | + */ |
|
19 | + public function get(): array |
|
20 | + { |
|
21 | + return $this->getApi()->request('/emojis'); |
|
22 | + } |
|
23 | 23 | } |
@@ -10,88 +10,88 @@ |
||
10 | 10 | */ |
11 | 11 | abstract class AbstractReceiver |
12 | 12 | { |
13 | - /** Api trait */ |
|
14 | - use Api; |
|
13 | + /** Api trait */ |
|
14 | + use Api; |
|
15 | 15 | |
16 | - /** Protected properties */ |
|
17 | - protected $owner = ''; |
|
18 | - protected $repo = ''; |
|
16 | + /** Protected properties */ |
|
17 | + protected $owner = ''; |
|
18 | + protected $repo = ''; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Constructor |
|
22 | - * |
|
23 | - * @param AbstractApi $api |
|
24 | - */ |
|
25 | - public function __construct(AbstractApi $api) |
|
26 | - { |
|
27 | - $this->setApi($api); |
|
28 | - } |
|
20 | + /** |
|
21 | + * Constructor |
|
22 | + * |
|
23 | + * @param AbstractApi $api |
|
24 | + */ |
|
25 | + public function __construct(AbstractApi $api) |
|
26 | + { |
|
27 | + $this->setApi($api); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Get owner |
|
32 | - * |
|
33 | - * @return string |
|
34 | - */ |
|
35 | - public function getOwner(): string |
|
36 | - { |
|
37 | - return $this->owner; |
|
38 | - } |
|
30 | + /** |
|
31 | + * Get owner |
|
32 | + * |
|
33 | + * @return string |
|
34 | + */ |
|
35 | + public function getOwner(): string |
|
36 | + { |
|
37 | + return $this->owner; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Set owner |
|
42 | - * |
|
43 | - * @param string $owner |
|
44 | - * |
|
45 | - * @return AbstractReceiver |
|
46 | - */ |
|
47 | - public function setOwner(string $owner): AbstractReceiver |
|
48 | - { |
|
49 | - $this->owner = $owner; |
|
40 | + /** |
|
41 | + * Set owner |
|
42 | + * |
|
43 | + * @param string $owner |
|
44 | + * |
|
45 | + * @return AbstractReceiver |
|
46 | + */ |
|
47 | + public function setOwner(string $owner): AbstractReceiver |
|
48 | + { |
|
49 | + $this->owner = $owner; |
|
50 | 50 | |
51 | - return $this; |
|
52 | - } |
|
51 | + return $this; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Get repository |
|
56 | - * |
|
57 | - * @return string |
|
58 | - */ |
|
59 | - public function getRepo(): string |
|
60 | - { |
|
61 | - return $this->repo; |
|
62 | - } |
|
54 | + /** |
|
55 | + * Get repository |
|
56 | + * |
|
57 | + * @return string |
|
58 | + */ |
|
59 | + public function getRepo(): string |
|
60 | + { |
|
61 | + return $this->repo; |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * Set repository |
|
66 | - * |
|
67 | - * @param string $repo |
|
68 | - * |
|
69 | - * @return AbstractReceiver |
|
70 | - */ |
|
71 | - public function setRepo(string $repo): AbstractReceiver |
|
72 | - { |
|
73 | - $this->repo = $repo; |
|
64 | + /** |
|
65 | + * Set repository |
|
66 | + * |
|
67 | + * @param string $repo |
|
68 | + * |
|
69 | + * @return AbstractReceiver |
|
70 | + */ |
|
71 | + public function setRepo(string $repo): AbstractReceiver |
|
72 | + { |
|
73 | + $this->repo = $repo; |
|
74 | 74 | |
75 | - return $this; |
|
76 | - } |
|
75 | + return $this; |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * Get a sub-receiver |
|
80 | - * |
|
81 | - * @param string $name |
|
82 | - * |
|
83 | - * @return null|object |
|
84 | - */ |
|
85 | - public function getReceiver(string $name) |
|
86 | - { |
|
87 | - $classPath = explode('\\', get_called_class()); |
|
88 | - $class = (string)$this->getApi() |
|
89 | - ->sprintf(':namespace\:class\:method', __NAMESPACE__, end($classPath), $name); |
|
78 | + /** |
|
79 | + * Get a sub-receiver |
|
80 | + * |
|
81 | + * @param string $name |
|
82 | + * |
|
83 | + * @return null|object |
|
84 | + */ |
|
85 | + public function getReceiver(string $name) |
|
86 | + { |
|
87 | + $classPath = explode('\\', get_called_class()); |
|
88 | + $class = (string)$this->getApi() |
|
89 | + ->sprintf(':namespace\:class\:method', __NAMESPACE__, end($classPath), $name); |
|
90 | 90 | |
91 | - if (class_exists($class)) { |
|
92 | - return new $class($this); |
|
93 | - } |
|
91 | + if (class_exists($class)) { |
|
92 | + return new $class($this); |
|
93 | + } |
|
94 | 94 | |
95 | - return null; |
|
96 | - } |
|
95 | + return null; |
|
96 | + } |
|
97 | 97 | } |
@@ -13,385 +13,385 @@ |
||
13 | 13 | class Repositories extends AbstractReceiver |
14 | 14 | { |
15 | 15 | |
16 | - /** Available sub-Receiver */ |
|
17 | - const COLLABORATORS = 'Collaborators'; |
|
18 | - const COMMENTS = 'Comments'; |
|
19 | - const COMMITS = 'Commits'; |
|
20 | - const CONTENTS = 'Contents'; |
|
21 | - const DEPLOY_KEYS = 'DeployKeys'; |
|
22 | - const DEPLOYMENTS = 'Deployments'; |
|
23 | - const FORKS = 'Forks'; |
|
24 | - const HOOKS = 'Hooks'; |
|
25 | - const MERGING = 'Merging'; |
|
26 | - const PAGES = 'Pages'; |
|
27 | - const RELEASES = 'Releases'; |
|
28 | - const STATISTICS = 'Statistics'; |
|
29 | - const STATUSES = 'Statuses'; |
|
16 | + /** Available sub-Receiver */ |
|
17 | + const COLLABORATORS = 'Collaborators'; |
|
18 | + const COMMENTS = 'Comments'; |
|
19 | + const COMMITS = 'Commits'; |
|
20 | + const CONTENTS = 'Contents'; |
|
21 | + const DEPLOY_KEYS = 'DeployKeys'; |
|
22 | + const DEPLOYMENTS = 'Deployments'; |
|
23 | + const FORKS = 'Forks'; |
|
24 | + const HOOKS = 'Hooks'; |
|
25 | + const MERGING = 'Merging'; |
|
26 | + const PAGES = 'Pages'; |
|
27 | + const RELEASES = 'Releases'; |
|
28 | + const STATISTICS = 'Statistics'; |
|
29 | + const STATUSES = 'Statuses'; |
|
30 | 30 | |
31 | - /** |
|
32 | - * List repositories for the authenticated user. |
|
33 | - * |
|
34 | - * @link https://developer.github.com/v3/repos/#list-your-repositories |
|
35 | - * |
|
36 | - * @param string $type |
|
37 | - * @param string $sort |
|
38 | - * @param string $direction |
|
39 | - * |
|
40 | - * @return array |
|
41 | - */ |
|
42 | - public function listYourRepositories( |
|
43 | - string $type = AbstractApi::TYPE_ALL, |
|
44 | - string $sort = AbstractApi::SORT_FULL_NAME, |
|
45 | - string $direction = AbstractApi::DIRECTION_DESC |
|
46 | - ): array { |
|
47 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
48 | - '/user/repos?:args', |
|
49 | - http_build_query(['type' => $type, 'sort' => $sort, 'direction' => $direction]) |
|
50 | - )); |
|
51 | - } |
|
31 | + /** |
|
32 | + * List repositories for the authenticated user. |
|
33 | + * |
|
34 | + * @link https://developer.github.com/v3/repos/#list-your-repositories |
|
35 | + * |
|
36 | + * @param string $type |
|
37 | + * @param string $sort |
|
38 | + * @param string $direction |
|
39 | + * |
|
40 | + * @return array |
|
41 | + */ |
|
42 | + public function listYourRepositories( |
|
43 | + string $type = AbstractApi::TYPE_ALL, |
|
44 | + string $sort = AbstractApi::SORT_FULL_NAME, |
|
45 | + string $direction = AbstractApi::DIRECTION_DESC |
|
46 | + ): array { |
|
47 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
48 | + '/user/repos?:args', |
|
49 | + http_build_query(['type' => $type, 'sort' => $sort, 'direction' => $direction]) |
|
50 | + )); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * List public repositories for the specified user. |
|
55 | - * |
|
56 | - * @link https://developer.github.com/v3/repos/#list-user-repositories |
|
57 | - * |
|
58 | - * @param string $username |
|
59 | - * @param string $type |
|
60 | - * @param string $sort |
|
61 | - * @param string $direction |
|
62 | - * |
|
63 | - * @return array |
|
64 | - */ |
|
65 | - public function listUserRepositories( |
|
66 | - string $username, |
|
67 | - string $type = AbstractApi::TYPE_OWNER, |
|
68 | - string $sort = AbstractApi::SORT_FULL_NAME, |
|
69 | - string $direction = AbstractApi::DIRECTION_DESC |
|
70 | - ): array { |
|
71 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
72 | - '/users/:username/repos?:args', |
|
73 | - $username, |
|
74 | - http_build_query(['type' => $type, 'sort' => $sort, 'direction' => $direction]) |
|
75 | - )); |
|
76 | - } |
|
53 | + /** |
|
54 | + * List public repositories for the specified user. |
|
55 | + * |
|
56 | + * @link https://developer.github.com/v3/repos/#list-user-repositories |
|
57 | + * |
|
58 | + * @param string $username |
|
59 | + * @param string $type |
|
60 | + * @param string $sort |
|
61 | + * @param string $direction |
|
62 | + * |
|
63 | + * @return array |
|
64 | + */ |
|
65 | + public function listUserRepositories( |
|
66 | + string $username, |
|
67 | + string $type = AbstractApi::TYPE_OWNER, |
|
68 | + string $sort = AbstractApi::SORT_FULL_NAME, |
|
69 | + string $direction = AbstractApi::DIRECTION_DESC |
|
70 | + ): array { |
|
71 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
72 | + '/users/:username/repos?:args', |
|
73 | + $username, |
|
74 | + http_build_query(['type' => $type, 'sort' => $sort, 'direction' => $direction]) |
|
75 | + )); |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * List repositories for the specified org. |
|
80 | - * |
|
81 | - * @link https://developer.github.com/v3/repos/#list-organization-repositories |
|
82 | - * |
|
83 | - * @param string $organization |
|
84 | - * @param string $type |
|
85 | - * |
|
86 | - * @return array |
|
87 | - */ |
|
88 | - public function listOrganizationRepositories(string $organization, string $type = AbstractApi::TYPE_ALL): array |
|
89 | - { |
|
90 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
91 | - '/orgs/:org/repos?:args', |
|
92 | - $organization, |
|
93 | - http_build_query(['type' => $type]) |
|
94 | - )); |
|
95 | - } |
|
78 | + /** |
|
79 | + * List repositories for the specified org. |
|
80 | + * |
|
81 | + * @link https://developer.github.com/v3/repos/#list-organization-repositories |
|
82 | + * |
|
83 | + * @param string $organization |
|
84 | + * @param string $type |
|
85 | + * |
|
86 | + * @return array |
|
87 | + */ |
|
88 | + public function listOrganizationRepositories(string $organization, string $type = AbstractApi::TYPE_ALL): array |
|
89 | + { |
|
90 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
91 | + '/orgs/:org/repos?:args', |
|
92 | + $organization, |
|
93 | + http_build_query(['type' => $type]) |
|
94 | + )); |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
98 | - * List all public repositories |
|
99 | - * |
|
100 | - * @link https://developer.github.com/v3/repos/#list-all-public-repositories |
|
101 | - * |
|
102 | - * @param string $since |
|
103 | - * |
|
104 | - * @return array |
|
105 | - */ |
|
106 | - public function listPublicRepositories(string $since = '1970-01-01'): array |
|
107 | - { |
|
108 | - return $this->getApi()->request($this->getApi() |
|
109 | - ->sprintf('/repositories?:arg', http_build_query(['since', $since]))); |
|
110 | - } |
|
97 | + /** |
|
98 | + * List all public repositories |
|
99 | + * |
|
100 | + * @link https://developer.github.com/v3/repos/#list-all-public-repositories |
|
101 | + * |
|
102 | + * @param string $since |
|
103 | + * |
|
104 | + * @return array |
|
105 | + */ |
|
106 | + public function listPublicRepositories(string $since = '1970-01-01'): array |
|
107 | + { |
|
108 | + return $this->getApi()->request($this->getApi() |
|
109 | + ->sprintf('/repositories?:arg', http_build_query(['since', $since]))); |
|
110 | + } |
|
111 | 111 | |
112 | - /** |
|
113 | - * Create a new repository for the authenticated user. |
|
114 | - * |
|
115 | - * @link https://developer.github.com/v3/repos/#create |
|
116 | - * |
|
117 | - * @param string $name |
|
118 | - * @param string $description |
|
119 | - * @param string $homepage |
|
120 | - * @param bool $private |
|
121 | - * @param bool $hasIssues |
|
122 | - * @param bool $hasWiki |
|
123 | - * @param bool $hasDownloads |
|
124 | - * @param int $teamId |
|
125 | - * @param bool $autoInit |
|
126 | - * @param string $gitignoreTemplate |
|
127 | - * @param string $licenseTemplate |
|
128 | - * |
|
129 | - * @return array |
|
130 | - */ |
|
131 | - public function createRepository( |
|
132 | - string $name, |
|
133 | - string $description = '', |
|
134 | - string $homepage = '', |
|
135 | - bool $private = false, |
|
136 | - bool $hasIssues = true, |
|
137 | - bool $hasWiki = true, |
|
138 | - bool $hasDownloads = true, |
|
139 | - int $teamId = 0, |
|
140 | - bool $autoInit = false, |
|
141 | - string $gitignoreTemplate = '', |
|
142 | - string $licenseTemplate = '' |
|
143 | - ): array { |
|
144 | - return $this->getApi()->request(sprintf('/user/repos'), Request::METHOD_POST, [ |
|
145 | - 'name' => $name, |
|
146 | - 'description' => $description, |
|
147 | - 'homepage' => $homepage, |
|
148 | - 'private' => $private, |
|
149 | - 'has_issues' => $hasIssues, |
|
150 | - 'has_wiki' => $hasWiki, |
|
151 | - 'has_downloads' => $hasDownloads, |
|
152 | - 'team_id' => $teamId, |
|
153 | - 'auto_init' => $autoInit, |
|
154 | - 'gitignore_template' => $gitignoreTemplate, |
|
155 | - 'license_template' => $licenseTemplate |
|
156 | - ]); |
|
157 | - } |
|
112 | + /** |
|
113 | + * Create a new repository for the authenticated user. |
|
114 | + * |
|
115 | + * @link https://developer.github.com/v3/repos/#create |
|
116 | + * |
|
117 | + * @param string $name |
|
118 | + * @param string $description |
|
119 | + * @param string $homepage |
|
120 | + * @param bool $private |
|
121 | + * @param bool $hasIssues |
|
122 | + * @param bool $hasWiki |
|
123 | + * @param bool $hasDownloads |
|
124 | + * @param int $teamId |
|
125 | + * @param bool $autoInit |
|
126 | + * @param string $gitignoreTemplate |
|
127 | + * @param string $licenseTemplate |
|
128 | + * |
|
129 | + * @return array |
|
130 | + */ |
|
131 | + public function createRepository( |
|
132 | + string $name, |
|
133 | + string $description = '', |
|
134 | + string $homepage = '', |
|
135 | + bool $private = false, |
|
136 | + bool $hasIssues = true, |
|
137 | + bool $hasWiki = true, |
|
138 | + bool $hasDownloads = true, |
|
139 | + int $teamId = 0, |
|
140 | + bool $autoInit = false, |
|
141 | + string $gitignoreTemplate = '', |
|
142 | + string $licenseTemplate = '' |
|
143 | + ): array { |
|
144 | + return $this->getApi()->request(sprintf('/user/repos'), Request::METHOD_POST, [ |
|
145 | + 'name' => $name, |
|
146 | + 'description' => $description, |
|
147 | + 'homepage' => $homepage, |
|
148 | + 'private' => $private, |
|
149 | + 'has_issues' => $hasIssues, |
|
150 | + 'has_wiki' => $hasWiki, |
|
151 | + 'has_downloads' => $hasDownloads, |
|
152 | + 'team_id' => $teamId, |
|
153 | + 'auto_init' => $autoInit, |
|
154 | + 'gitignore_template' => $gitignoreTemplate, |
|
155 | + 'license_template' => $licenseTemplate |
|
156 | + ]); |
|
157 | + } |
|
158 | 158 | |
159 | - /** |
|
160 | - * Create a new repository in this organization. The authenticated user must be a member of the specified |
|
161 | - * organization. |
|
162 | - * |
|
163 | - * @link https://developer.github.com/v3/repos/#create |
|
164 | - * |
|
165 | - * @param string $organization |
|
166 | - * @param string $name |
|
167 | - * @param string $description |
|
168 | - * @param string $homepage |
|
169 | - * @param bool $private |
|
170 | - * @param bool $hasIssues |
|
171 | - * @param bool $hasWiki |
|
172 | - * @param bool $hasDownloads |
|
173 | - * @param int $teamId |
|
174 | - * @param bool $autoInit |
|
175 | - * @param string $gitignoreTemplate |
|
176 | - * @param string $licenseTemplate |
|
177 | - * |
|
178 | - * @return array |
|
179 | - */ |
|
180 | - public function createOrganizationRepository( |
|
181 | - string $organization, |
|
182 | - string $name, |
|
183 | - string $description = '', |
|
184 | - string $homepage = '', |
|
185 | - bool $private = false, |
|
186 | - bool $hasIssues = true, |
|
187 | - bool $hasWiki = true, |
|
188 | - bool $hasDownloads = true, |
|
189 | - int $teamId = 0, |
|
190 | - bool $autoInit = false, |
|
191 | - string $gitignoreTemplate = '', |
|
192 | - string $licenseTemplate = '' |
|
193 | - ): array { |
|
194 | - return $this->getApi()->request( |
|
195 | - $this->getApi()->sprintf('/orgs/:org/repos', $organization), |
|
196 | - Request::METHOD_POST, |
|
197 | - [ |
|
198 | - 'name' => $name, |
|
199 | - 'description' => $description, |
|
200 | - 'homepage' => $homepage, |
|
201 | - 'private' => $private, |
|
202 | - 'has_issues' => $hasIssues, |
|
203 | - 'has_wiki' => $hasWiki, |
|
204 | - 'has_downloads' => $hasDownloads, |
|
205 | - 'team_id' => $teamId, |
|
206 | - 'auto_init' => $autoInit, |
|
207 | - 'gitignore_template' => $gitignoreTemplate, |
|
208 | - 'license_template' => $licenseTemplate |
|
209 | - ] |
|
210 | - ); |
|
211 | - } |
|
159 | + /** |
|
160 | + * Create a new repository in this organization. The authenticated user must be a member of the specified |
|
161 | + * organization. |
|
162 | + * |
|
163 | + * @link https://developer.github.com/v3/repos/#create |
|
164 | + * |
|
165 | + * @param string $organization |
|
166 | + * @param string $name |
|
167 | + * @param string $description |
|
168 | + * @param string $homepage |
|
169 | + * @param bool $private |
|
170 | + * @param bool $hasIssues |
|
171 | + * @param bool $hasWiki |
|
172 | + * @param bool $hasDownloads |
|
173 | + * @param int $teamId |
|
174 | + * @param bool $autoInit |
|
175 | + * @param string $gitignoreTemplate |
|
176 | + * @param string $licenseTemplate |
|
177 | + * |
|
178 | + * @return array |
|
179 | + */ |
|
180 | + public function createOrganizationRepository( |
|
181 | + string $organization, |
|
182 | + string $name, |
|
183 | + string $description = '', |
|
184 | + string $homepage = '', |
|
185 | + bool $private = false, |
|
186 | + bool $hasIssues = true, |
|
187 | + bool $hasWiki = true, |
|
188 | + bool $hasDownloads = true, |
|
189 | + int $teamId = 0, |
|
190 | + bool $autoInit = false, |
|
191 | + string $gitignoreTemplate = '', |
|
192 | + string $licenseTemplate = '' |
|
193 | + ): array { |
|
194 | + return $this->getApi()->request( |
|
195 | + $this->getApi()->sprintf('/orgs/:org/repos', $organization), |
|
196 | + Request::METHOD_POST, |
|
197 | + [ |
|
198 | + 'name' => $name, |
|
199 | + 'description' => $description, |
|
200 | + 'homepage' => $homepage, |
|
201 | + 'private' => $private, |
|
202 | + 'has_issues' => $hasIssues, |
|
203 | + 'has_wiki' => $hasWiki, |
|
204 | + 'has_downloads' => $hasDownloads, |
|
205 | + 'team_id' => $teamId, |
|
206 | + 'auto_init' => $autoInit, |
|
207 | + 'gitignore_template' => $gitignoreTemplate, |
|
208 | + 'license_template' => $licenseTemplate |
|
209 | + ] |
|
210 | + ); |
|
211 | + } |
|
212 | 212 | |
213 | - /** |
|
214 | - * Get |
|
215 | - * |
|
216 | - * @link https://developer.github.com/v3/repos/#get |
|
217 | - * @return array |
|
218 | - */ |
|
219 | - public function get(): array |
|
220 | - { |
|
221 | - return $this->getApi()->request($this->getApi() |
|
222 | - ->sprintf('/repos/:owner/:repo', $this->getOwner(), $this->getRepo())); |
|
223 | - } |
|
213 | + /** |
|
214 | + * Get |
|
215 | + * |
|
216 | + * @link https://developer.github.com/v3/repos/#get |
|
217 | + * @return array |
|
218 | + */ |
|
219 | + public function get(): array |
|
220 | + { |
|
221 | + return $this->getApi()->request($this->getApi() |
|
222 | + ->sprintf('/repos/:owner/:repo', $this->getOwner(), $this->getRepo())); |
|
223 | + } |
|
224 | 224 | |
225 | - /** |
|
226 | - * Edit |
|
227 | - * |
|
228 | - * @link https://developer.github.com/v3/repos/#edit |
|
229 | - * |
|
230 | - * @param string $name |
|
231 | - * @param string $description |
|
232 | - * @param string $homepage |
|
233 | - * @param bool $private |
|
234 | - * @param bool $hasIssues |
|
235 | - * @param bool $hasWiki |
|
236 | - * @param bool $hasDownloads |
|
237 | - * @param string $defaultBranch |
|
238 | - * |
|
239 | - * @return array |
|
240 | - */ |
|
241 | - public function edit( |
|
242 | - string $name, |
|
243 | - string $description = '', |
|
244 | - string $homepage = '', |
|
245 | - bool $private = false, |
|
246 | - bool $hasIssues = true, |
|
247 | - bool $hasWiki = true, |
|
248 | - bool $hasDownloads = true, |
|
249 | - string $defaultBranch = '' |
|
250 | - ): array { |
|
251 | - return $this->getApi()->request( |
|
252 | - $this->getApi() |
|
253 | - ->sprintf('/repos/:owner/:repo', $this->getOwner(), $this->getRepo()), |
|
254 | - Request::METHOD_PATCH, |
|
255 | - [ |
|
256 | - 'name' => $name, |
|
257 | - 'description' => $description, |
|
258 | - 'homepage' => $homepage, |
|
259 | - 'private' => $private, |
|
260 | - 'has_issues' => $hasIssues, |
|
261 | - 'has_wiki' => $hasWiki, |
|
262 | - 'has_downloads' => $hasDownloads, |
|
263 | - 'default_branch' => $defaultBranch |
|
264 | - ] |
|
265 | - ); |
|
266 | - } |
|
225 | + /** |
|
226 | + * Edit |
|
227 | + * |
|
228 | + * @link https://developer.github.com/v3/repos/#edit |
|
229 | + * |
|
230 | + * @param string $name |
|
231 | + * @param string $description |
|
232 | + * @param string $homepage |
|
233 | + * @param bool $private |
|
234 | + * @param bool $hasIssues |
|
235 | + * @param bool $hasWiki |
|
236 | + * @param bool $hasDownloads |
|
237 | + * @param string $defaultBranch |
|
238 | + * |
|
239 | + * @return array |
|
240 | + */ |
|
241 | + public function edit( |
|
242 | + string $name, |
|
243 | + string $description = '', |
|
244 | + string $homepage = '', |
|
245 | + bool $private = false, |
|
246 | + bool $hasIssues = true, |
|
247 | + bool $hasWiki = true, |
|
248 | + bool $hasDownloads = true, |
|
249 | + string $defaultBranch = '' |
|
250 | + ): array { |
|
251 | + return $this->getApi()->request( |
|
252 | + $this->getApi() |
|
253 | + ->sprintf('/repos/:owner/:repo', $this->getOwner(), $this->getRepo()), |
|
254 | + Request::METHOD_PATCH, |
|
255 | + [ |
|
256 | + 'name' => $name, |
|
257 | + 'description' => $description, |
|
258 | + 'homepage' => $homepage, |
|
259 | + 'private' => $private, |
|
260 | + 'has_issues' => $hasIssues, |
|
261 | + 'has_wiki' => $hasWiki, |
|
262 | + 'has_downloads' => $hasDownloads, |
|
263 | + 'default_branch' => $defaultBranch |
|
264 | + ] |
|
265 | + ); |
|
266 | + } |
|
267 | 267 | |
268 | - /** |
|
269 | - * List contributors |
|
270 | - * |
|
271 | - * @link https://developer.github.com/v3/repos/#list-contributors |
|
272 | - * |
|
273 | - * @param string $anon |
|
274 | - * |
|
275 | - * @return array |
|
276 | - */ |
|
277 | - public function listContributors(string $anon = '0'): array |
|
278 | - { |
|
279 | - return $this->getApi()->request($this->getApi() |
|
280 | - ->sprintf( |
|
281 | - '/repos/:owner/:repo/contributors?:args', |
|
282 | - $this->getOwner(), |
|
283 | - $this->getRepo(), |
|
284 | - http_build_query(['anon' => $anon]) |
|
285 | - )); |
|
286 | - } |
|
268 | + /** |
|
269 | + * List contributors |
|
270 | + * |
|
271 | + * @link https://developer.github.com/v3/repos/#list-contributors |
|
272 | + * |
|
273 | + * @param string $anon |
|
274 | + * |
|
275 | + * @return array |
|
276 | + */ |
|
277 | + public function listContributors(string $anon = '0'): array |
|
278 | + { |
|
279 | + return $this->getApi()->request($this->getApi() |
|
280 | + ->sprintf( |
|
281 | + '/repos/:owner/:repo/contributors?:args', |
|
282 | + $this->getOwner(), |
|
283 | + $this->getRepo(), |
|
284 | + http_build_query(['anon' => $anon]) |
|
285 | + )); |
|
286 | + } |
|
287 | 287 | |
288 | - /** |
|
289 | - * List languages |
|
290 | - * |
|
291 | - * @link https://developer.github.com/v3/repos/#list-languages |
|
292 | - * @return array |
|
293 | - */ |
|
294 | - public function listLanguages(): array |
|
295 | - { |
|
296 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
297 | - '/repos/:owner/:repo/languages', |
|
298 | - $this->getOwner(), |
|
299 | - $this->getRepo() |
|
300 | - )); |
|
301 | - } |
|
288 | + /** |
|
289 | + * List languages |
|
290 | + * |
|
291 | + * @link https://developer.github.com/v3/repos/#list-languages |
|
292 | + * @return array |
|
293 | + */ |
|
294 | + public function listLanguages(): array |
|
295 | + { |
|
296 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
297 | + '/repos/:owner/:repo/languages', |
|
298 | + $this->getOwner(), |
|
299 | + $this->getRepo() |
|
300 | + )); |
|
301 | + } |
|
302 | 302 | |
303 | - /** |
|
304 | - * List Teams |
|
305 | - * |
|
306 | - * @link https://developer.github.com/v3/repos/#list-teams |
|
307 | - * @return array |
|
308 | - */ |
|
309 | - public function listTeams(): array |
|
310 | - { |
|
311 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
312 | - '/repos/:owner/:repo/teams', |
|
313 | - $this->getOwner(), |
|
314 | - $this->getRepo() |
|
315 | - )); |
|
316 | - } |
|
303 | + /** |
|
304 | + * List Teams |
|
305 | + * |
|
306 | + * @link https://developer.github.com/v3/repos/#list-teams |
|
307 | + * @return array |
|
308 | + */ |
|
309 | + public function listTeams(): array |
|
310 | + { |
|
311 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
312 | + '/repos/:owner/:repo/teams', |
|
313 | + $this->getOwner(), |
|
314 | + $this->getRepo() |
|
315 | + )); |
|
316 | + } |
|
317 | 317 | |
318 | - /** |
|
319 | - * List Tags |
|
320 | - * |
|
321 | - * @link https://developer.github.com/v3/repos/#list-tags |
|
322 | - * @return array |
|
323 | - */ |
|
324 | - public function listTags(): array |
|
325 | - { |
|
326 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
327 | - '/repos/:owner/:repo/tags', |
|
328 | - $this->getOwner(), |
|
329 | - $this->getRepo() |
|
330 | - )); |
|
331 | - } |
|
318 | + /** |
|
319 | + * List Tags |
|
320 | + * |
|
321 | + * @link https://developer.github.com/v3/repos/#list-tags |
|
322 | + * @return array |
|
323 | + */ |
|
324 | + public function listTags(): array |
|
325 | + { |
|
326 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
327 | + '/repos/:owner/:repo/tags', |
|
328 | + $this->getOwner(), |
|
329 | + $this->getRepo() |
|
330 | + )); |
|
331 | + } |
|
332 | 332 | |
333 | - /** |
|
334 | - * List Branches |
|
335 | - * |
|
336 | - * @link https://developer.github.com/v3/repos/#list-branches |
|
337 | - * @return array |
|
338 | - */ |
|
339 | - public function listBranches(): array |
|
340 | - { |
|
341 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
342 | - '/repos/:owner/:repo/branches', |
|
343 | - $this->getOwner(), |
|
344 | - $this->getRepo() |
|
345 | - )); |
|
346 | - } |
|
333 | + /** |
|
334 | + * List Branches |
|
335 | + * |
|
336 | + * @link https://developer.github.com/v3/repos/#list-branches |
|
337 | + * @return array |
|
338 | + */ |
|
339 | + public function listBranches(): array |
|
340 | + { |
|
341 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
342 | + '/repos/:owner/:repo/branches', |
|
343 | + $this->getOwner(), |
|
344 | + $this->getRepo() |
|
345 | + )); |
|
346 | + } |
|
347 | 347 | |
348 | - /** |
|
349 | - * Get Branch |
|
350 | - * |
|
351 | - * @link https://developer.github.com/v3/repos/#get-branch |
|
352 | - * |
|
353 | - * @param string $branch |
|
354 | - * |
|
355 | - * @return array |
|
356 | - */ |
|
357 | - public function getBranch(string $branch): array |
|
358 | - { |
|
359 | - return $this->getApi()->request($this->getApi() |
|
360 | - ->sprintf( |
|
361 | - '/repos/:owner/:repo/branches/:branch', |
|
362 | - $this->getOwner(), |
|
363 | - $this->getRepo(), |
|
364 | - $branch |
|
365 | - )); |
|
366 | - } |
|
348 | + /** |
|
349 | + * Get Branch |
|
350 | + * |
|
351 | + * @link https://developer.github.com/v3/repos/#get-branch |
|
352 | + * |
|
353 | + * @param string $branch |
|
354 | + * |
|
355 | + * @return array |
|
356 | + */ |
|
357 | + public function getBranch(string $branch): array |
|
358 | + { |
|
359 | + return $this->getApi()->request($this->getApi() |
|
360 | + ->sprintf( |
|
361 | + '/repos/:owner/:repo/branches/:branch', |
|
362 | + $this->getOwner(), |
|
363 | + $this->getRepo(), |
|
364 | + $branch |
|
365 | + )); |
|
366 | + } |
|
367 | 367 | |
368 | - /** |
|
369 | - * Delete a Repository |
|
370 | - * |
|
371 | - * @link https://developer.github.com/v3/repos/#delete-a-repository |
|
372 | - * @return array |
|
373 | - */ |
|
374 | - public function deleteRepository(): array |
|
375 | - { |
|
376 | - return $this->getApi()->request( |
|
377 | - $this->getApi() |
|
378 | - ->sprintf('/repos/:owner/:repo', $this->getOwner(), $this->getRepo()), |
|
379 | - Request::METHOD_DELETE |
|
380 | - ); |
|
381 | - } |
|
368 | + /** |
|
369 | + * Delete a Repository |
|
370 | + * |
|
371 | + * @link https://developer.github.com/v3/repos/#delete-a-repository |
|
372 | + * @return array |
|
373 | + */ |
|
374 | + public function deleteRepository(): array |
|
375 | + { |
|
376 | + return $this->getApi()->request( |
|
377 | + $this->getApi() |
|
378 | + ->sprintf('/repos/:owner/:repo', $this->getOwner(), $this->getRepo()), |
|
379 | + Request::METHOD_DELETE |
|
380 | + ); |
|
381 | + } |
|
382 | 382 | |
383 | - /** |
|
384 | - * Get the contents of a repository's license |
|
385 | - * |
|
386 | - * @link https://developer.github.com/v3/licenses/#get-the-contents-of-a-repositorys-license |
|
387 | - * @return array |
|
388 | - */ |
|
389 | - public function getRepositoryLicenseContent(): array |
|
390 | - { |
|
391 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
392 | - '/repos/:owner/:repo/license', |
|
393 | - $this->getOwner(), |
|
394 | - $this->getRepo() |
|
395 | - )); |
|
396 | - } |
|
383 | + /** |
|
384 | + * Get the contents of a repository's license |
|
385 | + * |
|
386 | + * @link https://developer.github.com/v3/licenses/#get-the-contents-of-a-repositorys-license |
|
387 | + * @return array |
|
388 | + */ |
|
389 | + public function getRepositoryLicenseContent(): array |
|
390 | + { |
|
391 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
392 | + '/repos/:owner/:repo/license', |
|
393 | + $this->getOwner(), |
|
394 | + $this->getRepo() |
|
395 | + )); |
|
396 | + } |
|
397 | 397 | } |
@@ -10,17 +10,17 @@ |
||
10 | 10 | class AdminStats extends AbstractEnterprise |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * Get statistics |
|
15 | - * |
|
16 | - * @link https://developer.github.com/v3/enterprise/admin_stats/#get-statistics |
|
17 | - * |
|
18 | - * @param string $type |
|
19 | - * |
|
20 | - * @return array |
|
21 | - */ |
|
22 | - public function getStatistics(string $type): array |
|
23 | - { |
|
24 | - return $this->getApi()->request($this->getApi()->sprintf('/enterprise/stats/:type', $type)); |
|
25 | - } |
|
13 | + /** |
|
14 | + * Get statistics |
|
15 | + * |
|
16 | + * @link https://developer.github.com/v3/enterprise/admin_stats/#get-statistics |
|
17 | + * |
|
18 | + * @param string $type |
|
19 | + * |
|
20 | + * @return array |
|
21 | + */ |
|
22 | + public function getStatistics(string $type): array |
|
23 | + { |
|
24 | + return $this->getApi()->request($this->getApi()->sprintf('/enterprise/stats/:type', $type)); |
|
25 | + } |
|
26 | 26 | } |
@@ -10,14 +10,14 @@ |
||
10 | 10 | class License extends AbstractEnterprise |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * Get license information |
|
15 | - * |
|
16 | - * @link https://developer.github.com/v3/enterprise/license/#get-license-information |
|
17 | - * @return array |
|
18 | - */ |
|
19 | - public function getLicenseInformation(): array |
|
20 | - { |
|
21 | - return $this->getApi()->request(sprintf('/enterprise/settings/license')); |
|
22 | - } |
|
13 | + /** |
|
14 | + * Get license information |
|
15 | + * |
|
16 | + * @link https://developer.github.com/v3/enterprise/license/#get-license-information |
|
17 | + * @return array |
|
18 | + */ |
|
19 | + public function getLicenseInformation(): array |
|
20 | + { |
|
21 | + return $this->getApi()->request(sprintf('/enterprise/settings/license')); |
|
22 | + } |
|
23 | 23 | } |
@@ -12,218 +12,218 @@ |
||
12 | 12 | class ManagementConsole extends AbstractEnterprise |
13 | 13 | { |
14 | 14 | |
15 | - /** Properties */ |
|
16 | - protected $hostname = ''; |
|
17 | - protected $password = ''; |
|
18 | - |
|
19 | - /** |
|
20 | - * Get password |
|
21 | - * |
|
22 | - * @return string |
|
23 | - */ |
|
24 | - public function getPassword(): string |
|
25 | - { |
|
26 | - return $this->password; |
|
27 | - } |
|
28 | - |
|
29 | - /** |
|
30 | - * Set password |
|
31 | - * |
|
32 | - * @param string $password |
|
33 | - * |
|
34 | - * @return ManagementConsole |
|
35 | - */ |
|
36 | - public function setPassword(string $password): ManagementConsole |
|
37 | - { |
|
38 | - $this->password = $password; |
|
39 | - |
|
40 | - return $this; |
|
41 | - } |
|
42 | - |
|
43 | - /** |
|
44 | - * Get hostname |
|
45 | - * |
|
46 | - * @return string |
|
47 | - */ |
|
48 | - public function getHostname(): string |
|
49 | - { |
|
50 | - return $this->hostname; |
|
51 | - } |
|
52 | - |
|
53 | - /** |
|
54 | - * Set hostname |
|
55 | - * |
|
56 | - * @param string $hostname |
|
57 | - * |
|
58 | - * @return ManagementConsole |
|
59 | - */ |
|
60 | - public function setHostname(string $hostname): ManagementConsole |
|
61 | - { |
|
62 | - $this->hostname = $hostname; |
|
63 | - |
|
64 | - return $this; |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * Upload a license and software package for the first time |
|
69 | - * |
|
70 | - * @link https://developer.github.com/v3/enterprise/management_console/#upload-a-license-and-software-package-for-the-first-time |
|
71 | - * |
|
72 | - * @param string $license |
|
73 | - * @param string $package |
|
74 | - * @param string $settings |
|
75 | - * |
|
76 | - * @return array |
|
77 | - */ |
|
78 | - public function upload(string $license, string $package, string $settings = ''): array |
|
79 | - { |
|
80 | - $this->getApi()->setApiUrl(sprintf('http://license:%s@%s', md5($license), $this->getHostname())); |
|
81 | - |
|
82 | - return $this->getApi()->request(sprintf( |
|
83 | - '/setup/api/start -F package=@%s -F license=@%s -F settings=<%s', |
|
84 | - $package, |
|
85 | - $license, |
|
86 | - $settings |
|
87 | - ), Request::METHOD_POST); |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * Upgrade a license or software package |
|
92 | - * |
|
93 | - * @link https://developer.github.com/v3/enterprise/management_console/#upgrade-a-license-or-software-package |
|
94 | - * |
|
95 | - * @param string $license |
|
96 | - * @param string $package |
|
97 | - * |
|
98 | - * @return array |
|
99 | - */ |
|
100 | - public function upgrade(string $license = '', string $package = ''): array |
|
101 | - { |
|
102 | - $this->getApi()->setApiUrl(sprintf('http://license:%s@%s', md5($license), $this->getHostname())); |
|
103 | - |
|
104 | - return $this->getApi()->request( |
|
105 | - sprintf('/setup/api/upgrade -F package=@%s -F license=@%s', $package, $license), |
|
106 | - Request::METHOD_POST |
|
107 | - ); |
|
108 | - } |
|
109 | - |
|
110 | - /** |
|
111 | - * Check configuration status |
|
112 | - * |
|
113 | - * @link https://developer.github.com/v3/enterprise/management_console/#check-configuration-status |
|
114 | - * @return array |
|
115 | - */ |
|
116 | - public function checkConfigurationStatus(): array |
|
117 | - { |
|
118 | - return $this->getApi()->request(sprintf('/setup/api/configcheck')); |
|
119 | - } |
|
120 | - |
|
121 | - /** |
|
122 | - * Start a configuration process |
|
123 | - * |
|
124 | - * @link https://developer.github.com/v3/enterprise/management_console/#start-a-configuration-process |
|
125 | - * @return array |
|
126 | - */ |
|
127 | - public function startConfigurationProcess(): array |
|
128 | - { |
|
129 | - return $this->getApi()->request(sprintf('/setup/api/configure'), Request::METHOD_POST); |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * Retrieve settings |
|
134 | - * |
|
135 | - * @link https://developer.github.com/v3/enterprise/management_console/#retrieve-settings |
|
136 | - * @return array |
|
137 | - */ |
|
138 | - public function retrieveSettings(): array |
|
139 | - { |
|
140 | - return $this->getApi()->request(sprintf('/setup/api/settings')); |
|
141 | - } |
|
142 | - |
|
143 | - /** |
|
144 | - * Modify settings |
|
145 | - * |
|
146 | - * @link https://developer.github.com/v3/enterprise/management_console/#modify-settings |
|
147 | - * |
|
148 | - * @param $settings |
|
149 | - * |
|
150 | - * @return array |
|
151 | - */ |
|
152 | - public function modifySettings($settings): array |
|
153 | - { |
|
154 | - return $this->getApi()->request(sprintf('/setup/api/settings settings=%s', $settings), Request::METHOD_PUT); |
|
155 | - } |
|
156 | - |
|
157 | - /** |
|
158 | - * Check maintenance status |
|
159 | - * |
|
160 | - * @link https://developer.github.com/v3/enterprise/management_console/#check-maintenance-status |
|
161 | - * @return array |
|
162 | - */ |
|
163 | - public function checkMaintenanceStatus(): array |
|
164 | - { |
|
165 | - return $this->getApi()->request(sprintf('/setup/api/maintenance')); |
|
166 | - } |
|
167 | - |
|
168 | - /** |
|
169 | - * Enable or disable maintenance mode |
|
170 | - * |
|
171 | - * @link https://developer.github.com/v3/enterprise/management_console/#enable-or-disable-maintenance-mode |
|
172 | - * |
|
173 | - * @param string $maintenance |
|
174 | - * |
|
175 | - * @return array |
|
176 | - */ |
|
177 | - public function updateMaintenanceStatus(string $maintenance): array |
|
178 | - { |
|
179 | - return $this->getApi()->request( |
|
180 | - sprintf('/setup/api/maintenance -d maintenance=%s', $maintenance), |
|
181 | - Request::METHOD_POST |
|
182 | - ); |
|
183 | - } |
|
184 | - |
|
185 | - /** |
|
186 | - * Retrieve authorized SSH keys |
|
187 | - * |
|
188 | - * @link https://developer.github.com/v3/enterprise/management_console/#retrieve-authorized-ssh-keys |
|
189 | - * @return array |
|
190 | - */ |
|
191 | - public function retrieveAuthorizedSshKeys(): array |
|
192 | - { |
|
193 | - return $this->getApi()->request(sprintf('/setup/api/settings/authorized-keys')); |
|
194 | - } |
|
195 | - |
|
196 | - /** |
|
197 | - * Add a new authorized SSH key |
|
198 | - * |
|
199 | - * @link https://developer.github.com/v3/enterprise/management_console/#add-a-new-authorized-ssh-key |
|
200 | - * |
|
201 | - * @param string $authorizedKey |
|
202 | - * |
|
203 | - * @return array |
|
204 | - */ |
|
205 | - public function addNewAuthorizedSshKeys(string $authorizedKey): array |
|
206 | - { |
|
207 | - return $this->getApi()->request(sprintf( |
|
208 | - '/setup/api/settings/authorized-keys -F authorized_key=@%s', |
|
209 | - $authorizedKey |
|
210 | - ), Request::METHOD_POST); |
|
211 | - } |
|
212 | - |
|
213 | - /** |
|
214 | - * Remove an authorized SSH key |
|
215 | - * |
|
216 | - * @link https://developer.github.com/v3/enterprise/management_console/#remove-an-authorized-ssh-key |
|
217 | - * |
|
218 | - * @param string $authorizedKey |
|
219 | - * |
|
220 | - * @return array |
|
221 | - */ |
|
222 | - public function removeAuthorizedSshKeys(string $authorizedKey): array |
|
223 | - { |
|
224 | - return $this->getApi()->request(sprintf( |
|
225 | - '/setup/api/settings/authorized-keys -F authorized_key=@%s', |
|
226 | - $authorizedKey |
|
227 | - ), Request::METHOD_DELETE); |
|
228 | - } |
|
15 | + /** Properties */ |
|
16 | + protected $hostname = ''; |
|
17 | + protected $password = ''; |
|
18 | + |
|
19 | + /** |
|
20 | + * Get password |
|
21 | + * |
|
22 | + * @return string |
|
23 | + */ |
|
24 | + public function getPassword(): string |
|
25 | + { |
|
26 | + return $this->password; |
|
27 | + } |
|
28 | + |
|
29 | + /** |
|
30 | + * Set password |
|
31 | + * |
|
32 | + * @param string $password |
|
33 | + * |
|
34 | + * @return ManagementConsole |
|
35 | + */ |
|
36 | + public function setPassword(string $password): ManagementConsole |
|
37 | + { |
|
38 | + $this->password = $password; |
|
39 | + |
|
40 | + return $this; |
|
41 | + } |
|
42 | + |
|
43 | + /** |
|
44 | + * Get hostname |
|
45 | + * |
|
46 | + * @return string |
|
47 | + */ |
|
48 | + public function getHostname(): string |
|
49 | + { |
|
50 | + return $this->hostname; |
|
51 | + } |
|
52 | + |
|
53 | + /** |
|
54 | + * Set hostname |
|
55 | + * |
|
56 | + * @param string $hostname |
|
57 | + * |
|
58 | + * @return ManagementConsole |
|
59 | + */ |
|
60 | + public function setHostname(string $hostname): ManagementConsole |
|
61 | + { |
|
62 | + $this->hostname = $hostname; |
|
63 | + |
|
64 | + return $this; |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * Upload a license and software package for the first time |
|
69 | + * |
|
70 | + * @link https://developer.github.com/v3/enterprise/management_console/#upload-a-license-and-software-package-for-the-first-time |
|
71 | + * |
|
72 | + * @param string $license |
|
73 | + * @param string $package |
|
74 | + * @param string $settings |
|
75 | + * |
|
76 | + * @return array |
|
77 | + */ |
|
78 | + public function upload(string $license, string $package, string $settings = ''): array |
|
79 | + { |
|
80 | + $this->getApi()->setApiUrl(sprintf('http://license:%s@%s', md5($license), $this->getHostname())); |
|
81 | + |
|
82 | + return $this->getApi()->request(sprintf( |
|
83 | + '/setup/api/start -F package=@%s -F license=@%s -F settings=<%s', |
|
84 | + $package, |
|
85 | + $license, |
|
86 | + $settings |
|
87 | + ), Request::METHOD_POST); |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * Upgrade a license or software package |
|
92 | + * |
|
93 | + * @link https://developer.github.com/v3/enterprise/management_console/#upgrade-a-license-or-software-package |
|
94 | + * |
|
95 | + * @param string $license |
|
96 | + * @param string $package |
|
97 | + * |
|
98 | + * @return array |
|
99 | + */ |
|
100 | + public function upgrade(string $license = '', string $package = ''): array |
|
101 | + { |
|
102 | + $this->getApi()->setApiUrl(sprintf('http://license:%s@%s', md5($license), $this->getHostname())); |
|
103 | + |
|
104 | + return $this->getApi()->request( |
|
105 | + sprintf('/setup/api/upgrade -F package=@%s -F license=@%s', $package, $license), |
|
106 | + Request::METHOD_POST |
|
107 | + ); |
|
108 | + } |
|
109 | + |
|
110 | + /** |
|
111 | + * Check configuration status |
|
112 | + * |
|
113 | + * @link https://developer.github.com/v3/enterprise/management_console/#check-configuration-status |
|
114 | + * @return array |
|
115 | + */ |
|
116 | + public function checkConfigurationStatus(): array |
|
117 | + { |
|
118 | + return $this->getApi()->request(sprintf('/setup/api/configcheck')); |
|
119 | + } |
|
120 | + |
|
121 | + /** |
|
122 | + * Start a configuration process |
|
123 | + * |
|
124 | + * @link https://developer.github.com/v3/enterprise/management_console/#start-a-configuration-process |
|
125 | + * @return array |
|
126 | + */ |
|
127 | + public function startConfigurationProcess(): array |
|
128 | + { |
|
129 | + return $this->getApi()->request(sprintf('/setup/api/configure'), Request::METHOD_POST); |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * Retrieve settings |
|
134 | + * |
|
135 | + * @link https://developer.github.com/v3/enterprise/management_console/#retrieve-settings |
|
136 | + * @return array |
|
137 | + */ |
|
138 | + public function retrieveSettings(): array |
|
139 | + { |
|
140 | + return $this->getApi()->request(sprintf('/setup/api/settings')); |
|
141 | + } |
|
142 | + |
|
143 | + /** |
|
144 | + * Modify settings |
|
145 | + * |
|
146 | + * @link https://developer.github.com/v3/enterprise/management_console/#modify-settings |
|
147 | + * |
|
148 | + * @param $settings |
|
149 | + * |
|
150 | + * @return array |
|
151 | + */ |
|
152 | + public function modifySettings($settings): array |
|
153 | + { |
|
154 | + return $this->getApi()->request(sprintf('/setup/api/settings settings=%s', $settings), Request::METHOD_PUT); |
|
155 | + } |
|
156 | + |
|
157 | + /** |
|
158 | + * Check maintenance status |
|
159 | + * |
|
160 | + * @link https://developer.github.com/v3/enterprise/management_console/#check-maintenance-status |
|
161 | + * @return array |
|
162 | + */ |
|
163 | + public function checkMaintenanceStatus(): array |
|
164 | + { |
|
165 | + return $this->getApi()->request(sprintf('/setup/api/maintenance')); |
|
166 | + } |
|
167 | + |
|
168 | + /** |
|
169 | + * Enable or disable maintenance mode |
|
170 | + * |
|
171 | + * @link https://developer.github.com/v3/enterprise/management_console/#enable-or-disable-maintenance-mode |
|
172 | + * |
|
173 | + * @param string $maintenance |
|
174 | + * |
|
175 | + * @return array |
|
176 | + */ |
|
177 | + public function updateMaintenanceStatus(string $maintenance): array |
|
178 | + { |
|
179 | + return $this->getApi()->request( |
|
180 | + sprintf('/setup/api/maintenance -d maintenance=%s', $maintenance), |
|
181 | + Request::METHOD_POST |
|
182 | + ); |
|
183 | + } |
|
184 | + |
|
185 | + /** |
|
186 | + * Retrieve authorized SSH keys |
|
187 | + * |
|
188 | + * @link https://developer.github.com/v3/enterprise/management_console/#retrieve-authorized-ssh-keys |
|
189 | + * @return array |
|
190 | + */ |
|
191 | + public function retrieveAuthorizedSshKeys(): array |
|
192 | + { |
|
193 | + return $this->getApi()->request(sprintf('/setup/api/settings/authorized-keys')); |
|
194 | + } |
|
195 | + |
|
196 | + /** |
|
197 | + * Add a new authorized SSH key |
|
198 | + * |
|
199 | + * @link https://developer.github.com/v3/enterprise/management_console/#add-a-new-authorized-ssh-key |
|
200 | + * |
|
201 | + * @param string $authorizedKey |
|
202 | + * |
|
203 | + * @return array |
|
204 | + */ |
|
205 | + public function addNewAuthorizedSshKeys(string $authorizedKey): array |
|
206 | + { |
|
207 | + return $this->getApi()->request(sprintf( |
|
208 | + '/setup/api/settings/authorized-keys -F authorized_key=@%s', |
|
209 | + $authorizedKey |
|
210 | + ), Request::METHOD_POST); |
|
211 | + } |
|
212 | + |
|
213 | + /** |
|
214 | + * Remove an authorized SSH key |
|
215 | + * |
|
216 | + * @link https://developer.github.com/v3/enterprise/management_console/#remove-an-authorized-ssh-key |
|
217 | + * |
|
218 | + * @param string $authorizedKey |
|
219 | + * |
|
220 | + * @return array |
|
221 | + */ |
|
222 | + public function removeAuthorizedSshKeys(string $authorizedKey): array |
|
223 | + { |
|
224 | + return $this->getApi()->request(sprintf( |
|
225 | + '/setup/api/settings/authorized-keys -F authorized_key=@%s', |
|
226 | + $authorizedKey |
|
227 | + ), Request::METHOD_DELETE); |
|
228 | + } |
|
229 | 229 | } |
@@ -12,19 +12,19 @@ |
||
12 | 12 | class SearchIndexing extends AbstractEnterprise |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Queue an indexing job |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/enterprise/search_indexing/#queue-an-indexing-job |
|
19 | - * |
|
20 | - * @param string $target |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function queueIndexingJob(string $target): array |
|
25 | - { |
|
26 | - return $this->getApi()->request(sprintf('/staff/indexing_jobs'), Request::METHOD_POST, [ |
|
27 | - 'target' => $target |
|
28 | - ]); |
|
29 | - } |
|
15 | + /** |
|
16 | + * Queue an indexing job |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/enterprise/search_indexing/#queue-an-indexing-job |
|
19 | + * |
|
20 | + * @param string $target |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function queueIndexingJob(string $target): array |
|
25 | + { |
|
26 | + return $this->getApi()->request(sprintf('/staff/indexing_jobs'), Request::METHOD_POST, [ |
|
27 | + 'target' => $target |
|
28 | + ]); |
|
29 | + } |
|
30 | 30 | } |
@@ -12,44 +12,44 @@ |
||
12 | 12 | */ |
13 | 13 | abstract class AbstractEnterprise |
14 | 14 | { |
15 | - /** Api trait */ |
|
16 | - use Api; |
|
15 | + /** Api trait */ |
|
16 | + use Api; |
|
17 | 17 | |
18 | - /** Properties */ |
|
19 | - protected $enterprise; |
|
18 | + /** Properties */ |
|
19 | + protected $enterprise; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Constructor |
|
23 | - * |
|
24 | - * @param Enterprise $enterprise |
|
25 | - */ |
|
26 | - public function __construct(Enterprise $enterprise) |
|
27 | - { |
|
28 | - $this->setEnterprise($enterprise); |
|
29 | - $this->setApi($enterprise->getApi()); |
|
30 | - } |
|
21 | + /** |
|
22 | + * Constructor |
|
23 | + * |
|
24 | + * @param Enterprise $enterprise |
|
25 | + */ |
|
26 | + public function __construct(Enterprise $enterprise) |
|
27 | + { |
|
28 | + $this->setEnterprise($enterprise); |
|
29 | + $this->setApi($enterprise->getApi()); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * Get enterprise |
|
34 | - * |
|
35 | - * @return Enterprise |
|
36 | - */ |
|
37 | - public function getEnterprise(): Enterprise |
|
38 | - { |
|
39 | - return $this->enterprise; |
|
40 | - } |
|
32 | + /** |
|
33 | + * Get enterprise |
|
34 | + * |
|
35 | + * @return Enterprise |
|
36 | + */ |
|
37 | + public function getEnterprise(): Enterprise |
|
38 | + { |
|
39 | + return $this->enterprise; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Set enterprise |
|
44 | - * |
|
45 | - * @param Enterprise $enterprise |
|
46 | - * |
|
47 | - * @return AbstractEnterprise |
|
48 | - */ |
|
49 | - public function setEnterprise(Enterprise $enterprise): AbstractEnterprise |
|
50 | - { |
|
51 | - $this->enterprise = $enterprise; |
|
42 | + /** |
|
43 | + * Set enterprise |
|
44 | + * |
|
45 | + * @param Enterprise $enterprise |
|
46 | + * |
|
47 | + * @return AbstractEnterprise |
|
48 | + */ |
|
49 | + public function setEnterprise(Enterprise $enterprise): AbstractEnterprise |
|
50 | + { |
|
51 | + $this->enterprise = $enterprise; |
|
52 | 52 | |
53 | - return $this; |
|
54 | - } |
|
53 | + return $this; |
|
54 | + } |
|
55 | 55 | } |