Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AbstractProxy.php

class AbstractProxy

@author Drak <drak@zikula.org>

Hierarchy

  • class \Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy

Expanded class hierarchy of AbstractProxy

5 files declare their use of AbstractProxy
NativeSessionStorage.php in vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php
NativeSessionStorageFactory.php in vendor/symfony/http-foundation/Session/Storage/NativeSessionStorageFactory.php
PhpBridgeSessionStorage.php in vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php
PhpBridgeSessionStorageFactory.php in vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorageFactory.php
SessionHandler.php in core/lib/Drupal/Core/Session/SessionHandler.php

File

vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php, line 17

Namespace

Symfony\Component\HttpFoundation\Session\Storage\Proxy
View source
abstract class AbstractProxy {
    protected bool $wrapper = false;
    protected ?string $saveHandlerName = null;
    
    /**
     * Gets the session.save_handler name.
     */
    public function getSaveHandlerName() : ?string {
        return $this->saveHandlerName;
    }
    
    /**
     * Is this proxy handler and instance of \SessionHandlerInterface.
     */
    public function isSessionHandlerInterface() : bool {
        return $this instanceof \SessionHandlerInterface;
    }
    
    /**
     * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler.
     */
    public function isWrapper() : bool {
        return $this->wrapper;
    }
    
    /**
     * Has a session started?
     */
    public function isActive() : bool {
        return \PHP_SESSION_ACTIVE === session_status();
    }
    
    /**
     * Gets the session ID.
     */
    public function getId() : string {
        return session_id();
    }
    
    /**
     * Sets the session ID.
     *
     * @throws \LogicException
     */
    public function setId(string $id) : void {
        if ($this->isActive()) {
            throw new \LogicException('Cannot change the ID of an active session.');
        }
        session_id($id);
    }
    
    /**
     * Gets the session name.
     */
    public function getName() : string {
        return session_name();
    }
    
    /**
     * Sets the session name.
     *
     * @throws \LogicException
     */
    public function setName(string $name) : void {
        if ($this->isActive()) {
            throw new \LogicException('Cannot change the name of an active session.');
        }
        session_name($name);
    }

}

Members

Title Sort descending Modifiers Object type Summary
AbstractProxy::$saveHandlerName protected property
AbstractProxy::$wrapper protected property
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.
AbstractProxy::setId public function Sets the session ID.
AbstractProxy::setName public function Sets the session name.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal