mirror of
https://github.com/friendica/friendica
synced 2025-05-08 07:04:11 +02:00
Renaming class
This commit is contained in:
parent
26bd956912
commit
ce2610000b
5 changed files with 16 additions and 13 deletions
85
src/Core/Session/Memory.php
Normal file
85
src/Core/Session/Memory.php
Normal file
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Core\Session;
|
||||
|
||||
/**
|
||||
* Usable for backend processes (daemon/worker) and testing
|
||||
*/
|
||||
final class Memory implements ISession
|
||||
{
|
||||
private $data = [];
|
||||
|
||||
public function start()
|
||||
{
|
||||
// Backward compatibility until all Session variables are replaced
|
||||
// with the Session class
|
||||
$_SESSION = [];
|
||||
$this->clear();
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function exists(string $name)
|
||||
{
|
||||
return isset($this->data[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function get(string $name, $defaults = null)
|
||||
{
|
||||
return $this->data[$name] ?? $defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function set(string $name, $value)
|
||||
{
|
||||
$this->data[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setMultiple(array $values)
|
||||
{
|
||||
foreach ($values as $key => $value) {
|
||||
$this->data[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function remove(string $name)
|
||||
{
|
||||
if ($this->exists($name)) {
|
||||
unset($this->data[$name]);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->data = [];
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$this->data = [];
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue