SessionHandler proxy.
@author Drak <drak@zikula.org>
Expanded class hierarchy of SessionHandlerProxy
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);
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AbstractProxy:: |
protected | property | ||
AbstractProxy:: |
protected | property | ||
AbstractProxy:: |
protected | property | Flag if handler wraps an internal PHP session handler (using \SessionHandler). | |
AbstractProxy:: |
public | function | Gets the session ID. | |
AbstractProxy:: |
public | function | Gets the session name. | |
AbstractProxy:: |
public | function | Gets the session.save_handler name. | |
AbstractProxy:: |
public | function | Has a session started? | |
AbstractProxy:: |
public | function | Is this proxy handler and instance of \SessionHandlerInterface. | |
AbstractProxy:: |
public | function | Returns true if this handler wraps an internal PHP session save handler using \SessionHandler. | 1 |
AbstractProxy:: |
public | function | Sets the active flag. | |
AbstractProxy:: |
public | function | Sets the session ID. | |
AbstractProxy:: |
public | function | Sets the session name. | |
SessionHandlerProxy:: |
protected | property | ||
SessionHandlerProxy:: |
public | function | ||
SessionHandlerProxy:: |
public | function | ||
SessionHandlerProxy:: |
public | function | ||
SessionHandlerProxy:: |
public | function | ||
SessionHandlerProxy:: |
public | function | ||
SessionHandlerProxy:: |
public | function | ||
SessionHandlerProxy:: |
public | function | Constructor. |