for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* sessionware (https://github.com/juliangut/sessionware).
* PSR7 compatible session management.
*
* @license BSD-3-Clause
* @link https://github.com/juliangut/sessionware
* @author Julián Gutiérrez <[email protected]>
*/
declare(strict_types=1);
namespace Jgut\Sessionware\Handler;
/**
* In-memory session handler.
class Memory implements Handler
{
use HandlerTrait;
* @var string
protected $data;
* In-memory session handler constructor.
public function __construct()
$this->data = serialize([]);
}
* {@inheritdoc}
* @throws \RuntimeException
* @SuppressWarnings(PMD.UnusedFormalParameter)
public function open($savePath, $sessionName)
$this->testConfiguration();
return true;
public function close()
public function read($sessionId)
return $this->data;
public function write($sessionId, $sessionData)
$this->data = $sessionData;
public function destroy($sessionId)
* @SuppressWarnings(PMD.ShortMethodName)
public function gc($maxLifetime)