Skip to content

Commit 8095921

Browse files
committed
Don't urlencode integer values
1 parent 5bb8142 commit 8095921

File tree

21 files changed

+114
-63
lines changed

21 files changed

+114
-63
lines changed

lib/Github/Api/Apps.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function createInstallationToken($installationId, $userId = null)
3636

3737
$this->configurePreviewHeader();
3838

39-
return $this->post('/app/installations/'.rawurlencode($installationId).'/access_tokens', $parameters);
39+
return $this->post('/app/installations/'.$installationId.'/access_tokens', $parameters);
4040
}
4141

4242
/**
@@ -66,7 +66,7 @@ public function getInstallation($installationId)
6666
{
6767
$this->configurePreviewHeader();
6868

69-
return $this->get('/app/installations/'.rawurldecode($installationId));
69+
return $this->get('/app/installations/'.$installationId);
7070
}
7171

7272
/**
@@ -129,7 +129,7 @@ public function removeInstallation($installationId)
129129
{
130130
$this->configurePreviewHeader();
131131

132-
$this->delete('/app/installations/'.rawurldecode($installationId));
132+
$this->delete('/app/installations/'.$installationId);
133133
}
134134

135135
/**
@@ -167,7 +167,7 @@ public function addRepository($installationId, $repositoryId)
167167
{
168168
$this->configurePreviewHeader();
169169

170-
return $this->put('/installations/'.rawurlencode($installationId).'/repositories/'.rawurlencode($repositoryId));
170+
return $this->put('/installations/'.$installationId.'/repositories/'.$repositoryId);
171171
}
172172

173173
/**
@@ -184,6 +184,6 @@ public function removeRepository($installationId, $repositoryId)
184184
{
185185
$this->configurePreviewHeader();
186186

187-
return $this->delete('/installations/'.rawurlencode($installationId).'/repositories/'.rawurlencode($repositoryId));
187+
return $this->delete('/installations/'.$installationId.'/repositories/'.$repositoryId);
188188
}
189189
}

lib/Github/Api/CurrentUser/Notifications.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function markAsReadInRepository($username, $repository, array $params = [
8383
*/
8484
public function markAsRead($id, array $params)
8585
{
86-
return $this->patch('/notifications/threads/'.rawurlencode($id), $params);
86+
return $this->patch('/notifications/threads/'.$id, $params);
8787
}
8888

8989
/**
@@ -97,7 +97,7 @@ public function markAsRead($id, array $params)
9797
*/
9898
public function show($id)
9999
{
100-
return $this->get('/notifications/threads/'.rawurlencode($id));
100+
return $this->get('/notifications/threads/'.$id);
101101
}
102102

103103
/**
@@ -111,7 +111,7 @@ public function show($id)
111111
*/
112112
public function showSubscription($id)
113113
{
114-
return $this->get('/notifications/threads/'.rawurlencode($id).'/subscription');
114+
return $this->get('/notifications/threads/'.$id.'/subscription');
115115
}
116116

117117
/**
@@ -126,7 +126,7 @@ public function showSubscription($id)
126126
*/
127127
public function createSubscription($id, array $params)
128128
{
129-
return $this->put('/notifications/threads/'.rawurlencode($id).'/subscription', $params);
129+
return $this->put('/notifications/threads/'.$id.'/subscription', $params);
130130
}
131131

132132
/**
@@ -140,6 +140,6 @@ public function createSubscription($id, array $params)
140140
*/
141141
public function removeSubscription($id)
142142
{
143-
return $this->delete('/notifications/threads/'.rawurlencode($id).'/subscription');
143+
return $this->delete('/notifications/threads/'.$id.'/subscription');
144144
}
145145
}

lib/Github/Api/CurrentUser/PublicKeys.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function all()
3535
*/
3636
public function show($id)
3737
{
38-
return $this->get('/user/keys/'.rawurlencode($id));
38+
return $this->get('/user/keys/'.$id);
3939
}
4040

4141
/**
@@ -69,6 +69,6 @@ public function create(array $params)
6969
*/
7070
public function remove($id)
7171
{
72-
return $this->delete('/user/keys/'.rawurlencode($id));
72+
return $this->delete('/user/keys/'.$id);
7373
}
7474
}

lib/Github/Api/Deployment.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function all($username, $repository, array $params = [])
3838
*/
3939
public function show($username, $repository, $id)
4040
{
41-
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id));
41+
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.$id);
4242
}
4343

4444
/**
@@ -88,7 +88,7 @@ public function updateStatus($username, $repository, $id, array $params)
8888
throw new MissingArgumentException(['state']);
8989
}
9090

91-
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id).'/statuses', $params);
91+
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.$id.'/statuses', $params);
9292
}
9393

9494
/**
@@ -102,6 +102,6 @@ public function updateStatus($username, $repository, $id, array $params)
102102
*/
103103
public function getStatuses($username, $repository, $id)
104104
{
105-
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id).'/statuses');
105+
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.$id.'/statuses');
106106
}
107107
}

lib/Github/Api/Gist/Comments.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function all($gist)
5656
*/
5757
public function show($gist, $comment)
5858
{
59-
return $this->get('/gists/'.rawurlencode($gist).'/comments/'.rawurlencode($comment));
59+
return $this->get('/gists/'.rawurlencode($gist).'/comments/'.$comment);
6060
}
6161

6262
/**
@@ -83,7 +83,7 @@ public function create($gist, $body)
8383
*/
8484
public function update($gist, $comment_id, $body)
8585
{
86-
return $this->patch('/gists/'.rawurlencode($gist).'/comments/'.rawurlencode($comment_id), ['body' => $body]);
86+
return $this->patch('/gists/'.rawurlencode($gist).'/comments/'.$comment_id, ['body' => $body]);
8787
}
8888

8989
/**
@@ -96,6 +96,6 @@ public function update($gist, $comment_id, $body)
9696
*/
9797
public function remove($gist, $comment)
9898
{
99-
return $this->delete('/gists/'.rawurlencode($gist).'/comments/'.rawurlencode($comment));
99+
return $this->delete('/gists/'.rawurlencode($gist).'/comments/'.$comment);
100100
}
101101
}

lib/Github/Api/Gists.php

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ public function configure($bodyType = null)
3737
return $this;
3838
}
3939

40+
/**
41+
* @param string|null $type
42+
*
43+
* @return array|string
44+
*/
4045
public function all($type = null)
4146
{
4247
if (!in_array($type, ['public', 'starred'])) {
@@ -46,6 +51,11 @@ public function all($type = null)
4651
return $this->get('/gists/'.rawurlencode($type));
4752
}
4853

54+
/**
55+
* @param string $number
56+
*
57+
* @return array
58+
*/
4959
public function show($number)
5060
{
5161
return $this->get('/gists/'.rawurlencode($number));
@@ -54,7 +64,7 @@ public function show($number)
5464
/**
5565
* Get a specific revision of a gist.
5666
*
57-
* @param int $number
67+
* @param string $number
5868
* @param string $sha
5969
*
6070
* @link https://developer.github.com/v3/gists/#get-a-specific-revision-of-a-gist
@@ -77,41 +87,82 @@ public function create(array $params)
7787
return $this->post('/gists', $params);
7888
}
7989

90+
/**
91+
* @param string $id
92+
* @param array $params
93+
*
94+
* @return array
95+
*/
8096
public function update($id, array $params)
8197
{
8298
return $this->patch('/gists/'.rawurlencode($id), $params);
8399
}
84100

101+
/**
102+
* @param string $id
103+
*
104+
* @return array
105+
*/
85106
public function commits($id)
86107
{
87108
return $this->get('/gists/'.rawurlencode($id).'/commits');
88109
}
89110

111+
/**
112+
* @param string $id
113+
*
114+
* @return array
115+
*/
90116
public function fork($id)
91117
{
92118
return $this->post('/gists/'.rawurlencode($id).'/fork');
93119
}
94120

121+
/**
122+
* @param string $id
123+
*
124+
* @return array
125+
*/
95126
public function forks($id)
96127
{
97128
return $this->get('/gists/'.rawurlencode($id).'/forks');
98129
}
99130

131+
/**
132+
* @param string $id
133+
*
134+
* @return array
135+
*/
100136
public function remove($id)
101137
{
102138
return $this->delete('/gists/'.rawurlencode($id));
103139
}
104140

141+
/**
142+
* @param string $id
143+
*
144+
* @return array
145+
*/
105146
public function check($id)
106147
{
107148
return $this->get('/gists/'.rawurlencode($id).'/star');
108149
}
109150

151+
/**
152+
* @param string $id
153+
*
154+
* @return array
155+
*/
110156
public function star($id)
111157
{
112158
return $this->put('/gists/'.rawurlencode($id).'/star');
113159
}
114160

161+
/**
162+
* @param string $id
163+
*
164+
* @return array
165+
*/
115166
public function unstar($id)
116167
{
117168
return $this->delete('/gists/'.rawurlencode($id).'/star');

lib/Github/Api/Issue.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function org($organization, $state, array $params = [])
113113
*/
114114
public function show($username, $repository, $id)
115115
{
116-
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($id));
116+
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$id);
117117
}
118118

119119
/**
@@ -154,7 +154,7 @@ public function create($username, $repository, array $params)
154154
*/
155155
public function update($username, $repository, $id, array $params)
156156
{
157-
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($id), $params);
157+
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$id, $params);
158158
}
159159

160160
/**
@@ -170,7 +170,7 @@ public function update($username, $repository, $id, array $params)
170170
*/
171171
public function lock($username, $repository, $id)
172172
{
173-
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($id).'/lock');
173+
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$id.'/lock');
174174
}
175175

176176
/**
@@ -186,7 +186,7 @@ public function lock($username, $repository, $id)
186186
*/
187187
public function unlock($username, $repository, $id)
188188
{
189-
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($id).'/lock');
189+
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$id.'/lock');
190190
}
191191

192192
/**

lib/Github/Api/Issue/Comments.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function all($username, $repository, $issue, $page = 1)
5959
];
6060
}
6161

62-
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/comments', $parameters);
62+
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$issue.'/comments', $parameters);
6363
}
6464

6565
/**
@@ -75,7 +75,7 @@ public function all($username, $repository, $issue, $page = 1)
7575
*/
7676
public function show($username, $repository, $comment)
7777
{
78-
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.rawurlencode($comment));
78+
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.$comment);
7979
}
8080

8181
/**
@@ -98,7 +98,7 @@ public function create($username, $repository, $issue, array $params)
9898
throw new MissingArgumentException('body');
9999
}
100100

101-
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/comments', $params);
101+
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$issue.'/comments', $params);
102102
}
103103

104104
/**
@@ -121,7 +121,7 @@ public function update($username, $repository, $comment, array $params)
121121
throw new MissingArgumentException('body');
122122
}
123123

124-
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.rawurlencode($comment), $params);
124+
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.$comment, $params);
125125
}
126126

127127
/**
@@ -137,6 +137,6 @@ public function update($username, $repository, $comment, array $params)
137137
*/
138138
public function remove($username, $repository, $comment)
139139
{
140-
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.rawurlencode($comment));
140+
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.$comment);
141141
}
142142
}

lib/Github/Api/Issue/Events.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Events extends AbstractApi
2626
public function all($username, $repository, $issue = null, $page = 1)
2727
{
2828
if (null !== $issue) {
29-
$path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/events';
29+
$path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$issue.'/events';
3030
} else {
3131
$path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/events';
3232
}

0 commit comments

Comments
 (0)