annotate vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 1fec387a4317
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 /*
Chris@0 4 * This file is part of the Symfony package.
Chris@0 5 *
Chris@0 6 * (c) Fabien Potencier <fabien@symfony.com>
Chris@0 7 *
Chris@0 8 * For the full copyright and license information, please view the LICENSE
Chris@0 9 * file that was distributed with this source code.
Chris@0 10 */
Chris@0 11
Chris@0 12 namespace Symfony\Component\HttpFoundation\Session\Storage;
Chris@0 13
Chris@0 14 use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
Chris@0 15
Chris@0 16 /**
Chris@0 17 * StorageInterface.
Chris@0 18 *
Chris@0 19 * @author Fabien Potencier <fabien@symfony.com>
Chris@0 20 * @author Drak <drak@zikula.org>
Chris@0 21 */
Chris@0 22 interface SessionStorageInterface
Chris@0 23 {
Chris@0 24 /**
Chris@0 25 * Starts the session.
Chris@0 26 *
Chris@0 27 * @return bool True if started
Chris@0 28 *
Chris@14 29 * @throws \RuntimeException if something goes wrong starting the session
Chris@0 30 */
Chris@0 31 public function start();
Chris@0 32
Chris@0 33 /**
Chris@0 34 * Checks if the session is started.
Chris@0 35 *
Chris@0 36 * @return bool True if started, false otherwise
Chris@0 37 */
Chris@0 38 public function isStarted();
Chris@0 39
Chris@0 40 /**
Chris@0 41 * Returns the session ID.
Chris@0 42 *
Chris@0 43 * @return string The session ID or empty
Chris@0 44 */
Chris@0 45 public function getId();
Chris@0 46
Chris@0 47 /**
Chris@0 48 * Sets the session ID.
Chris@0 49 *
Chris@0 50 * @param string $id
Chris@0 51 */
Chris@0 52 public function setId($id);
Chris@0 53
Chris@0 54 /**
Chris@0 55 * Returns the session name.
Chris@0 56 *
Chris@0 57 * @return mixed The session name
Chris@0 58 */
Chris@0 59 public function getName();
Chris@0 60
Chris@0 61 /**
Chris@0 62 * Sets the session name.
Chris@0 63 *
Chris@0 64 * @param string $name
Chris@0 65 */
Chris@0 66 public function setName($name);
Chris@0 67
Chris@0 68 /**
Chris@0 69 * Regenerates id that represents this storage.
Chris@0 70 *
Chris@0 71 * This method must invoke session_regenerate_id($destroy) unless
Chris@0 72 * this interface is used for a storage object designed for unit
Chris@0 73 * or functional testing where a real PHP session would interfere
Chris@0 74 * with testing.
Chris@0 75 *
Chris@0 76 * Note regenerate+destroy should not clear the session data in memory
Chris@0 77 * only delete the session data from persistent storage.
Chris@0 78 *
Chris@0 79 * Care: When regenerating the session ID no locking is involved in PHP's
Chris@0 80 * session design. See https://bugs.php.net/bug.php?id=61470 for a discussion.
Chris@0 81 * So you must make sure the regenerated session is saved BEFORE sending the
Chris@0 82 * headers with the new ID. Symfony's HttpKernel offers a listener for this.
Chris@0 83 * See Symfony\Component\HttpKernel\EventListener\SaveSessionListener.
Chris@0 84 * Otherwise session data could get lost again for concurrent requests with the
Chris@0 85 * new ID. One result could be that you get logged out after just logging in.
Chris@0 86 *
Chris@0 87 * @param bool $destroy Destroy session when regenerating?
Chris@0 88 * @param int $lifetime Sets the cookie lifetime for the session cookie. A null value
Chris@0 89 * will leave the system settings unchanged, 0 sets the cookie
Chris@0 90 * to expire with browser session. Time is in seconds, and is
Chris@0 91 * not a Unix timestamp.
Chris@0 92 *
Chris@0 93 * @return bool True if session regenerated, false if error
Chris@0 94 *
Chris@0 95 * @throws \RuntimeException If an error occurs while regenerating this storage
Chris@0 96 */
Chris@0 97 public function regenerate($destroy = false, $lifetime = null);
Chris@0 98
Chris@0 99 /**
Chris@0 100 * Force the session to be saved and closed.
Chris@0 101 *
Chris@0 102 * This method must invoke session_write_close() unless this interface is
Chris@0 103 * used for a storage object design for unit or functional testing where
Chris@0 104 * a real PHP session would interfere with testing, in which case
Chris@0 105 * it should actually persist the session data if required.
Chris@0 106 *
Chris@14 107 * @throws \RuntimeException if the session is saved without being started, or if the session
Chris@14 108 * is already closed
Chris@0 109 */
Chris@0 110 public function save();
Chris@0 111
Chris@0 112 /**
Chris@0 113 * Clear all session data in memory.
Chris@0 114 */
Chris@0 115 public function clear();
Chris@0 116
Chris@0 117 /**
Chris@0 118 * Gets a SessionBagInterface by name.
Chris@0 119 *
Chris@0 120 * @param string $name
Chris@0 121 *
Chris@0 122 * @return SessionBagInterface
Chris@0 123 *
Chris@0 124 * @throws \InvalidArgumentException If the bag does not exist
Chris@0 125 */
Chris@0 126 public function getBag($name);
Chris@0 127
Chris@0 128 /**
Chris@0 129 * Registers a SessionBagInterface for use.
Chris@0 130 */
Chris@0 131 public function registerBag(SessionBagInterface $bag);
Chris@0 132
Chris@0 133 /**
Chris@0 134 * @return MetadataBag
Chris@0 135 */
Chris@0 136 public function getMetadataBag();
Chris@0 137 }