fix(server): consistent arg name in session store impl (#127)
This commit is contained in:
parent
757b959bfd
commit
67cc641247
2 changed files with 14 additions and 14 deletions
|
|
@ -50,9 +50,9 @@ class FileSessionStore implements SessionStoreInterface
|
||||||
return ($this->clock->now()->getTimestamp() - $mtime) <= $this->ttl;
|
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)) {
|
if (!is_file($path)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -73,9 +73,9 @@ class FileSessionStore implements SessionStoreInterface
|
||||||
return $data;
|
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';
|
$tmp = $path.'.tmp';
|
||||||
if (false === @file_put_contents($tmp, $data, \LOCK_EX)) {
|
if (false === @file_put_contents($tmp, $data, \LOCK_EX)) {
|
||||||
|
|
@ -98,9 +98,9 @@ class FileSessionStore implements SessionStoreInterface
|
||||||
return true;
|
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)) {
|
if (is_file($path)) {
|
||||||
@unlink($path);
|
@unlink($path);
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,9 @@ class InMemorySessionStore implements SessionStoreInterface
|
||||||
return isset($this->store[$id->toRfc4122()]);
|
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) {
|
if ('' === $session) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -45,7 +45,7 @@ class InMemorySessionStore implements SessionStoreInterface
|
||||||
$currentTimestamp = $this->clock->now()->getTimestamp();
|
$currentTimestamp = $this->clock->now()->getTimestamp();
|
||||||
|
|
||||||
if ($currentTimestamp - $session['timestamp'] > $this->ttl) {
|
if ($currentTimestamp - $session['timestamp'] > $this->ttl) {
|
||||||
unset($this->store[$sessionId->toRfc4122()]);
|
unset($this->store[$id->toRfc4122()]);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -53,9 +53,9 @@ class InMemorySessionStore implements SessionStoreInterface
|
||||||
return $session['data'];
|
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,
|
'data' => $data,
|
||||||
'timestamp' => $this->clock->now()->getTimestamp(),
|
'timestamp' => $this->clock->now()->getTimestamp(),
|
||||||
];
|
];
|
||||||
|
|
@ -63,10 +63,10 @@ class InMemorySessionStore implements SessionStoreInterface
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy(Uuid $sessionId): bool
|
public function destroy(Uuid $id): bool
|
||||||
{
|
{
|
||||||
if (isset($this->store[$sessionId->toRfc4122()])) {
|
if (isset($this->store[$id->toRfc4122()])) {
|
||||||
unset($this->store[$sessionId->toRfc4122()]);
|
unset($this->store[$id->toRfc4122()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue