package and depencies

This commit is contained in:
RafficMohammed
2023-01-08 02:57:24 +05:30
parent d5332eb421
commit 1d54b8bc7f
4309 changed files with 193331 additions and 172289 deletions

View File

@@ -50,8 +50,7 @@ class FileSessionHandler implements SessionHandlerInterface
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function open($savePath, $sessionName)
public function open($savePath, $sessionName): bool
{
return true;
}
@@ -61,8 +60,7 @@ class FileSessionHandler implements SessionHandlerInterface
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function close()
public function close(): bool
{
return true;
}
@@ -72,13 +70,11 @@ class FileSessionHandler implements SessionHandlerInterface
*
* @return string|false
*/
#[\ReturnTypeWillChange]
public function read($sessionId)
public function read($sessionId): string|false
{
if ($this->files->isFile($path = $this->path.'/'.$sessionId)) {
if ($this->files->lastModified($path) >= Carbon::now()->subMinutes($this->minutes)->getTimestamp()) {
return $this->files->sharedGet($path);
}
if ($this->files->isFile($path = $this->path.'/'.$sessionId) &&
$this->files->lastModified($path) >= Carbon::now()->subMinutes($this->minutes)->getTimestamp()) {
return $this->files->sharedGet($path);
}
return '';
@@ -89,8 +85,7 @@ class FileSessionHandler implements SessionHandlerInterface
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function write($sessionId, $data)
public function write($sessionId, $data): bool
{
$this->files->put($this->path.'/'.$sessionId, $data, true);
@@ -102,8 +97,7 @@ class FileSessionHandler implements SessionHandlerInterface
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function destroy($sessionId)
public function destroy($sessionId): bool
{
$this->files->delete($this->path.'/'.$sessionId);
@@ -113,10 +107,9 @@ class FileSessionHandler implements SessionHandlerInterface
/**
* {@inheritdoc}
*
* @return int|false
* @return int
*/
#[\ReturnTypeWillChange]
public function gc($lifetime)
public function gc($lifetime): int
{
$files = Finder::create()
->in($this->path)
@@ -124,8 +117,13 @@ class FileSessionHandler implements SessionHandlerInterface
->ignoreDotFiles(true)
->date('<= now - '.$lifetime.' seconds');
$deletedSessions = 0;
foreach ($files as $file) {
$this->files->delete($file->getRealPath());
$deletedSessions++;
}
return $deletedSessions;
}
}