You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
971 B
PHTML
60 lines
971 B
PHTML
6 years ago
|
<?php
|
||
|
|
||
|
namespace Engelsystem\Test\Unit\Http\SessionHandlers\Stub;
|
||
|
|
||
|
use Engelsystem\Http\SessionHandlers\AbstractHandler;
|
||
|
|
||
|
class ArrayHandler extends AbstractHandler
|
||
|
{
|
||
|
/** @var string[] */
|
||
|
protected $content = [];
|
||
|
|
||
|
/**
|
||
|
* {@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;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return string
|
||
|
*/
|
||
|
public function getName(): string
|
||
|
{
|
||
|
return $this->name;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return string
|
||
|
*/
|
||
|
public function getSessionPath(): string
|
||
|
{
|
||
|
return $this->sessionPath;
|
||
|
}
|
||
|
}
|