Skip to content

Commit 041af92

Browse files
author
Pierre Grimaud
committed
Set new parameters as null instead of default values
1 parent 6aa74fb commit 041af92

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

lib/Github/Api/Notification.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class Notification extends AbstractApi
2323
* @param bool $includingRead
2424
* @param bool $participating
2525
* @param DateTime|null $since
26+
* @param DateTime|null $before
2627
*
2728
* @return array array of notifications
2829
*/

lib/Github/Api/Organization.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,22 @@ public function update($organization, array $params)
5858
*
5959
* @return array the repositories
6060
*/
61-
public function repositories($organization, $type = 'all', $page = 1, $sort = 'created', $direction = 'desc')
61+
public function repositories($organization, $type = 'all', $page = 1, $sort = null, $direction = null)
6262
{
63-
return $this->get('/orgs/'.rawurlencode($organization).'/repos', [
63+
$parameters = [
6464
'type' => $type,
6565
'page' => $page,
66-
'sort' => $sort,
67-
'direction' => $direction,
68-
]);
66+
];
67+
68+
if($sort !== null){
69+
$parameters['sort'] = $sort;
70+
}
71+
72+
if($direction !== null){
73+
$parameters['direction'] = $direction;
74+
}
75+
76+
return $this->get('/orgs/'.rawurlencode($organization).'/repos', $parameters);
6977
}
7078

7179
/**

test/Github/Tests/Api/OrganizationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function shouldGetOrganizationRepositories()
6262
$api = $this->getApiMock();
6363
$api->expects($this->once())
6464
->method('get')
65-
->with('/orgs/KnpLabs/repos', ['type' => 'all', 'page' => 1, 'sort' => 'created', 'direction' => 'desc'])
65+
->with('/orgs/KnpLabs/repos', ['type' => 'all', 'page' => 1])
6666
->will($this->returnValue($expectedArray));
6767

6868
$this->assertEquals($expectedArray, $api->repositories('KnpLabs'));

0 commit comments

Comments
 (0)