Skip to content

Commit

Permalink
Default to current datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
DivineOmega committed Dec 7, 2018
1 parent 2965dfa commit 39d6fa1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion example.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

require_once 'vendor/autoload.php';

$status = (new Client())->status(Carbon::now());
$status = (new Client())->status();

switch ($status) {
case GitHubStatus::GOOD:
Expand Down
6 changes: 5 additions & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ class Client
'minor' => GitHubStatus::MINOR,
];

public function status(Carbon $datetime)
public function status(Carbon $datetime = null)
{
if ($datetime === null) {
$datetime = Carbon::now();
}

$dom = $this->getDomDocument($datetime);

$timeElements = $dom->querySelectorAll('time');
Expand Down

0 comments on commit 39d6fa1

Please sign in to comment.