Back to Session class

Method buildSession

private \Joomla\Session\SessionInterface
buildSession
(\Joomla\Session\StorageInterface $storage, \Joomla\CMS\Application\CMSApplicationInterface $app, \Joomla\Event\DispatcherInterface $dispatcher, array $options)
Build the root session service
Parameters
  • \Joomla\Session\StorageInterface $storage The session storage engine.
  • \Joomla\CMS\Application\CMSApplicationInterface $app The application instance.
  • \Joomla\Event\DispatcherInterface $dispatcher The event dispatcher.
  • array $options The configured session options.
Returns
  • \Joomla\Session\SessionInterface
Since
  • 4.0.0
Class: Session
Project: Joomla

Method buildSession - Source code

/**
 * Build the root session service
 *
 * @param   StorageInterface         $storage     The session storage engine.
 * @param   CMSApplicationInterface  $app         The application instance.
 * @param   DispatcherInterface      $dispatcher  The event dispatcher.
 * @param   array                    $options     The configured session options.
 *
 * @return  SessionInterface
 *
 * @since   4.0.0
 */
private function buildSession(StorageInterface $storage, CMSApplicationInterface $app, DispatcherInterface $dispatcher, array $options) : SessionInterface
{
    $input = $app->input;
    if (method_exists($app, 'afterSessionStart')) {
        $dispatcher->addListener(SessionEvents::START, [$app, 'afterSessionStart'], Priority::HIGH);
    }
    $session = new \Joomla\CMS\Session\Session($storage, $dispatcher, $options);
    return $session;
}