MAPG-115 add new classes to store request data (get, post, session, etc.)

This commit is contained in:
bence committed 2020-06-09 21:04:27 +02:00
1 parent ecaf8ca9d4
commit fe814908c7
5 files changed
+130

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
<?php namespace MapGuesser\Request;
use MapGuesser\Interfaces\Request\ISession;
class Session implements ISession
{
private array $data;
public function __construct(array &$data)
{
$this->data = &$data;
}
public function has($key): bool
{
return isset($this->data[$key]);
}
public function get($key)
{
if (isset($this->data[$key])) {
return $this->data[$key];
}
return null;
}
public function set($key, $value): void
{
$this->data[$key] = $value;
}
public function delete($key): void
{
unset($this->data[$key]);
}
}