* Implemented ITimeProviders

This commit is contained in:
RobThree
2017-02-17 14:53:55 +01:00
parent 178c60d947
commit 9735116635
16 changed files with 232 additions and 27 deletions
@@ -0,0 +1,15 @@
<?php
namespace RobThree\Auth\Providers\Time;
class ConvertUnixTimeDotComTimeProvider implements ITimeProvider
{
public function getTime() {
$json = @json_decode(
@file_get_contents('http://www.convert-unix-time.com/api?timestamp=now')
);
if ($json === null || !is_int($json->timestamp))
throw new \TimeException('Unable to retrieve time from convert-unix-time.com');
return $json->timestamp;
}
}