You are here

class SessionHandlerProxy in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php \Symfony\Component\HttpFoundation\Session\Storage\Proxy\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 vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php
NativeSessionStorageTest.php in vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php
SessionHandlerProxyTest.php in vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php

File

vendor/symfony/http-foundation/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($sessionId) {
    return (string) $this->handler
      ->read($sessionId);
  }

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

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

  /**
   * {@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.