class SessionHandlerProxy

SessionHandler proxy.

@author Drak <drak@zikula.org>

Hierarchy

  • class \Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy
    • class \Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy implements \Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerInterface

Expanded class hierarchy of SessionHandlerProxy

3 files declare their use of SessionHandlerProxy
NativeSessionStorage.php in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
NativeSessionStorageTest.php in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
SessionHandlerProxyTest.php in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php, line 19

Namespace

Symfony\Component\HttpFoundation\Session\Storage\Proxy
View source
class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface {

  /**
   * @var \SessionHandlerInterface
   */
  protected $handler;

  /**
   * Constructor.
   *
   * @param \SessionHandlerInterface $handler
   */
  public function __construct(\SessionHandlerInterface $handler) {
    $this->handler = $handler;
    $this->wrapper = $handler instanceof \SessionHandler;
    $this->saveHandlerName = $this->wrapper ? ini_get('session.save_handler') : 'user';
  }

  // \SessionHandlerInterface

  /**
   * {@inheritdoc}
   */
  public function open($savePath, $sessionName) {
    $return = (bool) $this->handler
      ->open($savePath, $sessionName);
    if (true === $return) {
      $this->active = true;
    }
    return $return;
  }

  /**
   * {@inheritdoc}
   */
  public function close() {
    $this->active = false;
    return (bool) $this->handler
      ->close();
  }

  /**
   * {@inheritdoc}
   */
  public function read($id) {
    return (string) $this->handler
      ->read($id);
  }

  /**
   * {@inheritdoc}
   */
  public function write($id, $data) {
    return (bool) $this->handler
      ->write($id, $data);
  }

  /**
   * {@inheritdoc}
   */
  public function destroy($id) {
    return (bool) $this->handler
      ->destroy($id);
  }

  /**
   * {@inheritdoc}
   */
  public function gc($maxlifetime) {
    return (bool) $this->handler
      ->gc($maxlifetime);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AbstractProxy::$active protected property
AbstractProxy::$saveHandlerName protected property
AbstractProxy::$wrapper protected property Flag if handler wraps an internal PHP session handler (using \SessionHandler).
AbstractProxy::getId public function Gets the session ID.
AbstractProxy::getName public function Gets the session name.
AbstractProxy::getSaveHandlerName public function Gets the session.save_handler name.
AbstractProxy::isActive public function Has a session started?
AbstractProxy::isSessionHandlerInterface public function Is this proxy handler and instance of \SessionHandlerInterface.
AbstractProxy::isWrapper public function Returns true if this handler wraps an internal PHP session save handler using \SessionHandler. 1
AbstractProxy::setActive public function Sets the active flag.
AbstractProxy::setId public function Sets the session ID.
AbstractProxy::setName public function Sets the session name.
SessionHandlerProxy::$handler protected property
SessionHandlerProxy::close public function
SessionHandlerProxy::destroy public function
SessionHandlerProxy::gc public function
SessionHandlerProxy::open public function
SessionHandlerProxy::read public function
SessionHandlerProxy::write public function
SessionHandlerProxy::__construct public function Constructor.