From 71ede4cca8c45343d473a7da243fef726cdae6e9 Mon Sep 17 00:00:00 2001 From: Christopher Hertel Date: Thu, 30 Oct 2025 22:53:04 +0100 Subject: [PATCH] fix(server): consistent arg name in session store impl --- src/Server/Session/FileSessionStore.php | 12 ++++++------ src/Server/Session/InMemorySessionStore.php | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Server/Session/FileSessionStore.php b/src/Server/Session/FileSessionStore.php index 217d1eb4..0a7b7cd4 100644 --- a/src/Server/Session/FileSessionStore.php +++ b/src/Server/Session/FileSessionStore.php @@ -50,9 +50,9 @@ public function exists(Uuid $id): bool return ($this->clock->now()->getTimestamp() - $mtime) <= $this->ttl; } - public function read(Uuid $sessionId): string|false + public function read(Uuid $id): string|false { - $path = $this->pathFor($sessionId); + $path = $this->pathFor($id); if (!is_file($path)) { return false; @@ -73,9 +73,9 @@ public function read(Uuid $sessionId): string|false return $data; } - public function write(Uuid $sessionId, string $data): bool + public function write(Uuid $id, string $data): bool { - $path = $this->pathFor($sessionId); + $path = $this->pathFor($id); $tmp = $path.'.tmp'; if (false === @file_put_contents($tmp, $data, \LOCK_EX)) { @@ -98,9 +98,9 @@ public function write(Uuid $sessionId, string $data): bool return true; } - public function destroy(Uuid $sessionId): bool + public function destroy(Uuid $id): bool { - $path = $this->pathFor($sessionId); + $path = $this->pathFor($id); if (is_file($path)) { @unlink($path); diff --git a/src/Server/Session/InMemorySessionStore.php b/src/Server/Session/InMemorySessionStore.php index 4051ba76..9f8077c6 100644 --- a/src/Server/Session/InMemorySessionStore.php +++ b/src/Server/Session/InMemorySessionStore.php @@ -35,9 +35,9 @@ public function exists(Uuid $id): bool return isset($this->store[$id->toRfc4122()]); } - public function read(Uuid $sessionId): string|false + public function read(Uuid $id): string|false { - $session = $this->store[$sessionId->toRfc4122()] ?? ''; + $session = $this->store[$id->toRfc4122()] ?? ''; if ('' === $session) { return false; } @@ -45,7 +45,7 @@ public function read(Uuid $sessionId): string|false $currentTimestamp = $this->clock->now()->getTimestamp(); if ($currentTimestamp - $session['timestamp'] > $this->ttl) { - unset($this->store[$sessionId->toRfc4122()]); + unset($this->store[$id->toRfc4122()]); return false; } @@ -53,9 +53,9 @@ public function read(Uuid $sessionId): string|false return $session['data']; } - public function write(Uuid $sessionId, string $data): bool + public function write(Uuid $id, string $data): bool { - $this->store[$sessionId->toRfc4122()] = [ + $this->store[$id->toRfc4122()] = [ 'data' => $data, 'timestamp' => $this->clock->now()->getTimestamp(), ]; @@ -63,10 +63,10 @@ public function write(Uuid $sessionId, string $data): bool return true; } - public function destroy(Uuid $sessionId): bool + public function destroy(Uuid $id): bool { - if (isset($this->store[$sessionId->toRfc4122()])) { - unset($this->store[$sessionId->toRfc4122()]); + if (isset($this->store[$id->toRfc4122()])) { + unset($this->store[$id->toRfc4122()]); } return true;