protected static checkDateConditions ( string | null $start = null, string | null $end = null ) : boolean | ||
$start | string | null | A SAML2 timestamp marking the start of the period to check. Defaults to null, in which case there's no limitations in the past. |
$end | string | null | A SAML2 timestamp marking the end of the period to check. Defaults to null, in which case there's no limitations in the future. |
리턴 | boolean | True if the current time belongs to the period specified by $start and $end. False otherwise. |
protected static function checkDateConditions($start = null, $end = null)
{
$currentTime = time();
if (!empty($start)) {
$startTime = \SAML2\Utils::xsDateTimeToTimestamp($start);
// allow for a 10 minute difference in time
if ($startTime < 0 || $startTime - 600 > $currentTime) {
return false;
}
}
if (!empty($end)) {
$endTime = \SAML2\Utils::xsDateTimeToTimestamp($end);
if ($endTime < 0 || $endTime <= $currentTime) {
return false;
}
}
return true;
}