private void
registerSessionHandlerAsService
(\Joomla\DI\Container $container, \SessionHandlerInterface $sessionHandler)
/**
* Registers the session handler as a service
*
* @param Container $container The container to register the service to.
* @param \SessionHandlerInterface $sessionHandler The session handler.
*
* @return void
*
* @since 4.0.0
*/
private function registerSessionHandlerAsService(Container $container, \SessionHandlerInterface $sessionHandler) : void
{
// Alias the session handler to the core SessionHandlerInterface for improved autowiring and discoverability
$container->alias(\SessionHandlerInterface::class, 'session.handler')->share('session.handler', $sessionHandler, true);
// If the session handler implements the extended interface, register an alias for that as well
if ($sessionHandler instanceof HandlerInterface) {
$container->alias(HandlerInterface::class, 'session.handler');
}
}