You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
2.1 KiB
92 lines
2.1 KiB
1 year ago
|
<?php
|
||
|
|
||
|
/**
|
||
|
* This file is part of CodeIgniter 4 framework.
|
||
|
*
|
||
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||
|
*
|
||
|
* For the full copyright and license information, please view
|
||
|
* the LICENSE file that was distributed with this source code.
|
||
|
*/
|
||
|
|
||
|
namespace CodeIgniter\Session\Handlers;
|
||
|
|
||
|
use ReturnTypeWillChange;
|
||
|
|
||
|
/**
|
||
|
* Session handler using static array for storage.
|
||
|
* Intended only for use during testing.
|
||
|
*/
|
||
|
class ArrayHandler extends BaseHandler
|
||
|
{
|
||
|
protected static $cache = [];
|
||
|
|
||
|
/**
|
||
|
* Re-initialize existing session, or creates a new one.
|
||
|
*
|
||
|
* @param string $path The path where to store/retrieve the session
|
||
|
* @param string $name The session name
|
||
|
*/
|
||
|
public function open($path, $name): bool
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Reads the session data from the session storage, and returns the results.
|
||
|
*
|
||
|
* @param string $id The session ID
|
||
|
*
|
||
|
* @return false|string Returns an encoded string of the read data.
|
||
|
* If nothing was read, it must return false.
|
||
|
*/
|
||
|
#[ReturnTypeWillChange]
|
||
|
public function read($id)
|
||
|
{
|
||
|
return '';
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Writes the session data to the session storage.
|
||
|
*
|
||
|
* @param string $id The session ID
|
||
|
* @param string $data The encoded session data
|
||
|
*/
|
||
|
public function write($id, $data): bool
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Closes the current session.
|
||
|
*/
|
||
|
public function close(): bool
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Destroys a session
|
||
|
*
|
||
|
* @param string $id The session ID being destroyed
|
||
|
*/
|
||
|
public function destroy($id): bool
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Cleans up expired sessions.
|
||
|
*
|
||
|
* @param int $max_lifetime Sessions that have not updated
|
||
|
* for the last max_lifetime seconds will be removed.
|
||
|
*
|
||
|
* @return false|int Returns the number of deleted sessions on success, or false on failure.
|
||
|
*/
|
||
|
#[ReturnTypeWillChange]
|
||
|
public function gc($max_lifetime)
|
||
|
{
|
||
|
return 1;
|
||
|
}
|
||
|
}
|