Predis to v2.2.2

This commit is contained in:
the-djmaze 2024-04-02 20:15:23 +02:00
parent f6b440adef
commit 84ffe1e552
259 changed files with 2407 additions and 9937 deletions

View file

@ -3,7 +3,8 @@
/*
* This file is part of the Predis package.
*
* (c) Daniele Alessandri <suppakilla@gmail.com>
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@ -12,6 +13,8 @@
namespace Predis\Session;
use Predis\ClientInterface;
use ReturnTypeWillChange;
use SessionHandlerInterface;
/**
* Session handler class that relies on Predis\Client to store PHP's sessions
@ -20,10 +23,8 @@ use Predis\ClientInterface;
* This class is mostly intended for PHP 5.4 but it can be used under PHP 5.3
* provided that a polyfill for `SessionHandlerInterface` is defined by either
* you or an external package such as `symfony/http-foundation`.
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
class Handler implements \SessionHandlerInterface
class Handler implements SessionHandlerInterface
{
protected $client;
protected $ttl;
@ -32,7 +33,7 @@ class Handler implements \SessionHandlerInterface
* @param ClientInterface $client Fully initialized client instance.
* @param array $options Session handler options.
*/
public function __construct(ClientInterface $client, array $options = array())
public function __construct(ClientInterface $client, array $options = [])
{
$this->client = $client;
@ -52,8 +53,11 @@ class Handler implements \SessionHandlerInterface
}
/**
* {@inheritdoc}
* @param string $save_path
* @param string $session_id
* @return bool
*/
#[ReturnTypeWillChange]
public function open($save_path, $session_id)
{
// NOOP
@ -61,8 +65,9 @@ class Handler implements \SessionHandlerInterface
}
/**
* {@inheritdoc}
* @return bool
*/
#[ReturnTypeWillChange]
public function close()
{
// NOOP
@ -70,8 +75,10 @@ class Handler implements \SessionHandlerInterface
}
/**
* {@inheritdoc}
* @param int $maxlifetime
* @return bool
*/
#[ReturnTypeWillChange]
public function gc($maxlifetime)
{
// NOOP
@ -79,8 +86,10 @@ class Handler implements \SessionHandlerInterface
}
/**
* {@inheritdoc}
* @param string $session_id
* @return string
*/
#[ReturnTypeWillChange]
public function read($session_id)
{
if ($data = $this->client->get($session_id)) {
@ -89,9 +98,13 @@ class Handler implements \SessionHandlerInterface
return '';
}
/**
* {@inheritdoc}
* @param string $session_id
* @param string $session_data
* @return bool
*/
#[ReturnTypeWillChange]
public function write($session_id, $session_data)
{
$this->client->setex($session_id, $this->ttl, $session_data);
@ -100,8 +113,10 @@ class Handler implements \SessionHandlerInterface
}
/**
* {@inheritdoc}
* @param string $session_id
* @return bool
*/
#[ReturnTypeWillChange]
public function destroy($session_id)
{
$this->client->del($session_id);