Skip to content

Commit 67cc641

Browse files
authored
fix(server): consistent arg name in session store impl (#127)
1 parent 757b959 commit 67cc641

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/Server/Session/FileSessionStore.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ public function exists(Uuid $id): bool
5050
return ($this->clock->now()->getTimestamp() - $mtime) <= $this->ttl;
5151
}
5252

53-
public function read(Uuid $sessionId): string|false
53+
public function read(Uuid $id): string|false
5454
{
55-
$path = $this->pathFor($sessionId);
55+
$path = $this->pathFor($id);
5656

5757
if (!is_file($path)) {
5858
return false;
@@ -73,9 +73,9 @@ public function read(Uuid $sessionId): string|false
7373
return $data;
7474
}
7575

76-
public function write(Uuid $sessionId, string $data): bool
76+
public function write(Uuid $id, string $data): bool
7777
{
78-
$path = $this->pathFor($sessionId);
78+
$path = $this->pathFor($id);
7979

8080
$tmp = $path.'.tmp';
8181
if (false === @file_put_contents($tmp, $data, \LOCK_EX)) {
@@ -98,9 +98,9 @@ public function write(Uuid $sessionId, string $data): bool
9898
return true;
9999
}
100100

101-
public function destroy(Uuid $sessionId): bool
101+
public function destroy(Uuid $id): bool
102102
{
103-
$path = $this->pathFor($sessionId);
103+
$path = $this->pathFor($id);
104104

105105
if (is_file($path)) {
106106
@unlink($path);

src/Server/Session/InMemorySessionStore.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,38 +35,38 @@ public function exists(Uuid $id): bool
3535
return isset($this->store[$id->toRfc4122()]);
3636
}
3737

38-
public function read(Uuid $sessionId): string|false
38+
public function read(Uuid $id): string|false
3939
{
40-
$session = $this->store[$sessionId->toRfc4122()] ?? '';
40+
$session = $this->store[$id->toRfc4122()] ?? '';
4141
if ('' === $session) {
4242
return false;
4343
}
4444

4545
$currentTimestamp = $this->clock->now()->getTimestamp();
4646

4747
if ($currentTimestamp - $session['timestamp'] > $this->ttl) {
48-
unset($this->store[$sessionId->toRfc4122()]);
48+
unset($this->store[$id->toRfc4122()]);
4949

5050
return false;
5151
}
5252

5353
return $session['data'];
5454
}
5555

56-
public function write(Uuid $sessionId, string $data): bool
56+
public function write(Uuid $id, string $data): bool
5757
{
58-
$this->store[$sessionId->toRfc4122()] = [
58+
$this->store[$id->toRfc4122()] = [
5959
'data' => $data,
6060
'timestamp' => $this->clock->now()->getTimestamp(),
6161
];
6262

6363
return true;
6464
}
6565

66-
public function destroy(Uuid $sessionId): bool
66+
public function destroy(Uuid $id): bool
6767
{
68-
if (isset($this->store[$sessionId->toRfc4122()])) {
69-
unset($this->store[$sessionId->toRfc4122()]);
68+
if (isset($this->store[$id->toRfc4122()])) {
69+
unset($this->store[$id->toRfc4122()]);
7070
}
7171

7272
return true;

0 commit comments

Comments
 (0)