40 lines
607 B
PHP
40 lines
607 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace davina\auths;
|
||
|
|
|
||
|
|
require_once(DIR_LOGIC . '/auths/_interface.php');
|
||
|
|
require_once(DIR_LOGIC . '/auths/pass_through.php');
|
||
|
|
require_once(DIR_LOGIC . '/auths/static.php');
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
*/
|
||
|
|
function make(
|
||
|
|
string $kind,
|
||
|
|
$data
|
||
|
|
) : \davina\auths\interface_auth
|
||
|
|
{
|
||
|
|
switch ($kind)
|
||
|
|
{
|
||
|
|
case 'pass_through':
|
||
|
|
{
|
||
|
|
return (new \davina\auths\class_auth_pass_through(
|
||
|
|
));
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
case 'static':
|
||
|
|
{
|
||
|
|
return (new \davina\auths\class_auth_static(
|
||
|
|
$data['password']
|
||
|
|
));
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
default:
|
||
|
|
{
|
||
|
|
throw (new \Exception(\sprintf('unhandled auth kind: %s', $kind)));
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
?>
|