2018-09-16 14:08:09 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Engelsystem\Test\Unit\Http\SessionHandlers\Stub;
|
|
|
|
|
|
|
|
use Engelsystem\Http\SessionHandlers\AbstractHandler;
|
|
|
|
|
|
|
|
class ArrayHandler extends AbstractHandler
|
|
|
|
{
|
|
|
|
/** @var string[] */
|
2022-12-15 19:50:56 +01:00
|
|
|
protected array $content = [];
|
2018-09-16 14:08:09 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function read($id): string
|
|
|
|
{
|
|
|
|
if (isset($this->content[$id])) {
|
|
|
|
return $this->content[$id];
|
|
|
|
}
|
|
|
|
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function write($id, $data): bool
|
|
|
|
{
|
|
|
|
$this->content[$id] = $data;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function destroy($id): bool
|
|
|
|
{
|
|
|
|
unset($this->content[$id]);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName(): string
|
|
|
|
{
|
|
|
|
return $this->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getSessionPath(): string
|
|
|
|
{
|
|
|
|
return $this->sessionPath;
|
|
|
|
}
|
|
|
|
}
|