add header timestamp

This commit is contained in:
Dennis Eichhorn 2023-09-19 03:52:20 +00:00
parent 0844846f51
commit 11d2ed8f2e
3 changed files with 11 additions and 1 deletions

View File

@ -159,6 +159,11 @@ final class CliHeader extends HeaderAbstract
}
}
public function getRequestTime() : int
{
return $this->timestamp;
}
/**
* Generate predefined header.
*

View File

@ -58,6 +58,8 @@ abstract class HeaderAbstract
*/
public int $status = 0;
public int $timestamp = 0;
/**
* Constructor.
*
@ -66,6 +68,7 @@ abstract class HeaderAbstract
public function __construct()
{
$this->l11n = new Localization();
$this->timestamp = \time();
}
/**
@ -147,6 +150,8 @@ abstract class HeaderAbstract
*/
abstract public function has(string $key) : bool;
abstract public function getRequestTime() : int;
/**
* Push all headers.
*

View File

@ -152,7 +152,7 @@ final class HttpHeader extends HeaderAbstract
public function getRequestTime() : int
{
return (int) ($_SERVER['REQUEST_TIME'] ?? \time());
return (int) ($_SERVER['REQUEST_TIME'] ?? $this->timestamp);
}
public function getRequestIp() : string