add session entity

This commit is contained in:
Yisroel Baum 2026-04-24 13:21:20 +03:00
parent 79d9ece2ae
commit 6fbdc82589
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

40
app/Auth/Session.php Normal file
View file

@ -0,0 +1,40 @@
<?php
namespace App\Auth;
use DateTimeImmutable;
class Session
{
public function __construct(
private string $token,
private int $userId,
private DateTimeImmutable $createdAt,
private DateTimeImmutable $expiresAt,
) {}
public function getToken(): string
{
return $this->token;
}
public function getUserId(): int
{
return $this->userId;
}
public function getCreatedAt(): DateTimeImmutable
{
return $this->createdAt;
}
public function getExpiresAt(): DateTimeImmutable
{
return $this->expiresAt;
}
public function isExpired(DateTimeImmutable $now): bool
{
return $now >= $this->expiresAt;
}
}