SchulIT /
idp
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Security\Session; |
||
| 4 | |||
| 5 | use DateTimeImmutable; |
||
| 6 | |||
| 7 | class ActiveSession { |
||
| 8 | |||
| 9 | public readonly array $browserInfo; |
||
| 10 | |||
| 11 | public function __construct(public readonly int $userId, public readonly mixed $sessionId, public readonly ?string $userAgent, |
||
| 12 | public readonly DateTimeImmutable $startedAt, public readonly ?string $ipAddress, public readonly bool $isCurrentSession) { |
||
| 13 | if($this->userAgent !== null) { |
||
| 14 | $info = @get_browser($this->userAgent, true); |
||
| 15 | |||
| 16 | if($info === false) { |
||
| 17 | $this->browserInfo = [ ]; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 18 | } else { |
||
| 19 | $this->browserInfo = $info; |
||
| 20 | } |
||
| 21 | } else { |
||
| 22 | $this->browserInfo = [ ]; |
||
| 23 | } |
||
| 24 | } |
||
| 25 | } |