2011-11-29 04:35:09 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file is part of the Symfony package.
|
|
|
|
*
|
|
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
2012-02-08 23:15:47 +00:00
|
|
|
namespace Symfony\Component\HttpFoundation\Session;
|
2011-11-29 04:35:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface for the session.
|
|
|
|
*
|
|
|
|
* @author Drak <drak@zikula.org>
|
|
|
|
*/
|
2012-02-12 13:00:25 +00:00
|
|
|
interface SessionInterface
|
2011-11-29 04:35:09 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Starts the session storage.
|
|
|
|
*
|
2012-02-12 00:54:16 +00:00
|
|
|
* @return Boolean True if session started.
|
|
|
|
*
|
2011-11-29 04:35:09 +00:00
|
|
|
* @throws \RuntimeException If session fails to start.
|
2012-02-12 00:54:16 +00:00
|
|
|
*
|
|
|
|
* @api
|
2011-11-29 04:35:09 +00:00
|
|
|
*/
|
|
|
|
function start();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invalidates the current session.
|
|
|
|
*
|
2012-02-12 00:54:16 +00:00
|
|
|
* Clears all session attributes and flashes and regenerates the
|
|
|
|
* session and deletes the old session from persistence.
|
|
|
|
*
|
|
|
|
* @return Boolean True if session invalidated, false if error.
|
|
|
|
*
|
|
|
|
* @api
|
2011-11-29 04:35:09 +00:00
|
|
|
*/
|
|
|
|
function invalidate();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Migrates the current session to a new session id while maintaining all
|
|
|
|
* session attributes.
|
|
|
|
*
|
2012-02-12 00:54:16 +00:00
|
|
|
* @param Boolean $destroy Whether to delete the old session or leave it to garbage collection.
|
2011-11-29 04:35:09 +00:00
|
|
|
*
|
2012-02-12 00:54:16 +00:00
|
|
|
* @return Boolean True if session migrated, false if error.
|
2011-11-29 04:35:09 +00:00
|
|
|
*
|
|
|
|
* @api
|
|
|
|
*/
|
|
|
|
function migrate($destroy = false);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Force the session to be saved and closed.
|
|
|
|
*
|
|
|
|
* This method is generally not required for real sessions as
|
|
|
|
* the session will be automatically saved at the end of
|
|
|
|
* code execution.
|
|
|
|
*/
|
|
|
|
function save();
|
|
|
|
|
2012-02-08 09:46:38 +00:00
|
|
|
/**
|
|
|
|
* Checks if an attribute is defined.
|
|
|
|
*
|
|
|
|
* @param string $name The attribute name
|
|
|
|
*
|
|
|
|
* @return Boolean true if the attribute is defined, false otherwise
|
2012-02-12 00:54:16 +00:00
|
|
|
*
|
|
|
|
* @api
|
2012-02-08 09:46:38 +00:00
|
|
|
*/
|
|
|
|
function has($name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an attribute.
|
|
|
|
*
|
|
|
|
* @param string $name The attribute name
|
|
|
|
* @param mixed $default The default value if not found.
|
|
|
|
*
|
|
|
|
* @return mixed
|
2012-02-12 00:54:16 +00:00
|
|
|
*
|
|
|
|
* @api
|
2012-02-08 09:46:38 +00:00
|
|
|
*/
|
|
|
|
function get($name, $default = null);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets an attribute.
|
|
|
|
*
|
|
|
|
* @param string $name
|
|
|
|
* @param mixed $value
|
2012-02-12 00:54:16 +00:00
|
|
|
*
|
|
|
|
* @api
|
2012-02-08 09:46:38 +00:00
|
|
|
*/
|
|
|
|
function set($name, $value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns attributes.
|
|
|
|
*
|
|
|
|
* @return array Attributes
|
2012-02-12 00:54:16 +00:00
|
|
|
*
|
|
|
|
* @api
|
2012-02-08 09:46:38 +00:00
|
|
|
*/
|
|
|
|
function all();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets attributes.
|
|
|
|
*
|
|
|
|
* @param array $attributes Attributes
|
|
|
|
*/
|
|
|
|
function replace(array $attributes);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes an attribute.
|
|
|
|
*
|
|
|
|
* @param string $name
|
2012-02-12 00:54:16 +00:00
|
|
|
*
|
|
|
|
* @return mixed The removed value
|
|
|
|
*
|
|
|
|
* @api
|
2012-02-08 09:46:38 +00:00
|
|
|
*/
|
|
|
|
function remove($name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears all attributes.
|
2012-02-12 00:54:16 +00:00
|
|
|
*
|
|
|
|
* @api
|
2012-02-08 09:46:38 +00:00
|
|
|
*/
|
|
|
|
function clear();
|
2011-11-29 04:35:09 +00:00
|
|
|
}
|