Completed
Pull Request — master (#47)
by David
03:07
created
lib/GitHub/Receiver/Enterprise/Ldap.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -15,67 +15,67 @@
 block discarded – undo
15 15
 class Ldap extends AbstractEnterprise
16 16
 {
17 17
 
18
-    /**
19
-     * Update LDAP mapping for a user
20
-     *
21
-     * @link https://developer.github.com/v3/enterprise/ldap/#update-ldap-mapping-for-a-user
22
-     *
23
-     * @param string $username
24
-     *
25
-     * @return array
26
-     * @throws Exception
27
-     */
28
-    public function updateMappingUser(string $username): array
29
-    {
30
-        return $this->getApi()->request($this->getApi()->sprintf('/admin/ldap/user/:username/mapping', $username),
31
-            Request::METHOD_PATCH);
32
-    }
18
+	/**
19
+	 * Update LDAP mapping for a user
20
+	 *
21
+	 * @link https://developer.github.com/v3/enterprise/ldap/#update-ldap-mapping-for-a-user
22
+	 *
23
+	 * @param string $username
24
+	 *
25
+	 * @return array
26
+	 * @throws Exception
27
+	 */
28
+	public function updateMappingUser(string $username): array
29
+	{
30
+		return $this->getApi()->request($this->getApi()->sprintf('/admin/ldap/user/:username/mapping', $username),
31
+			Request::METHOD_PATCH);
32
+	}
33 33
 
34
-    /**
35
-     * Sync LDAP mapping for a user
36
-     *
37
-     * @link https://developer.github.com/v3/enterprise/ldap/#sync-ldap-mapping-for-a-user
38
-     *
39
-     * @param int $userId
40
-     *
41
-     * @return array
42
-     * @throws Exception
43
-     */
44
-    public function syncMappingUser(int $userId): array
45
-    {
46
-        return $this->getApi()->request($this->getApi()->sprintf('/admin/ldap/user/:user_id/sync', (string)$userId),
47
-            Request::METHOD_POST);
48
-    }
34
+	/**
35
+	 * Sync LDAP mapping for a user
36
+	 *
37
+	 * @link https://developer.github.com/v3/enterprise/ldap/#sync-ldap-mapping-for-a-user
38
+	 *
39
+	 * @param int $userId
40
+	 *
41
+	 * @return array
42
+	 * @throws Exception
43
+	 */
44
+	public function syncMappingUser(int $userId): array
45
+	{
46
+		return $this->getApi()->request($this->getApi()->sprintf('/admin/ldap/user/:user_id/sync', (string)$userId),
47
+			Request::METHOD_POST);
48
+	}
49 49
 
50
-    /**
51
-     * Update LDAP mapping for a team
52
-     *
53
-     * @link https://developer.github.com/v3/enterprise/ldap/#update-ldap-mapping-for-a-team
54
-     *
55
-     * @param int $teamId
56
-     *
57
-     * @return array
58
-     * @throws Exception
59
-     */
60
-    public function updateMappingTeam(int $teamId): array
61
-    {
62
-        return $this->getApi()->request($this->getApi()->sprintf('/admin/ldap/teams/:team_id/mapping', (string)$teamId),
63
-            Request::METHOD_PATCH);
64
-    }
50
+	/**
51
+	 * Update LDAP mapping for a team
52
+	 *
53
+	 * @link https://developer.github.com/v3/enterprise/ldap/#update-ldap-mapping-for-a-team
54
+	 *
55
+	 * @param int $teamId
56
+	 *
57
+	 * @return array
58
+	 * @throws Exception
59
+	 */
60
+	public function updateMappingTeam(int $teamId): array
61
+	{
62
+		return $this->getApi()->request($this->getApi()->sprintf('/admin/ldap/teams/:team_id/mapping', (string)$teamId),
63
+			Request::METHOD_PATCH);
64
+	}
65 65
 
66
-    /**
67
-     * Sync LDAP mapping for a team
68
-     *
69
-     * @link https://developer.github.com/v3/enterprise/ldap/#sync-ldap-mapping-for-a-team
70
-     *
71
-     * @param int $teamId
72
-     *
73
-     * @return array
74
-     * @throws Exception
75
-     */
76
-    public function syncMappingTeam(int $teamId): array
77
-    {
78
-        return $this->getApi()->request($this->getApi()->sprintf('/admin/ldap/teams/:team_id/sync', (string)$teamId),
79
-            Request::METHOD_POST);
80
-    }
66
+	/**
67
+	 * Sync LDAP mapping for a team
68
+	 *
69
+	 * @link https://developer.github.com/v3/enterprise/ldap/#sync-ldap-mapping-for-a-team
70
+	 *
71
+	 * @param int $teamId
72
+	 *
73
+	 * @return array
74
+	 * @throws Exception
75
+	 */
76
+	public function syncMappingTeam(int $teamId): array
77
+	{
78
+		return $this->getApi()->request($this->getApi()->sprintf('/admin/ldap/teams/:team_id/sync', (string)$teamId),
79
+			Request::METHOD_POST);
80
+	}
81 81
 }
82 82
\ No newline at end of file
Please login to merge, or discard this patch.
lib/GitHub/Receiver/Enterprise/ManagementConsole.php 1 patch
Indentation   +202 added lines, -202 removed lines patch added patch discarded remove patch
@@ -12,206 +12,206 @@
 block discarded – undo
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('/setup/api/start -F package=@%s -F license=@%s -F settings=<%s',
83
-            $package, $license, $settings), Request::METHOD_POST);
84
-    }
85
-
86
-    /**
87
-     * Upgrade a license or software package
88
-     *
89
-     * @link https://developer.github.com/v3/enterprise/management_console/#upgrade-a-license-or-software-package
90
-     *
91
-     * @param string $license
92
-     * @param string $package
93
-     *
94
-     * @return array
95
-     */
96
-    public function upgrade(string $license = '', string $package = ''): array
97
-    {
98
-        $this->getApi()->setApiUrl(sprintf('http://license:%s@%s', md5($license), $this->getHostname()));
99
-
100
-        return $this->getApi()->request(sprintf('/setup/api/upgrade -F package=@%s -F license=@%s', $package, $license),
101
-            Request::METHOD_POST);
102
-    }
103
-
104
-    /**
105
-     * Check configuration status
106
-     *
107
-     * @link https://developer.github.com/v3/enterprise/management_console/#check-configuration-status
108
-     * @return array
109
-     */
110
-    public function checkConfigurationStatus(): array
111
-    {
112
-        return $this->getApi()->request(sprintf('/setup/api/configcheck'));
113
-    }
114
-
115
-    /**
116
-     * Start a configuration process
117
-     *
118
-     * @link https://developer.github.com/v3/enterprise/management_console/#start-a-configuration-process
119
-     * @return array
120
-     */
121
-    public function startConfigurationProcess(): array
122
-    {
123
-        return $this->getApi()->request(sprintf('/setup/api/configure'), Request::METHOD_POST);
124
-    }
125
-
126
-    /**
127
-     * Retrieve settings
128
-     *
129
-     * @link https://developer.github.com/v3/enterprise/management_console/#retrieve-settings
130
-     * @return array
131
-     */
132
-    public function retrieveSettings(): array
133
-    {
134
-        return $this->getApi()->request(sprintf('/setup/api/settings'));
135
-    }
136
-
137
-    /**
138
-     * Modify settings
139
-     *
140
-     * @link https://developer.github.com/v3/enterprise/management_console/#modify-settings
141
-     *
142
-     * @param $settings
143
-     *
144
-     * @return array
145
-     */
146
-    public function modifySettings($settings): array
147
-    {
148
-        return $this->getApi()->request(sprintf('/setup/api/settings settings=%s', $settings), Request::METHOD_PUT);
149
-    }
150
-
151
-    /**
152
-     * Check maintenance status
153
-     *
154
-     * @link https://developer.github.com/v3/enterprise/management_console/#check-maintenance-status
155
-     * @return array
156
-     */
157
-    public function checkMaintenanceStatus(): array
158
-    {
159
-        return $this->getApi()->request(sprintf('/setup/api/maintenance'));
160
-    }
161
-
162
-    /**
163
-     * Enable or disable maintenance mode
164
-     *
165
-     * @link https://developer.github.com/v3/enterprise/management_console/#enable-or-disable-maintenance-mode
166
-     *
167
-     * @param string $maintenance
168
-     *
169
-     * @return array
170
-     */
171
-    public function updateMaintenanceStatus(string $maintenance): array
172
-    {
173
-        return $this->getApi()->request(sprintf('/setup/api/maintenance -d maintenance=%s', $maintenance),
174
-            Request::METHOD_POST);
175
-    }
176
-
177
-    /**
178
-     * Retrieve authorized SSH keys
179
-     *
180
-     * @link https://developer.github.com/v3/enterprise/management_console/#retrieve-authorized-ssh-keys
181
-     * @return array
182
-     */
183
-    public function retrieveAuthorizedSshKeys(): array
184
-    {
185
-        return $this->getApi()->request(sprintf('/setup/api/settings/authorized-keys'));
186
-    }
187
-
188
-    /**
189
-     * Add a new authorized SSH key
190
-     *
191
-     * @link https://developer.github.com/v3/enterprise/management_console/#add-a-new-authorized-ssh-key
192
-     *
193
-     * @param string $authorizedKey
194
-     *
195
-     * @return array
196
-     */
197
-    public function addNewAuthorizedSshKeys(string $authorizedKey): array
198
-    {
199
-        return $this->getApi()->request(sprintf('/setup/api/settings/authorized-keys -F authorized_key=@%s',
200
-            $authorizedKey), Request::METHOD_POST);
201
-    }
202
-
203
-    /**
204
-     * Remove an authorized SSH key
205
-     *
206
-     * @link https://developer.github.com/v3/enterprise/management_console/#remove-an-authorized-ssh-key
207
-     *
208
-     * @param string $authorizedKey
209
-     *
210
-     * @return array
211
-     */
212
-    public function removeAuthorizedSshKeys(string $authorizedKey): array
213
-    {
214
-        return $this->getApi()->request(sprintf('/setup/api/settings/authorized-keys -F authorized_key=@%s',
215
-            $authorizedKey), Request::METHOD_DELETE);
216
-    }
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('/setup/api/start -F package=@%s -F license=@%s -F settings=<%s',
83
+			$package, $license, $settings), Request::METHOD_POST);
84
+	}
85
+
86
+	/**
87
+	 * Upgrade a license or software package
88
+	 *
89
+	 * @link https://developer.github.com/v3/enterprise/management_console/#upgrade-a-license-or-software-package
90
+	 *
91
+	 * @param string $license
92
+	 * @param string $package
93
+	 *
94
+	 * @return array
95
+	 */
96
+	public function upgrade(string $license = '', string $package = ''): array
97
+	{
98
+		$this->getApi()->setApiUrl(sprintf('http://license:%s@%s', md5($license), $this->getHostname()));
99
+
100
+		return $this->getApi()->request(sprintf('/setup/api/upgrade -F package=@%s -F license=@%s', $package, $license),
101
+			Request::METHOD_POST);
102
+	}
103
+
104
+	/**
105
+	 * Check configuration status
106
+	 *
107
+	 * @link https://developer.github.com/v3/enterprise/management_console/#check-configuration-status
108
+	 * @return array
109
+	 */
110
+	public function checkConfigurationStatus(): array
111
+	{
112
+		return $this->getApi()->request(sprintf('/setup/api/configcheck'));
113
+	}
114
+
115
+	/**
116
+	 * Start a configuration process
117
+	 *
118
+	 * @link https://developer.github.com/v3/enterprise/management_console/#start-a-configuration-process
119
+	 * @return array
120
+	 */
121
+	public function startConfigurationProcess(): array
122
+	{
123
+		return $this->getApi()->request(sprintf('/setup/api/configure'), Request::METHOD_POST);
124
+	}
125
+
126
+	/**
127
+	 * Retrieve settings
128
+	 *
129
+	 * @link https://developer.github.com/v3/enterprise/management_console/#retrieve-settings
130
+	 * @return array
131
+	 */
132
+	public function retrieveSettings(): array
133
+	{
134
+		return $this->getApi()->request(sprintf('/setup/api/settings'));
135
+	}
136
+
137
+	/**
138
+	 * Modify settings
139
+	 *
140
+	 * @link https://developer.github.com/v3/enterprise/management_console/#modify-settings
141
+	 *
142
+	 * @param $settings
143
+	 *
144
+	 * @return array
145
+	 */
146
+	public function modifySettings($settings): array
147
+	{
148
+		return $this->getApi()->request(sprintf('/setup/api/settings settings=%s', $settings), Request::METHOD_PUT);
149
+	}
150
+
151
+	/**
152
+	 * Check maintenance status
153
+	 *
154
+	 * @link https://developer.github.com/v3/enterprise/management_console/#check-maintenance-status
155
+	 * @return array
156
+	 */
157
+	public function checkMaintenanceStatus(): array
158
+	{
159
+		return $this->getApi()->request(sprintf('/setup/api/maintenance'));
160
+	}
161
+
162
+	/**
163
+	 * Enable or disable maintenance mode
164
+	 *
165
+	 * @link https://developer.github.com/v3/enterprise/management_console/#enable-or-disable-maintenance-mode
166
+	 *
167
+	 * @param string $maintenance
168
+	 *
169
+	 * @return array
170
+	 */
171
+	public function updateMaintenanceStatus(string $maintenance): array
172
+	{
173
+		return $this->getApi()->request(sprintf('/setup/api/maintenance -d maintenance=%s', $maintenance),
174
+			Request::METHOD_POST);
175
+	}
176
+
177
+	/**
178
+	 * Retrieve authorized SSH keys
179
+	 *
180
+	 * @link https://developer.github.com/v3/enterprise/management_console/#retrieve-authorized-ssh-keys
181
+	 * @return array
182
+	 */
183
+	public function retrieveAuthorizedSshKeys(): array
184
+	{
185
+		return $this->getApi()->request(sprintf('/setup/api/settings/authorized-keys'));
186
+	}
187
+
188
+	/**
189
+	 * Add a new authorized SSH key
190
+	 *
191
+	 * @link https://developer.github.com/v3/enterprise/management_console/#add-a-new-authorized-ssh-key
192
+	 *
193
+	 * @param string $authorizedKey
194
+	 *
195
+	 * @return array
196
+	 */
197
+	public function addNewAuthorizedSshKeys(string $authorizedKey): array
198
+	{
199
+		return $this->getApi()->request(sprintf('/setup/api/settings/authorized-keys -F authorized_key=@%s',
200
+			$authorizedKey), Request::METHOD_POST);
201
+	}
202
+
203
+	/**
204
+	 * Remove an authorized SSH key
205
+	 *
206
+	 * @link https://developer.github.com/v3/enterprise/management_console/#remove-an-authorized-ssh-key
207
+	 *
208
+	 * @param string $authorizedKey
209
+	 *
210
+	 * @return array
211
+	 */
212
+	public function removeAuthorizedSshKeys(string $authorizedKey): array
213
+	{
214
+		return $this->getApi()->request(sprintf('/setup/api/settings/authorized-keys -F authorized_key=@%s',
215
+			$authorizedKey), Request::METHOD_DELETE);
216
+	}
217 217
 } 
218 218
\ No newline at end of file
Please login to merge, or discard this patch.
lib/GitHub/Receiver/Enterprise/SearchIndexing.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -12,19 +12,19 @@
 block discarded – undo
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
 } 
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
lib/GitHub/Receiver/Enterprise/AdminStats.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@
 block discarded – undo
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
 } 
27 27
\ No newline at end of file
Please login to merge, or discard this patch.
lib/GitHub/Receiver/Issues.php 1 patch
Indentation   +195 added lines, -195 removed lines patch added patch discarded remove patch
@@ -14,206 +14,206 @@
 block discarded – undo
14 14
 class Issues extends AbstractReceiver
15 15
 {
16 16
 
17
-    /** Available sub-Receiver */
18
-    const ASSIGNEES  = 'Assignees';
19
-    const COMMENTS   = 'Comments';
20
-    const EVENTS     = 'Events';
21
-    const LABELS     = 'Labels';
22
-    const MILESTONES = 'Milestones';
17
+	/** Available sub-Receiver */
18
+	const ASSIGNEES  = 'Assignees';
19
+	const COMMENTS   = 'Comments';
20
+	const EVENTS     = 'Events';
21
+	const LABELS     = 'Labels';
22
+	const MILESTONES = 'Milestones';
23 23
 
24
-    /**
25
-     * List issues
26
-     *
27
-     * @link https://developer.github.com/v3/issues/#list-issues
28
-     *
29
-     * @param string $filter
30
-     * @param string $state
31
-     * @param string $labels
32
-     * @param string $sort
33
-     * @param string $direction
34
-     * @param string $since
35
-     *
36
-     * @return array
37
-     */
38
-    public function listIssues(string $filter = AbstractApi::FILTER_ASSIGNED, string $state = AbstractApi::STATE_OPEN,
39
-                               string $labels = '', string $sort = AbstractApi::SORT_CREATED,
40
-                               string $direction = AbstractApi::DIRECTION_DESC, string $since = '1970-01-01'): array
41
-    {
42
-        return $this->getApi()->request($this->getApi()->sprintf('/issues?:args', http_build_query([
43
-                'filter'    => $filter,
44
-                'state'     => $state,
45
-                'labels'    => $labels,
46
-                'sort'      => $sort,
47
-                'direction' => $direction,
48
-                'since'     => (new DateTime($since))->format(DateTime::ATOM)
49
-            ])));
50
-    }
24
+	/**
25
+	 * List issues
26
+	 *
27
+	 * @link https://developer.github.com/v3/issues/#list-issues
28
+	 *
29
+	 * @param string $filter
30
+	 * @param string $state
31
+	 * @param string $labels
32
+	 * @param string $sort
33
+	 * @param string $direction
34
+	 * @param string $since
35
+	 *
36
+	 * @return array
37
+	 */
38
+	public function listIssues(string $filter = AbstractApi::FILTER_ASSIGNED, string $state = AbstractApi::STATE_OPEN,
39
+							   string $labels = '', string $sort = AbstractApi::SORT_CREATED,
40
+							   string $direction = AbstractApi::DIRECTION_DESC, string $since = '1970-01-01'): array
41
+	{
42
+		return $this->getApi()->request($this->getApi()->sprintf('/issues?:args', http_build_query([
43
+				'filter'    => $filter,
44
+				'state'     => $state,
45
+				'labels'    => $labels,
46
+				'sort'      => $sort,
47
+				'direction' => $direction,
48
+				'since'     => (new DateTime($since))->format(DateTime::ATOM)
49
+			])));
50
+	}
51 51
 
52
-    /**
53
-     * List all issues across owned and member repositories for the authenticated user
54
-     *
55
-     * @link https://developer.github.com/v3/issues/#list-issues
56
-     *
57
-     * @param string $filter
58
-     * @param string $state
59
-     * @param string $labels
60
-     * @param string $sort
61
-     * @param string $direction
62
-     * @param string $since
63
-     *
64
-     * @return array
65
-     */
66
-    public function listUserIssues(string $filter = AbstractApi::FILTER_ASSIGNED,
67
-                                   string $state = AbstractApi::STATE_OPEN, string $labels = '',
68
-                                   string $sort = AbstractApi::SORT_CREATED,
69
-                                   string $direction = AbstractApi::DIRECTION_DESC, string $since = '1970-01-01'): array
70
-    {
71
-        return $this->getApi()->request($this->getApi()->sprintf('/user/issues?:args', http_build_query([
72
-                'filter'    => $filter,
73
-                'state'     => $state,
74
-                'labels'    => $labels,
75
-                'sort'      => $sort,
76
-                'direction' => $direction,
77
-                'since'     => (new DateTime($since))->format(DateTime::ATOM)
78
-            ])));
79
-    }
52
+	/**
53
+	 * List all issues across owned and member repositories for the authenticated user
54
+	 *
55
+	 * @link https://developer.github.com/v3/issues/#list-issues
56
+	 *
57
+	 * @param string $filter
58
+	 * @param string $state
59
+	 * @param string $labels
60
+	 * @param string $sort
61
+	 * @param string $direction
62
+	 * @param string $since
63
+	 *
64
+	 * @return array
65
+	 */
66
+	public function listUserIssues(string $filter = AbstractApi::FILTER_ASSIGNED,
67
+								   string $state = AbstractApi::STATE_OPEN, string $labels = '',
68
+								   string $sort = AbstractApi::SORT_CREATED,
69
+								   string $direction = AbstractApi::DIRECTION_DESC, string $since = '1970-01-01'): array
70
+	{
71
+		return $this->getApi()->request($this->getApi()->sprintf('/user/issues?:args', http_build_query([
72
+				'filter'    => $filter,
73
+				'state'     => $state,
74
+				'labels'    => $labels,
75
+				'sort'      => $sort,
76
+				'direction' => $direction,
77
+				'since'     => (new DateTime($since))->format(DateTime::ATOM)
78
+			])));
79
+	}
80 80
 
81
-    /**
82
-     * List all issues for a given organization for the authenticated user
83
-     *
84
-     * @link https://developer.github.com/v3/issues/#list-issues
85
-     *
86
-     * @param string $organization
87
-     * @param string $filter
88
-     * @param string $state
89
-     * @param string $labels
90
-     * @param string $sort
91
-     * @param string $direction
92
-     * @param string $since
93
-     *
94
-     * @return array
95
-     */
96
-    public function listOrganizationIssues(string $organization, string $filter = AbstractApi::FILTER_ASSIGNED,
97
-                                           string $state = AbstractApi::STATE_OPEN, string $labels = '',
98
-                                           string $sort = AbstractApi::SORT_CREATED,
99
-                                           string $direction = AbstractApi::DIRECTION_DESC,
100
-                                           string $since = '1970-01-01'): array
101
-    {
102
-        return $this->getApi()->request($this->getApi()
103
-                                             ->sprintf('/orgs/:org/issues?:args', $organization, http_build_query([
104
-                                                     'filter'    => $filter,
105
-                                                     'state'     => $state,
106
-                                                     'labels'    => $labels,
107
-                                                     'sort'      => $sort,
108
-                                                     'direction' => $direction,
109
-                                                     'since'     => (new DateTime($since))->format(DateTime::ATOM)
110
-                                                 ])));
111
-    }
81
+	/**
82
+	 * List all issues for a given organization for the authenticated user
83
+	 *
84
+	 * @link https://developer.github.com/v3/issues/#list-issues
85
+	 *
86
+	 * @param string $organization
87
+	 * @param string $filter
88
+	 * @param string $state
89
+	 * @param string $labels
90
+	 * @param string $sort
91
+	 * @param string $direction
92
+	 * @param string $since
93
+	 *
94
+	 * @return array
95
+	 */
96
+	public function listOrganizationIssues(string $organization, string $filter = AbstractApi::FILTER_ASSIGNED,
97
+										   string $state = AbstractApi::STATE_OPEN, string $labels = '',
98
+										   string $sort = AbstractApi::SORT_CREATED,
99
+										   string $direction = AbstractApi::DIRECTION_DESC,
100
+										   string $since = '1970-01-01'): array
101
+	{
102
+		return $this->getApi()->request($this->getApi()
103
+											 ->sprintf('/orgs/:org/issues?:args', $organization, http_build_query([
104
+													 'filter'    => $filter,
105
+													 'state'     => $state,
106
+													 'labels'    => $labels,
107
+													 'sort'      => $sort,
108
+													 'direction' => $direction,
109
+													 'since'     => (new DateTime($since))->format(DateTime::ATOM)
110
+												 ])));
111
+	}
112 112
 
113
-    /**
114
-     * List issues for a repository
115
-     *
116
-     * @link https://developer.github.com/v3/issues/#list-issues-for-a-repository
117
-     *
118
-     * @param string $milestone
119
-     * @param string $state
120
-     * @param string $assignee
121
-     * @param string $creator
122
-     * @param string $mentioned
123
-     * @param string $labels
124
-     * @param string $sort
125
-     * @param string $direction
126
-     * @param string $since
127
-     *
128
-     * @return array
129
-     */
130
-    public function listRepositoryIssues(string $milestone = '*', string $state = AbstractApi::STATE_OPEN,
131
-                                         string $assignee = '*', string $creator = '', string $mentioned = '',
132
-                                         string $labels = '', string $sort = AbstractApi::SORT_CREATED,
133
-                                         string $direction = AbstractApi::DIRECTION_DESC,
134
-                                         string $since = '1970-01-01'): array
135
-    {
136
-        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues?:args', $this->getOwner(),
137
-            $this->getRepo(), http_build_query([
138
-                'milestone' => $milestone,
139
-                'state'     => $state,
140
-                'assignee'  => $assignee,
141
-                'creator'   => $creator,
142
-                'mentioned' => $mentioned,
143
-                'labels'    => $labels,
144
-                'sort'      => $sort,
145
-                'direction' => $direction,
146
-                'since'     => (new DateTime($since))->format(DateTime::ATOM)
147
-            ])));
148
-    }
113
+	/**
114
+	 * List issues for a repository
115
+	 *
116
+	 * @link https://developer.github.com/v3/issues/#list-issues-for-a-repository
117
+	 *
118
+	 * @param string $milestone
119
+	 * @param string $state
120
+	 * @param string $assignee
121
+	 * @param string $creator
122
+	 * @param string $mentioned
123
+	 * @param string $labels
124
+	 * @param string $sort
125
+	 * @param string $direction
126
+	 * @param string $since
127
+	 *
128
+	 * @return array
129
+	 */
130
+	public function listRepositoryIssues(string $milestone = '*', string $state = AbstractApi::STATE_OPEN,
131
+										 string $assignee = '*', string $creator = '', string $mentioned = '',
132
+										 string $labels = '', string $sort = AbstractApi::SORT_CREATED,
133
+										 string $direction = AbstractApi::DIRECTION_DESC,
134
+										 string $since = '1970-01-01'): array
135
+	{
136
+		return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues?:args', $this->getOwner(),
137
+			$this->getRepo(), http_build_query([
138
+				'milestone' => $milestone,
139
+				'state'     => $state,
140
+				'assignee'  => $assignee,
141
+				'creator'   => $creator,
142
+				'mentioned' => $mentioned,
143
+				'labels'    => $labels,
144
+				'sort'      => $sort,
145
+				'direction' => $direction,
146
+				'since'     => (new DateTime($since))->format(DateTime::ATOM)
147
+			])));
148
+	}
149 149
 
150
-    /**
151
-     * Get a single issue
152
-     *
153
-     * @link https://developer.github.com/v3/issues/#get-a-single-issue
154
-     *
155
-     * @param int $number
156
-     *
157
-     * @return array
158
-     */
159
-    public function getIssue(int $number): array
160
-    {
161
-        return $this->getApi()->request($this->getApi()
162
-                                             ->sprintf('/repos/:owner/:repo/issues/:number', $this->getOwner(),
163
-                                                 $this->getRepo(), $number));
164
-    }
150
+	/**
151
+	 * Get a single issue
152
+	 *
153
+	 * @link https://developer.github.com/v3/issues/#get-a-single-issue
154
+	 *
155
+	 * @param int $number
156
+	 *
157
+	 * @return array
158
+	 */
159
+	public function getIssue(int $number): array
160
+	{
161
+		return $this->getApi()->request($this->getApi()
162
+											 ->sprintf('/repos/:owner/:repo/issues/:number', $this->getOwner(),
163
+												 $this->getRepo(), $number));
164
+	}
165 165
 
166
-    /**
167
-     * Create an issue
168
-     *
169
-     * @link https://developer.github.com/v3/issues/#create-an-issue
170
-     *
171
-     * @param string $title
172
-     * @param string $body
173
-     * @param string $assignee
174
-     * @param int    $milestone
175
-     * @param array  $labels
176
-     *
177
-     * @return array
178
-     */
179
-    public function createIssue(string $title, string $body = '', string $assignee = '', int $milestone = 0,
180
-                                array $labels = []): array
181
-    {
182
-        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues', $this->getOwner(),
183
-            $this->getRepo()), Request::METHOD_POST, [
184
-                'title'     => $title,
185
-                'body'      => $body,
186
-                'assignee'  => $assignee,
187
-                'milestone' => $milestone,
188
-                'labels'    => $labels
189
-            ]);
190
-    }
166
+	/**
167
+	 * Create an issue
168
+	 *
169
+	 * @link https://developer.github.com/v3/issues/#create-an-issue
170
+	 *
171
+	 * @param string $title
172
+	 * @param string $body
173
+	 * @param string $assignee
174
+	 * @param int    $milestone
175
+	 * @param array  $labels
176
+	 *
177
+	 * @return array
178
+	 */
179
+	public function createIssue(string $title, string $body = '', string $assignee = '', int $milestone = 0,
180
+								array $labels = []): array
181
+	{
182
+		return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues', $this->getOwner(),
183
+			$this->getRepo()), Request::METHOD_POST, [
184
+				'title'     => $title,
185
+				'body'      => $body,
186
+				'assignee'  => $assignee,
187
+				'milestone' => $milestone,
188
+				'labels'    => $labels
189
+			]);
190
+	}
191 191
 
192
-    /**
193
-     * Edit an issue
194
-     *
195
-     * @link https://developer.github.com/v3/issues/#edit-an-issue
196
-     *
197
-     * @param int    $number
198
-     * @param string $title
199
-     * @param string $body
200
-     * @param string $assignee
201
-     * @param int    $milestone
202
-     * @param array  $labels
203
-     *
204
-     * @return array
205
-     */
206
-    public function editIssue(int $number, string $title = '', string $body = '', string $assignee = '',
207
-                              int $milestone = 0, array $labels = []): array
208
-    {
209
-        return $this->getApi()->request($this->getApi()
210
-                                             ->sprintf('/repos/:owner/:repo/issues/:number', $this->getOwner(),
211
-                                                 $this->getRepo(), $number), Request::METHOD_PATCH, [
212
-                'title'     => $title,
213
-                'body'      => $body,
214
-                'assignee'  => $assignee,
215
-                'milestone' => $milestone,
216
-                'labels'    => $labels
217
-            ]);
218
-    }
192
+	/**
193
+	 * Edit an issue
194
+	 *
195
+	 * @link https://developer.github.com/v3/issues/#edit-an-issue
196
+	 *
197
+	 * @param int    $number
198
+	 * @param string $title
199
+	 * @param string $body
200
+	 * @param string $assignee
201
+	 * @param int    $milestone
202
+	 * @param array  $labels
203
+	 *
204
+	 * @return array
205
+	 */
206
+	public function editIssue(int $number, string $title = '', string $body = '', string $assignee = '',
207
+							  int $milestone = 0, array $labels = []): array
208
+	{
209
+		return $this->getApi()->request($this->getApi()
210
+											 ->sprintf('/repos/:owner/:repo/issues/:number', $this->getOwner(),
211
+												 $this->getRepo(), $number), Request::METHOD_PATCH, [
212
+				'title'     => $title,
213
+				'body'      => $body,
214
+				'assignee'  => $assignee,
215
+				'milestone' => $milestone,
216
+				'labels'    => $labels
217
+			]);
218
+	}
219 219
 } 
220 220
\ No newline at end of file
Please login to merge, or discard this patch.
lib/GitHub/Receiver/PullRequests.php 1 patch
Indentation   +162 added lines, -162 removed lines patch added patch discarded remove patch
@@ -14,176 +14,176 @@
 block discarded – undo
14 14
 class PullRequests extends AbstractReceiver
15 15
 {
16 16
 
17
-    /** Available sub-Receiver */
18
-    const REVIEW_COMMENTS = 'ReviewComments';
17
+	/** Available sub-Receiver */
18
+	const REVIEW_COMMENTS = 'ReviewComments';
19 19
 
20
-    /**
21
-     * List pull requests
22
-     *
23
-     * @link https://developer.github.com/v3/pulls/#list-pull-requests
24
-     *
25
-     * @param string $state
26
-     * @param string $head
27
-     * @param string $base
28
-     * @param string $sort
29
-     * @param string $direction
30
-     *
31
-     * @return array
32
-     * @throws \Exception
33
-     */
34
-    public function listPullRequests(string $state = AbstractApi::STATE_OPEN, string $head = null, string $base = null,
35
-                                     string $sort = AbstractApi::SORT_CREATED,
36
-                                     string $direction = AbstractApi::DIRECTION_ASC): array
37
-    {
38
-        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls?:args', $this->getOwner(),
39
-            $this->getRepo(), http_build_query([
40
-                'state'     => $state,
41
-                'head'      => $head,
42
-                'base'      => $base,
43
-                'sort'      => $sort,
44
-                'direction' => $direction
45
-            ])));
46
-    }
20
+	/**
21
+	 * List pull requests
22
+	 *
23
+	 * @link https://developer.github.com/v3/pulls/#list-pull-requests
24
+	 *
25
+	 * @param string $state
26
+	 * @param string $head
27
+	 * @param string $base
28
+	 * @param string $sort
29
+	 * @param string $direction
30
+	 *
31
+	 * @return array
32
+	 * @throws \Exception
33
+	 */
34
+	public function listPullRequests(string $state = AbstractApi::STATE_OPEN, string $head = null, string $base = null,
35
+									 string $sort = AbstractApi::SORT_CREATED,
36
+									 string $direction = AbstractApi::DIRECTION_ASC): array
37
+	{
38
+		return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls?:args', $this->getOwner(),
39
+			$this->getRepo(), http_build_query([
40
+				'state'     => $state,
41
+				'head'      => $head,
42
+				'base'      => $base,
43
+				'sort'      => $sort,
44
+				'direction' => $direction
45
+			])));
46
+	}
47 47
 
48
-    /**
49
-     * Get a single pull request
50
-     *
51
-     * @link https://developer.github.com/v3/pulls/#get-a-single-pull-request
52
-     *
53
-     * @param int $number
54
-     *
55
-     * @return array
56
-     * @throws \Exception
57
-     */
58
-    public function getSinglePullRequest(int $number): array
59
-    {
60
-        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number', $this->getOwner(),
61
-            $this->getRepo(), $number));
62
-    }
48
+	/**
49
+	 * Get a single pull request
50
+	 *
51
+	 * @link https://developer.github.com/v3/pulls/#get-a-single-pull-request
52
+	 *
53
+	 * @param int $number
54
+	 *
55
+	 * @return array
56
+	 * @throws \Exception
57
+	 */
58
+	public function getSinglePullRequest(int $number): array
59
+	{
60
+		return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number', $this->getOwner(),
61
+			$this->getRepo(), $number));
62
+	}
63 63
 
64
-    /**
65
-     * Create a pull request
66
-     *
67
-     * @link https://developer.github.com/v3/pulls/#create-a-pull-request
68
-     *
69
-     * @param string $title
70
-     * @param string $head
71
-     * @param string $base
72
-     * @param string $body
73
-     *
74
-     * @return array
75
-     * @throws \Exception
76
-     */
77
-    public function createPullrequest(string $title, string $head, string $base, string $body): array
78
-    {
79
-        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls', $this->getOwner(),
80
-            $this->getRepo()), Request::METHOD_POST, [
81
-                'title' => $title,
82
-                'head'  => $head,
83
-                'base'  => $base,
84
-                'body'  => $body
85
-            ]);
86
-    }
64
+	/**
65
+	 * Create a pull request
66
+	 *
67
+	 * @link https://developer.github.com/v3/pulls/#create-a-pull-request
68
+	 *
69
+	 * @param string $title
70
+	 * @param string $head
71
+	 * @param string $base
72
+	 * @param string $body
73
+	 *
74
+	 * @return array
75
+	 * @throws \Exception
76
+	 */
77
+	public function createPullrequest(string $title, string $head, string $base, string $body): array
78
+	{
79
+		return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls', $this->getOwner(),
80
+			$this->getRepo()), Request::METHOD_POST, [
81
+				'title' => $title,
82
+				'head'  => $head,
83
+				'base'  => $base,
84
+				'body'  => $body
85
+			]);
86
+	}
87 87
 
88
-    /**
89
-     * Update a pull request
90
-     *
91
-     * @link https://developer.github.com/v3/pulls/#update-a-pull-request
92
-     *
93
-     * @param int    $number
94
-     * @param string $title
95
-     * @param string $body
96
-     * @param string $state
97
-     *
98
-     * @return array
99
-     * @throws \Exception
100
-     */
101
-    public function updatePullRequest(int $number, string $title = null, string $body = null,
102
-                                      string $state = null): array
103
-    {
104
-        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number', $this->getOwner(),
105
-            $this->getRepo(), $number), Request::METHOD_PATCH, [
106
-                'title' => $title,
107
-                'body'  => $body,
108
-                'state' => $state
109
-            ]);
110
-    }
88
+	/**
89
+	 * Update a pull request
90
+	 *
91
+	 * @link https://developer.github.com/v3/pulls/#update-a-pull-request
92
+	 *
93
+	 * @param int    $number
94
+	 * @param string $title
95
+	 * @param string $body
96
+	 * @param string $state
97
+	 *
98
+	 * @return array
99
+	 * @throws \Exception
100
+	 */
101
+	public function updatePullRequest(int $number, string $title = null, string $body = null,
102
+									  string $state = null): array
103
+	{
104
+		return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number', $this->getOwner(),
105
+			$this->getRepo(), $number), Request::METHOD_PATCH, [
106
+				'title' => $title,
107
+				'body'  => $body,
108
+				'state' => $state
109
+			]);
110
+	}
111 111
 
112
-    /**
113
-     * List commits on a pull request
114
-     *
115
-     * @link https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request
116
-     *
117
-     * @param int $number
118
-     *
119
-     * @return array
120
-     * @throws \Exception
121
-     */
122
-    public function listCommits(int $number): array
123
-    {
124
-        return $this->getApi()->request($this->getApi()
125
-                                             ->sprintf('/repos/:owner/:repo/pulls/:number/commits', $this->getOwner(),
126
-                                                 $this->getRepo(), $number));
127
-    }
112
+	/**
113
+	 * List commits on a pull request
114
+	 *
115
+	 * @link https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request
116
+	 *
117
+	 * @param int $number
118
+	 *
119
+	 * @return array
120
+	 * @throws \Exception
121
+	 */
122
+	public function listCommits(int $number): array
123
+	{
124
+		return $this->getApi()->request($this->getApi()
125
+											 ->sprintf('/repos/:owner/:repo/pulls/:number/commits', $this->getOwner(),
126
+												 $this->getRepo(), $number));
127
+	}
128 128
 
129
-    /**
130
-     * List pull requests files
131
-     *
132
-     * @link https://developer.github.com/v3/pulls/#list-pull-requests-files
133
-     *
134
-     * @param int $number
135
-     *
136
-     * @return array
137
-     * @throws \Exception
138
-     */
139
-    public function listPullRequestsFiles(int $number): array
140
-    {
141
-        return $this->getApi()->request($this->getApi()
142
-                                             ->sprintf('/repos/:owner/:repo/pulls/:number/files', $this->getOwner(),
143
-                                                 $this->getRepo(), $number));
144
-    }
129
+	/**
130
+	 * List pull requests files
131
+	 *
132
+	 * @link https://developer.github.com/v3/pulls/#list-pull-requests-files
133
+	 *
134
+	 * @param int $number
135
+	 *
136
+	 * @return array
137
+	 * @throws \Exception
138
+	 */
139
+	public function listPullRequestsFiles(int $number): array
140
+	{
141
+		return $this->getApi()->request($this->getApi()
142
+											 ->sprintf('/repos/:owner/:repo/pulls/:number/files', $this->getOwner(),
143
+												 $this->getRepo(), $number));
144
+	}
145 145
 
146
-    /**
147
-     * Get if a pull request has been merged
148
-     *
149
-     * @link https://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged
150
-     *
151
-     * @param int $number
152
-     *
153
-     * @return bool
154
-     * @throws \Exception
155
-     */
156
-    public function checkPullRequestsMerged(int $number): bool
157
-    {
158
-        $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number/merge', $this->getOwner(),
159
-            $this->getRepo(), $number));
146
+	/**
147
+	 * Get if a pull request has been merged
148
+	 *
149
+	 * @link https://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged
150
+	 *
151
+	 * @param int $number
152
+	 *
153
+	 * @return bool
154
+	 * @throws \Exception
155
+	 */
156
+	public function checkPullRequestsMerged(int $number): bool
157
+	{
158
+		$this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number/merge', $this->getOwner(),
159
+			$this->getRepo(), $number));
160 160
 
161
-        if ($this->getApi()->getHeaders()['Status'] == '204 No Content') {
162
-            return true;
163
-        }
161
+		if ($this->getApi()->getHeaders()['Status'] == '204 No Content') {
162
+			return true;
163
+		}
164 164
 
165
-        return false;
166
-    }
165
+		return false;
166
+	}
167 167
 
168
-    /**
169
-     * Merge a pull request (Merge Button)
170
-     *
171
-     * @link https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button
172
-     *
173
-     * @param int    $number
174
-     * @param string $commitMessage
175
-     * @param string $sha
176
-     *
177
-     * @return array
178
-     * @throws \Exception
179
-     */
180
-    public function mergePullRequest(int $number, string $commitMessage = null, string $sha = null): array
181
-    {
182
-        return $this->getApi()->request($this->getApi()
183
-                                             ->sprintf('/repos/:owner/:repo/pulls/:number/merge', $this->getOwner(),
184
-                                                 $this->getRepo(), $number), Request::METHOD_PUT, [
185
-                'commit_message' => $commitMessage,
186
-                'sha'            => $sha
187
-            ]);
188
-    }
168
+	/**
169
+	 * Merge a pull request (Merge Button)
170
+	 *
171
+	 * @link https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button
172
+	 *
173
+	 * @param int    $number
174
+	 * @param string $commitMessage
175
+	 * @param string $sha
176
+	 *
177
+	 * @return array
178
+	 * @throws \Exception
179
+	 */
180
+	public function mergePullRequest(int $number, string $commitMessage = null, string $sha = null): array
181
+	{
182
+		return $this->getApi()->request($this->getApi()
183
+											 ->sprintf('/repos/:owner/:repo/pulls/:number/merge', $this->getOwner(),
184
+												 $this->getRepo(), $number), Request::METHOD_PUT, [
185
+				'commit_message' => $commitMessage,
186
+				'sha'            => $sha
187
+			]);
188
+	}
189 189
 }
190 190
\ No newline at end of file
Please login to merge, or discard this patch.
lib/GitHub/WebHook.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -12,24 +12,24 @@
 block discarded – undo
12 12
 class WebHook extends AbstractApi
13 13
 {
14 14
 
15
-    /** Constants */
16
-    const PAYLOAD = 'Payload';
15
+	/** Constants */
16
+	const PAYLOAD = 'Payload';
17 17
 
18
-    /**
19
-     * Returns Event object
20
-     *
21
-     * @param string $event
22
-     *
23
-     * @return null|EventInterface
24
-     */
25
-    public function getEvent(string $event)
26
-    {
27
-        $class = (string)$this->sprintf(':namespace\Event\:event', __NAMESPACE__, $event);
18
+	/**
19
+	 * Returns Event object
20
+	 *
21
+	 * @param string $event
22
+	 *
23
+	 * @return null|EventInterface
24
+	 */
25
+	public function getEvent(string $event)
26
+	{
27
+		$class = (string)$this->sprintf(':namespace\Event\:event', __NAMESPACE__, $event);
28 28
 
29
-        if (class_exists($class)) {
30
-            return new $class($this);
31
-        }
29
+		if (class_exists($class)) {
30
+			return new $class($this);
31
+		}
32 32
 
33
-        return null;
34
-    }
33
+		return null;
34
+	}
35 35
 } 
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
lib/GitHub/Event/EventInterface.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,17 +11,17 @@
 block discarded – undo
11 11
 interface EventInterface
12 12
 {
13 13
 
14
-    /**
15
-     * Constructor, pass a WebHook object
16
-     *
17
-     * @param WebHook $webHook
18
-     */
19
-    public function __construct(WebHook $webHook);
14
+	/**
15
+	 * Constructor, pass a WebHook object
16
+	 *
17
+	 * @param WebHook $webHook
18
+	 */
19
+	public function __construct(WebHook $webHook);
20 20
 
21
-    /**
22
-     * Parse raw data
23
-     *
24
-     * @return Payload
25
-     */
26
-    public function parse(): Payload;
21
+	/**
22
+	 * Parse raw data
23
+	 *
24
+	 * @return Payload
25
+	 */
26
+	public function parse(): Payload;
27 27
 }
28 28
\ No newline at end of file
Please login to merge, or discard this patch.
lib/GitHub/Event/Payload.php 1 patch
Indentation   +186 added lines, -186 removed lines patch added patch discarded remove patch
@@ -13,190 +13,190 @@
 block discarded – undo
13 13
 class Payload implements EventInterface
14 14
 {
15 15
 
16
-    /** Protected properties */
17
-    protected $webHook;
18
-    protected $secret = null;
19
-    protected $rawData;
20
-    protected $parsedData;
21
-
22
-    /**
23
-     * Constructor, pass a WebHook object
24
-     *
25
-     * @param WebHook $webHook
26
-     */
27
-    public function __construct(WebHook $webHook)
28
-    {
29
-        $this->setWebHook($webHook);
30
-        $this->setRawData($webHook->getRequest()->getContent());
31
-    }
32
-
33
-    /**
34
-     * Get webHook
35
-     *
36
-     * @return null|WebHook
37
-     */
38
-    public function getWebHook()
39
-    {
40
-        return $this->webHook;
41
-    }
42
-
43
-    /**
44
-     * Set webHook
45
-     *
46
-     * @param mixed $webHook
47
-     *
48
-     * @return Payload
49
-     */
50
-    public function setWebHook($webHook): Payload
51
-    {
52
-        $this->webHook = $webHook;
53
-
54
-        return $this;
55
-    }
56
-
57
-    /**
58
-     * Set secret, encode this secret with Hmac, SHA1 method
59
-     *
60
-     * @param string $secret
61
-     *
62
-     * @return Payload
63
-     */
64
-    public function setSecret(string $secret): Payload
65
-    {
66
-        $this->secret = hash_hmac('sha1', $this->rawData, $secret);
67
-
68
-        return $this;
69
-    }
70
-
71
-    /**
72
-     * Get secret
73
-     *
74
-     * @return null|string
75
-     */
76
-    public function getSecret()
77
-    {
78
-        return $this->secret;
79
-    }
80
-
81
-    /**
82
-     * Get rawData
83
-     *
84
-     * @return resource|string
85
-     */
86
-    public function getRawData()
87
-    {
88
-        return $this->rawData;
89
-    }
90
-
91
-    /**
92
-     * Set rawData
93
-     *
94
-     * @param resource|string $rawData
95
-     *
96
-     * @return Payload
97
-     */
98
-    public function setRawData($rawData): Payload
99
-    {
100
-        $this->rawData = $rawData;
101
-
102
-        return $this;
103
-    }
104
-
105
-    /**
106
-     * Get parsedData
107
-     *
108
-     * @return mixed
109
-     */
110
-    public function getData()
111
-    {
112
-        return $this->parsedData;
113
-    }
114
-
115
-    /**
116
-     * Set parsedData
117
-     *
118
-     * @param mixed $parsedData
119
-     *
120
-     * @return Payload
121
-     */
122
-    protected function setParsedData($parsedData): Payload
123
-    {
124
-        $data = json_decode($parsedData);
125
-        if (JSON_ERROR_NONE === json_last_error()) {
126
-            $this->parsedData = $data;
127
-        }
128
-
129
-        return $this;
130
-    }
131
-
132
-    /**
133
-     * Debugger
134
-     *
135
-     * @return array
136
-     */
137
-    public function __debugInfo(): array
138
-    {
139
-        return [
140
-            'ramData'     => (array)$this->getRawData(),
141
-            'jsonEncoded' => json_decode($this->getRawData())
142
-        ];
143
-    }
144
-
145
-    /**
146
-     * Parse raw data
147
-     *
148
-     * @return Payload
149
-     * @throws BadSignatureException
150
-     * @throws \Exception
151
-     */
152
-    public function parse(): Payload
153
-    {
154
-        /** Check signature from header */
155
-        if (!$this->_checkSignature()) {
156
-            throw new BadSignatureException('Hook secret does not match.');
157
-        }
158
-
159
-        /** Get data from different locations according to content-type */
160
-        switch ($_SERVER['CONTENT_TYPE']) {
161
-            case 'application/json':
162
-                $data = $this->getRawData();
163
-                break;
164
-
165
-            case 'application/x-www-form-urlencoded':
166
-                $data = $_POST['payload'];
167
-                break;
168
-
169
-            default:
170
-                throw new \Exception('Unsupported content type: "' . $_SERVER['CONTENT_TYPE'] . '"');
171
-        }
172
-        $this->setParsedData($data);
173
-
174
-        return $this;
175
-    }
176
-
177
-    /**
178
-     * Check X-Hub-Signature
179
-     *
180
-     * @throws BadSignatureException
181
-     * @return bool
182
-     */
183
-    private function _checkSignature(): bool
184
-    {
185
-        if (null !== $this->secret) {
186
-            if ($this->getWebHook()->getRequest()->server->get('HTTP_X_HUB_SIGNATURE')) {
187
-                /**
188
-                 * Split signature into algorithm and hash
189
-                 *
190
-                 * @link http://isometriks.com/verify-github-webhooks-with-php
191
-                 */
192
-                list(, $hash) = explode('=', $this->getWebHook()->getRequest()->server->get('HTTP_X_HUB_SIGNATURE'), 2);
193
-
194
-                return $this->secret == $hash;
195
-            }
196
-
197
-            throw new BadSignatureException('HTTP header "X-Hub-Signature" is missing.');
198
-        }
199
-
200
-        return true;
201
-    }
16
+	/** Protected properties */
17
+	protected $webHook;
18
+	protected $secret = null;
19
+	protected $rawData;
20
+	protected $parsedData;
21
+
22
+	/**
23
+	 * Constructor, pass a WebHook object
24
+	 *
25
+	 * @param WebHook $webHook
26
+	 */
27
+	public function __construct(WebHook $webHook)
28
+	{
29
+		$this->setWebHook($webHook);
30
+		$this->setRawData($webHook->getRequest()->getContent());
31
+	}
32
+
33
+	/**
34
+	 * Get webHook
35
+	 *
36
+	 * @return null|WebHook
37
+	 */
38
+	public function getWebHook()
39
+	{
40
+		return $this->webHook;
41
+	}
42
+
43
+	/**
44
+	 * Set webHook
45
+	 *
46
+	 * @param mixed $webHook
47
+	 *
48
+	 * @return Payload
49
+	 */
50
+	public function setWebHook($webHook): Payload
51
+	{
52
+		$this->webHook = $webHook;
53
+
54
+		return $this;
55
+	}
56
+
57
+	/**
58
+	 * Set secret, encode this secret with Hmac, SHA1 method
59
+	 *
60
+	 * @param string $secret
61
+	 *
62
+	 * @return Payload
63
+	 */
64
+	public function setSecret(string $secret): Payload
65
+	{
66
+		$this->secret = hash_hmac('sha1', $this->rawData, $secret);
67
+
68
+		return $this;
69
+	}
70
+
71
+	/**
72
+	 * Get secret
73
+	 *
74
+	 * @return null|string
75
+	 */
76
+	public function getSecret()
77
+	{
78
+		return $this->secret;
79
+	}
80
+
81
+	/**
82
+	 * Get rawData
83
+	 *
84
+	 * @return resource|string
85
+	 */
86
+	public function getRawData()
87
+	{
88
+		return $this->rawData;
89
+	}
90
+
91
+	/**
92
+	 * Set rawData
93
+	 *
94
+	 * @param resource|string $rawData
95
+	 *
96
+	 * @return Payload
97
+	 */
98
+	public function setRawData($rawData): Payload
99
+	{
100
+		$this->rawData = $rawData;
101
+
102
+		return $this;
103
+	}
104
+
105
+	/**
106
+	 * Get parsedData
107
+	 *
108
+	 * @return mixed
109
+	 */
110
+	public function getData()
111
+	{
112
+		return $this->parsedData;
113
+	}
114
+
115
+	/**
116
+	 * Set parsedData
117
+	 *
118
+	 * @param mixed $parsedData
119
+	 *
120
+	 * @return Payload
121
+	 */
122
+	protected function setParsedData($parsedData): Payload
123
+	{
124
+		$data = json_decode($parsedData);
125
+		if (JSON_ERROR_NONE === json_last_error()) {
126
+			$this->parsedData = $data;
127
+		}
128
+
129
+		return $this;
130
+	}
131
+
132
+	/**
133
+	 * Debugger
134
+	 *
135
+	 * @return array
136
+	 */
137
+	public function __debugInfo(): array
138
+	{
139
+		return [
140
+			'ramData'     => (array)$this->getRawData(),
141
+			'jsonEncoded' => json_decode($this->getRawData())
142
+		];
143
+	}
144
+
145
+	/**
146
+	 * Parse raw data
147
+	 *
148
+	 * @return Payload
149
+	 * @throws BadSignatureException
150
+	 * @throws \Exception
151
+	 */
152
+	public function parse(): Payload
153
+	{
154
+		/** Check signature from header */
155
+		if (!$this->_checkSignature()) {
156
+			throw new BadSignatureException('Hook secret does not match.');
157
+		}
158
+
159
+		/** Get data from different locations according to content-type */
160
+		switch ($_SERVER['CONTENT_TYPE']) {
161
+			case 'application/json':
162
+				$data = $this->getRawData();
163
+				break;
164
+
165
+			case 'application/x-www-form-urlencoded':
166
+				$data = $_POST['payload'];
167
+				break;
168
+
169
+			default:
170
+				throw new \Exception('Unsupported content type: "' . $_SERVER['CONTENT_TYPE'] . '"');
171
+		}
172
+		$this->setParsedData($data);
173
+
174
+		return $this;
175
+	}
176
+
177
+	/**
178
+	 * Check X-Hub-Signature
179
+	 *
180
+	 * @throws BadSignatureException
181
+	 * @return bool
182
+	 */
183
+	private function _checkSignature(): bool
184
+	{
185
+		if (null !== $this->secret) {
186
+			if ($this->getWebHook()->getRequest()->server->get('HTTP_X_HUB_SIGNATURE')) {
187
+				/**
188
+				 * Split signature into algorithm and hash
189
+				 *
190
+				 * @link http://isometriks.com/verify-github-webhooks-with-php
191
+				 */
192
+				list(, $hash) = explode('=', $this->getWebHook()->getRequest()->server->get('HTTP_X_HUB_SIGNATURE'), 2);
193
+
194
+				return $this->secret == $hash;
195
+			}
196
+
197
+			throw new BadSignatureException('HTTP header "X-Hub-Signature" is missing.');
198
+		}
199
+
200
+		return true;
201
+	}
202 202
 }
203 203
\ No newline at end of file
Please login to merge, or discard this patch.