From 61eb86ae6ffe36ce9ce976d8dbc63914afcd7edc Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 17 Sep 2023 17:07:23 +0000 Subject: [PATCH] update stats --- Message/Http/ImpressionStat.php | 14 ++++++-------- Uri/HttpUri.php | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Message/Http/ImpressionStat.php b/Message/Http/ImpressionStat.php index 30e02637a..8f744d2c2 100644 --- a/Message/Http/ImpressionStat.php +++ b/Message/Http/ImpressionStat.php @@ -12,7 +12,7 @@ */ declare(strict_types=1); -namespace phpOMS\Message\Statistic; +namespace phpOMS\Message\Http; use phpOMS\Localization\ISO3166TwoEnum; use phpOMS\Localization\ISO639x1Enum; @@ -34,9 +34,7 @@ class ImpressionStat public string $country = ISO3166TwoEnum::_XXX; - public int $datetime = 0; - - public string $browser = ''; + public \DateTime $datetime; public string $host = ''; @@ -56,7 +54,7 @@ class ImpressionStat $this->host = $request->uri->host; $this->path = \substr($request->uri->path, 0, 255); $this->address = $request->header->getRequestIp(); - $this->datetime = $request->header->getRequestTime(); + $this->datetime = new \DateTime('@' . $request->header->getRequestTime()); $this->referer = \substr($request->header->getReferer(), 0, 255); $this->userAgent = $request->header->getBrowserName(); } @@ -65,8 +63,8 @@ class ImpressionStat { return [ 'address' => $this->address, - 'date' => \date('d-m-y', $this->datetime), - 'hour' => \date('H', $this->datetime), + 'date' => $this->datetime->format('Y-m-d'), + 'hour' => $this->datetime->format('H'), 'host' => $this->host, 'path' => $this->path, 'uri' => $this->uri, @@ -74,7 +72,7 @@ class ImpressionStat 'language' => $this->language, 'country' => $this->country, 'referer' => $this->referer, - 'datetime' => $this->datetime, + 'datetime' => $this->datetime->getTimestamp(), ]; } } diff --git a/Uri/HttpUri.php b/Uri/HttpUri.php index 52b737062..7b8b9bf49 100755 --- a/Uri/HttpUri.php +++ b/Uri/HttpUri.php @@ -60,7 +60,7 @@ final class HttpUri implements UriInterface * @var string * @since 1.0.0 */ - private string $uri; + public string $uri; /** * Uri scheme.