Skip to content

Commit 49488d8

Browse files
committed
Made implementation more consistent with DateTime, altered comments and tests accordingly
1 parent be24330 commit 49488d8

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

lib/Github/Api/Notification.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,36 @@ class Notification extends AbstractApi
1616
{
1717
/**
1818
* Get a listing of notifications
19+
*
1920
* @link https://developer.github.com/v3/activity/notifications/
2021
*
21-
* @param bool $includingRead
22-
* @param bool $participating
23-
* @param null $since
22+
* @param bool $includingRead
23+
* @param bool $participating
24+
* @param DateTime|null $since
2425
*
2526
* @return array array of notifications
2627
*/
27-
public function all($includingRead = false, $participating = false, $since = null)
28+
public function all($includingRead = false, $participating = false, DateTime $since = null)
2829
{
2930
$parameters = array(
3031
'all' => $includingRead,
3132
'participating' => $participating
3233
);
3334

3435
if($since !== null) {
35-
$parameters['since'] = $since;
36+
$parameters['since'] = $since->format(DateTime::ISO8601);
3637
}
3738

3839
return $this->get('notifications', $parameters);
3940
}
4041

4142
/**
4243
* Marks all notifications as read from the current date
43-
* Optionally give DateTimeInterface to mark as read before that date
44+
* Optionally give DateTime to mark as read before that date
4445
*
4546
* @link https://developer.github.com/v3/activity/notifications/#mark-as-read
4647
*
47-
* @param \DateTime $since
48+
* @param DateTime|null $since
4849
*/
4950
public function markRead(DateTime $since = null)
5051
{

test/Github/Tests/Api/NotificationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ public function shouldGetNotifications()
2929
*/
3030
public function shouldGetNotificationsSince()
3131
{
32-
$since = '2015-01-01 00:00:00';
32+
$since = new DateTime('now');
3333

3434
$parameters = array(
3535
'all' => false,
3636
'participating' => false,
37-
'since' => $since,
37+
'since' => $since->format(DateTime::ISO8601),
3838
);
3939

4040
$api = $this->getApiMock();

0 commit comments

Comments
 (0)