Skip to content

Commit c3929f4

Browse files
authored
Merge pull request KnpLabs#424 from Nyholm/urls
Make sure we always use valid urls
2 parents 1f50d2d + 341f457 commit c3929f4

File tree

100 files changed

+558
-558
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+558
-558
lines changed

lib/Github/Api/Authorizations.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Authorizations extends AbstractApi
1717
*/
1818
public function all()
1919
{
20-
return $this->get('authorizations');
20+
return $this->get('/authorizations');
2121
}
2222

2323
/**
@@ -29,7 +29,7 @@ public function all()
2929
*/
3030
public function show($clientId)
3131
{
32-
return $this->get('authorizations/'.rawurlencode($clientId));
32+
return $this->get('/authorizations/'.rawurlencode($clientId));
3333
}
3434

3535
/**
@@ -44,7 +44,7 @@ public function create(array $params, $OTPCode = null)
4444
{
4545
$headers = null === $OTPCode ? array() : array('X-GitHub-OTP' => $OTPCode);
4646

47-
return $this->post('authorizations', $params, $headers);
47+
return $this->post('/authorizations', $params, $headers);
4848
}
4949

5050
/**
@@ -57,7 +57,7 @@ public function create(array $params, $OTPCode = null)
5757
*/
5858
public function update($clientId, array $params)
5959
{
60-
return $this->patch('authorizations/'.rawurlencode($clientId), $params);
60+
return $this->patch('/authorizations/'.rawurlencode($clientId), $params);
6161
}
6262

6363
/**
@@ -69,7 +69,7 @@ public function update($clientId, array $params)
6969
*/
7070
public function remove($clientId)
7171
{
72-
return $this->delete('authorizations/'.rawurlencode($clientId));
72+
return $this->delete('/authorizations/'.rawurlencode($clientId));
7373
}
7474

7575
/**
@@ -82,7 +82,7 @@ public function remove($clientId)
8282
*/
8383
public function check($clientId, $token)
8484
{
85-
return $this->get('applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token));
85+
return $this->get('/applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token));
8686
}
8787

8888
/**
@@ -95,7 +95,7 @@ public function check($clientId, $token)
9595
*/
9696
public function reset($clientId, $token)
9797
{
98-
return $this->post('applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token));
98+
return $this->post('/applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token));
9999
}
100100

101101
/**
@@ -106,7 +106,7 @@ public function reset($clientId, $token)
106106
*/
107107
public function revoke($clientId, $token)
108108
{
109-
$this->delete('applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token));
109+
$this->delete('/applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token));
110110
}
111111

112112
/**
@@ -116,6 +116,6 @@ public function revoke($clientId, $token)
116116
*/
117117
public function revokeAll($clientId)
118118
{
119-
$this->delete('applications/'.rawurlencode($clientId).'/tokens');
119+
$this->delete('/applications/'.rawurlencode($clientId).'/tokens');
120120
}
121121
}

lib/Github/Api/CurrentUser.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ class CurrentUser extends AbstractApi
1919
{
2020
public function show()
2121
{
22-
return $this->get('user');
22+
return $this->get('/user');
2323
}
2424

2525
public function update(array $params)
2626
{
27-
return $this->patch('user', $params);
27+
return $this->patch('/user', $params);
2828
}
2929

3030
/**
@@ -45,7 +45,7 @@ public function follow()
4545

4646
public function followers($page = 1)
4747
{
48-
return $this->get('user/followers', array(
48+
return $this->get('/user/followers', array(
4949
'page' => $page
5050
));
5151
}
@@ -60,7 +60,7 @@ public function followers($page = 1)
6060
*/
6161
public function issues(array $params = array(), $includeOrgIssues = true)
6262
{
63-
return $this->get($includeOrgIssues ? 'issues' : 'user/issues', array_merge(array('page' => 1), $params));
63+
return $this->get($includeOrgIssues ? '/issues' : '/user/issues', array_merge(array('page' => 1), $params));
6464
}
6565

6666
/**
@@ -94,7 +94,7 @@ public function memberships()
9494
*/
9595
public function organizations()
9696
{
97-
return $this->get('user/orgs');
97+
return $this->get('/user/orgs');
9898
}
9999

100100
/**
@@ -104,7 +104,7 @@ public function organizations()
104104
*/
105105
public function teams()
106106
{
107-
return $this->get('user/teams');
107+
return $this->get('/user/teams');
108108
}
109109

110110
/**
@@ -118,7 +118,7 @@ public function teams()
118118
*/
119119
public function repositories($type = 'owner', $sort = 'full_name', $direction = 'asc')
120120
{
121-
return $this->get('user/repos', array(
121+
return $this->get('/user/repos', array(
122122
'type' => $type,
123123
'sort' => $sort,
124124
'direction' => $direction
@@ -138,7 +138,7 @@ public function watchers()
138138
*/
139139
public function watched($page = 1)
140140
{
141-
return $this->get('user/watched', array(
141+
return $this->get('/user/watched', array(
142142
'page' => $page
143143
));
144144
}
@@ -156,16 +156,16 @@ public function starring()
156156
*/
157157
public function starred($page = 1)
158158
{
159-
return $this->get('user/starred', array(
159+
return $this->get('/user/starred', array(
160160
'page' => $page
161161
));
162162
}
163-
163+
164164
/**
165165
* @link https://developer.github.com/v3/activity/watching/#list-repositories-being-watched
166166
*/
167167
public function subscriptions()
168168
{
169-
return $this->get('user/subscriptions');
169+
return $this->get('/user/subscriptions');
170170
}
171171
}

lib/Github/Api/CurrentUser/DeployKeys.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class DeployKeys extends AbstractApi
2020
*/
2121
public function all()
2222
{
23-
return $this->get('user/keys');
23+
return $this->get('/user/keys');
2424
}
2525

2626
/**
@@ -34,7 +34,7 @@ public function all()
3434
*/
3535
public function show($id)
3636
{
37-
return $this->get('user/keys/'.rawurlencode($id));
37+
return $this->get('/user/keys/'.rawurlencode($id));
3838
}
3939

4040
/**
@@ -54,7 +54,7 @@ public function create(array $params)
5454
throw new MissingArgumentException(array('title', 'key'));
5555
}
5656

57-
return $this->post('user/keys', $params);
57+
return $this->post('/user/keys', $params);
5858
}
5959

6060
/**
@@ -75,7 +75,7 @@ public function update($id, array $params)
7575
throw new MissingArgumentException(array('title', 'key'));
7676
}
7777

78-
return $this->patch('user/keys/'.rawurlencode($id), $params);
78+
return $this->patch('/user/keys/'.rawurlencode($id), $params);
7979
}
8080

8181
/**
@@ -89,6 +89,6 @@ public function update($id, array $params)
8989
*/
9090
public function remove($id)
9191
{
92-
return $this->delete('user/keys/'.rawurlencode($id));
92+
return $this->delete('/user/keys/'.rawurlencode($id));
9393
}
9494
}

lib/Github/Api/CurrentUser/Emails.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Emails extends AbstractApi
2020
*/
2121
public function all()
2222
{
23-
return $this->get('user/emails');
23+
return $this->get('/user/emails');
2424
}
2525

2626
/**
@@ -42,7 +42,7 @@ public function add($emails)
4242
throw new InvalidArgumentException();
4343
}
4444

45-
return $this->post('user/emails', $emails);
45+
return $this->post('/user/emails', $emails);
4646
}
4747

4848
/**
@@ -64,6 +64,6 @@ public function remove($emails)
6464
throw new InvalidArgumentException();
6565
}
6666

67-
return $this->delete('user/emails', $emails);
67+
return $this->delete('/user/emails', $emails);
6868
}
6969
}

lib/Github/Api/CurrentUser/Followers.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Followers extends AbstractApi
2121
*/
2222
public function all($page = 1)
2323
{
24-
return $this->get('user/following', array(
24+
return $this->get('/user/following', array(
2525
'page' => $page
2626
));
2727
}
@@ -37,7 +37,7 @@ public function all($page = 1)
3737
*/
3838
public function check($username)
3939
{
40-
return $this->get('user/following/'.rawurlencode($username));
40+
return $this->get('/user/following/'.rawurlencode($username));
4141
}
4242

4343
/**
@@ -51,7 +51,7 @@ public function check($username)
5151
*/
5252
public function follow($username)
5353
{
54-
return $this->put('user/following/'.rawurlencode($username));
54+
return $this->put('/user/following/'.rawurlencode($username));
5555
}
5656

5757
/**
@@ -65,6 +65,6 @@ public function follow($username)
6565
*/
6666
public function unfollow($username)
6767
{
68-
return $this->delete('user/following/'.rawurlencode($username));
68+
return $this->delete('/user/following/'.rawurlencode($username));
6969
}
7070
}

lib/Github/Api/CurrentUser/Memberships.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Memberships extends AbstractApi
1515
*/
1616
public function all()
1717
{
18-
return $this->get('user/memberships/orgs');
18+
return $this->get('/user/memberships/orgs');
1919
}
2020

2121
/**
@@ -29,7 +29,7 @@ public function all()
2929
*/
3030
public function organization($organization)
3131
{
32-
return $this->get('user/memberships/orgs/'.rawurlencode($organization));
32+
return $this->get('/user/memberships/orgs/'.rawurlencode($organization));
3333
}
3434

3535
/**
@@ -43,6 +43,6 @@ public function organization($organization)
4343
*/
4444
public function edit($organization)
4545
{
46-
return $this->patch('user/memberships/orgs/'.rawurlencode($organization), array('state' => 'active'));
46+
return $this->patch('/user/memberships/orgs/'.rawurlencode($organization), array('state' => 'active'));
4747
}
4848
}

lib/Github/Api/CurrentUser/Notifications.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Notifications extends AbstractApi
2121
*/
2222
public function all(array $params = array())
2323
{
24-
return $this->get('notifications', $params);
24+
return $this->get('/notifications', $params);
2525
}
2626

2727
/**
@@ -37,7 +37,7 @@ public function all(array $params = array())
3737
*/
3838
public function allInRepository($username, $repository, array $params = array())
3939
{
40-
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params);
40+
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params);
4141
}
4242

4343
/**
@@ -51,7 +51,7 @@ public function allInRepository($username, $repository, array $params = array())
5151
*/
5252
public function markAsReadAll(array $params = array())
5353
{
54-
return $this->put('notifications', $params);
54+
return $this->put('/notifications', $params);
5555
}
5656

5757
/**
@@ -67,7 +67,7 @@ public function markAsReadAll(array $params = array())
6767
*/
6868
public function markAsReadInRepository($username, $repository, array $params = array())
6969
{
70-
return $this->put('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params);
70+
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params);
7171
}
7272

7373
/**
@@ -82,7 +82,7 @@ public function markAsReadInRepository($username, $repository, array $params = a
8282
*/
8383
public function markAsRead($id, array $params)
8484
{
85-
return $this->patch('notifications/threads/'.rawurlencode($id), $params);
85+
return $this->patch('/notifications/threads/'.rawurlencode($id), $params);
8686
}
8787

8888
/**
@@ -96,7 +96,7 @@ public function markAsRead($id, array $params)
9696
*/
9797
public function show($id)
9898
{
99-
return $this->get('notifications/threads/'.rawurlencode($id));
99+
return $this->get('/notifications/threads/'.rawurlencode($id));
100100
}
101101

102102
/**
@@ -110,7 +110,7 @@ public function show($id)
110110
*/
111111
public function showSubscription($id)
112112
{
113-
return $this->get('notifications/threads/'.rawurlencode($id).'/subscription');
113+
return $this->get('/notifications/threads/'.rawurlencode($id).'/subscription');
114114
}
115115

116116
/**
@@ -125,7 +125,7 @@ public function showSubscription($id)
125125
*/
126126
public function createSubscription($id, array $params)
127127
{
128-
return $this->put('notifications/threads/'.rawurlencode($id).'/subscription', $params);
128+
return $this->put('/notifications/threads/'.rawurlencode($id).'/subscription', $params);
129129
}
130130

131131
/**
@@ -139,6 +139,6 @@ public function createSubscription($id, array $params)
139139
*/
140140
public function removeSubscription($id)
141141
{
142-
return $this->delete('notifications/threads/'.rawurlencode($id).'/subscription');
142+
return $this->delete('/notifications/threads/'.rawurlencode($id).'/subscription');
143143
}
144144
}

0 commit comments

Comments
 (0)