2010-02-17 13:55:05 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2011-01-15 13:29:43 +00:00
|
|
|
* This file is part of the Symfony package.
|
2010-02-17 13:55:05 +00:00
|
|
|
*
|
2011-03-06 11:40:06 +00:00
|
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
2010-02-17 13:55:05 +00:00
|
|
|
*
|
2011-01-15 13:29:43 +00:00
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
2010-02-17 13:55:05 +00:00
|
|
|
*/
|
|
|
|
|
2012-02-08 23:15:47 +00:00
|
|
|
namespace Symfony\Component\HttpFoundation\Session\Storage;
|
2011-01-29 14:45:10 +00:00
|
|
|
|
2012-02-08 23:15:47 +00:00
|
|
|
use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
|
2012-03-31 04:15:05 +01:00
|
|
|
use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag;
|
2011-11-29 04:35:09 +00:00
|
|
|
|
2010-02-17 13:55:05 +00:00
|
|
|
/**
|
2012-02-08 23:15:47 +00:00
|
|
|
* StorageInterface.
|
2010-02-17 13:55:05 +00:00
|
|
|
*
|
2011-03-06 11:40:06 +00:00
|
|
|
* @author Fabien Potencier <fabien@symfony.com>
|
2011-11-29 04:35:09 +00:00
|
|
|
* @author Drak <drak@zikula.org>
|
2011-07-20 09:06:02 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-02-17 13:55:05 +00:00
|
|
|
*/
|
2012-02-11 11:04:05 +00:00
|
|
|
interface SessionStorageInterface
|
2010-02-17 13:55:05 +00:00
|
|
|
{
|
2010-07-09 08:26:22 +01:00
|
|
|
/**
|
|
|
|
* Starts the session.
|
2011-07-20 09:06:02 +01:00
|
|
|
*
|
2011-11-29 04:35:09 +00:00
|
|
|
* @throws \RuntimeException If something goes wrong starting the session.
|
|
|
|
*
|
|
|
|
* @return boolean True if started.
|
|
|
|
*
|
2011-07-20 09:06:02 +01:00
|
|
|
* @api
|
2010-07-09 08:26:22 +01:00
|
|
|
*/
|
2010-10-17 12:39:51 +01:00
|
|
|
function start();
|
2010-07-09 08:26:22 +01:00
|
|
|
|
2011-01-03 16:00:28 +00:00
|
|
|
/**
|
|
|
|
* Returns the session ID
|
|
|
|
*
|
2012-03-14 11:53:34 +00:00
|
|
|
* @return string The session ID or empty.
|
2011-07-20 09:06:02 +01:00
|
|
|
*
|
|
|
|
* @api
|
2011-01-03 16:00:28 +00:00
|
|
|
*/
|
|
|
|
function getId();
|
|
|
|
|
2012-03-14 11:53:34 +00:00
|
|
|
/**
|
|
|
|
* Sets the session ID
|
|
|
|
*
|
|
|
|
* @param string $id
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
*/
|
|
|
|
function setId($id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the session name
|
|
|
|
*
|
|
|
|
* @return mixed The session name.
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
*/
|
|
|
|
function getName();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the session name
|
|
|
|
*
|
|
|
|
* @param string $name
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
*/
|
|
|
|
function setName($name);
|
|
|
|
|
2010-05-06 12:25:53 +01:00
|
|
|
/**
|
2011-11-29 04:35:09 +00:00
|
|
|
* Regenerates id that represents this storage.
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
2011-11-29 04:35:09 +00:00
|
|
|
* This method must invoke session_regenerate_id($destroy) unless
|
|
|
|
* this interface is used for a storage object designed for unit
|
|
|
|
* or functional testing where a real PHP session would interfere
|
|
|
|
* with testing.
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
2012-03-14 11:53:34 +00:00
|
|
|
* Note regenerate+destroy should not clear the session data in memory
|
|
|
|
* only delete the session data from persistent storage.
|
|
|
|
*
|
2012-03-30 18:02:35 +01:00
|
|
|
* @param Boolean $destroy Destroy session when regenerating?
|
|
|
|
* @param integer $lifetime Sets the cookie lifetime for the session cookie. A null value
|
|
|
|
* will leave the system settings unchanged, 0 sets the cookie
|
|
|
|
* to expire with browser session. Time is in seconds, and is
|
|
|
|
* not a Unix timestamp.
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
2011-11-29 04:35:09 +00:00
|
|
|
* @return Boolean True if session regenerated, false if error
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
2011-11-29 04:35:09 +00:00
|
|
|
* @throws \RuntimeException If an error occurs while regenerating this storage
|
2011-07-20 09:06:02 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
2012-03-30 18:02:35 +01:00
|
|
|
function regenerate($destroy = false, $lifetime = null);
|
2010-02-17 13:55:05 +00:00
|
|
|
|
2010-05-06 12:25:53 +01:00
|
|
|
/**
|
2011-11-29 04:35:09 +00:00
|
|
|
* Force the session to be saved and closed.
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
2011-11-29 04:35:09 +00:00
|
|
|
* This method must invoke session_write_close() unless this interface is
|
|
|
|
* used for a storage object design for unit or functional testing where
|
|
|
|
* a real PHP session would interfere with testing, in which case it
|
|
|
|
* it should actually persist the session data if required.
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
2011-11-29 04:35:09 +00:00
|
|
|
function save();
|
2010-02-17 13:55:05 +00:00
|
|
|
|
2010-05-06 12:25:53 +01:00
|
|
|
/**
|
2011-11-29 04:35:09 +00:00
|
|
|
* Clear all session data in memory.
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
2011-11-29 04:35:09 +00:00
|
|
|
function clear();
|
2010-02-17 13:55:05 +00:00
|
|
|
|
2010-05-06 12:25:53 +01:00
|
|
|
/**
|
2012-02-08 09:46:38 +00:00
|
|
|
* Gets a SessionBagInterface by name.
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
2012-02-12 00:54:16 +00:00
|
|
|
* @param string $name
|
|
|
|
*
|
2012-02-08 09:46:38 +00:00
|
|
|
* @return SessionBagInterface
|
2012-02-12 00:54:16 +00:00
|
|
|
*
|
|
|
|
* @throws \InvalidArgumentException If the bag does not exist
|
2011-11-29 04:35:09 +00:00
|
|
|
*/
|
2012-02-08 09:46:38 +00:00
|
|
|
function getBag($name);
|
2011-11-29 04:35:09 +00:00
|
|
|
|
|
|
|
/**
|
2012-02-08 09:46:38 +00:00
|
|
|
* Registers a SessionBagInterface for use.
|
2012-02-11 14:30:36 +00:00
|
|
|
*
|
|
|
|
* @param SessionBagInterface $bag
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
2012-02-08 09:46:38 +00:00
|
|
|
function registerBag(SessionBagInterface $bag);
|
2012-03-29 12:33:17 +01:00
|
|
|
|
|
|
|
/**
|
2012-03-31 04:15:05 +01:00
|
|
|
* @return MetadataBag
|
2012-03-29 12:33:17 +01:00
|
|
|
*/
|
2012-03-31 04:15:05 +01:00
|
|
|
function getMetadataBag();
|
2010-02-17 13:55:05 +00:00
|
|
|
}
|