81 lines
1.3 KiB
PHP
81 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace alveolata\session;
|
|
|
|
// require_once(DIR_ALVEOLATA . '/definitions.php');
|
|
require_once(DIR_ALVEOLATA . '/session/interface.php');
|
|
require_once(DIR_ALVEOLATA . '/session/implementation-memory.php');
|
|
require_once(DIR_ALVEOLATA . '/session/implementation-file.php');
|
|
require_once(DIR_ALVEOLATA . '/session/implementation-cgi.php');
|
|
|
|
|
|
/**
|
|
* @author Christian Fraß <frass@greenscale.de>
|
|
*/
|
|
function begin(
|
|
string $kind,
|
|
array $parameters = []
|
|
) : interface_session
|
|
{
|
|
switch ($kind) {
|
|
default: {
|
|
throw (new \Exception(sprintf('invalid session kind "%s"', $kind)));
|
|
break;
|
|
}
|
|
case 'memory': {
|
|
return (
|
|
implementation_memory::begin()
|
|
);
|
|
break;
|
|
}
|
|
case 'file': {
|
|
return (
|
|
implementation_file::begin()
|
|
);
|
|
break;
|
|
}
|
|
case 'cgi': {
|
|
return (
|
|
implementation_cgi::begin()
|
|
);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* @author Christian Fraß <frass@greenscale.de>
|
|
*/
|
|
function get(
|
|
string $kind,
|
|
string $id
|
|
) : interface_session
|
|
{
|
|
switch ($kind) {
|
|
default: {
|
|
throw (new \Exception(sprintf('invalid session kind "%s"', $kind)));
|
|
break;
|
|
}
|
|
case 'memory': {
|
|
return (
|
|
implementation_memory::get($id)
|
|
);
|
|
break;
|
|
}
|
|
case 'file': {
|
|
return (
|
|
implementation_file::get($id)
|
|
);
|
|
break;
|
|
}
|
|
case 'cgi': {
|
|
return (
|
|
implementation_cgi::get($id)
|
|
);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|