Initial
This commit is contained in:
91
system/Session/Handlers/ArrayHandler.php
Normal file
91
system/Session/Handlers/ArrayHandler.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user