Attribute
2 years ago
Flash
2 years ago
Storage
2 years ago
Session.php
2 years ago
SessionBagInterface.php
2 years ago
SessionBagProxy.php
2 years ago
SessionInterface.php
2 years ago
SessionUtils.php
2 years ago
SessionInterface.php
184 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the Symfony package. |
| 5 | * |
| 6 | * (c) Fabien Potencier <fabien@symfony.com> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | * |
| 11 | * Modified by impress-org on 23-January-2024 using Strauss. |
| 12 | * @see https://github.com/BrianHenryIE/strauss |
| 13 | */ |
| 14 | |
| 15 | namespace Give\Vendors\Symfony\Component\HttpFoundation\Session; |
| 16 | |
| 17 | use Give\Vendors\Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; |
| 18 | |
| 19 | /** |
| 20 | * Interface for the session. |
| 21 | * |
| 22 | * @author Drak <drak@zikula.org> |
| 23 | */ |
| 24 | interface SessionInterface |
| 25 | { |
| 26 | /** |
| 27 | * Starts the session storage. |
| 28 | * |
| 29 | * @return bool True if session started |
| 30 | * |
| 31 | * @throws \RuntimeException if session fails to start |
| 32 | */ |
| 33 | public function start(); |
| 34 | |
| 35 | /** |
| 36 | * Returns the session ID. |
| 37 | * |
| 38 | * @return string The session ID |
| 39 | */ |
| 40 | public function getId(); |
| 41 | |
| 42 | /** |
| 43 | * Sets the session ID. |
| 44 | * |
| 45 | * @param string $id |
| 46 | */ |
| 47 | public function setId($id); |
| 48 | |
| 49 | /** |
| 50 | * Returns the session name. |
| 51 | * |
| 52 | * @return mixed The session name |
| 53 | */ |
| 54 | public function getName(); |
| 55 | |
| 56 | /** |
| 57 | * Sets the session name. |
| 58 | * |
| 59 | * @param string $name |
| 60 | */ |
| 61 | public function setName($name); |
| 62 | |
| 63 | /** |
| 64 | * Invalidates the current session. |
| 65 | * |
| 66 | * Clears all session attributes and flashes and regenerates the |
| 67 | * session and deletes the old session from persistence. |
| 68 | * |
| 69 | * @param int $lifetime Sets the cookie lifetime for the session cookie. A null value |
| 70 | * will leave the system settings unchanged, 0 sets the cookie |
| 71 | * to expire with browser session. Time is in seconds, and is |
| 72 | * not a Unix timestamp. |
| 73 | * |
| 74 | * @return bool True if session invalidated, false if error |
| 75 | */ |
| 76 | public function invalidate($lifetime = null); |
| 77 | |
| 78 | /** |
| 79 | * Migrates the current session to a new session id while maintaining all |
| 80 | * session attributes. |
| 81 | * |
| 82 | * @param bool $destroy Whether to delete the old session or leave it to garbage collection |
| 83 | * @param int $lifetime Sets the cookie lifetime for the session cookie. A null value |
| 84 | * will leave the system settings unchanged, 0 sets the cookie |
| 85 | * to expire with browser session. Time is in seconds, and is |
| 86 | * not a Unix timestamp. |
| 87 | * |
| 88 | * @return bool True if session migrated, false if error |
| 89 | */ |
| 90 | public function migrate($destroy = false, $lifetime = null); |
| 91 | |
| 92 | /** |
| 93 | * Force the session to be saved and closed. |
| 94 | * |
| 95 | * This method is generally not required for real sessions as |
| 96 | * the session will be automatically saved at the end of |
| 97 | * code execution. |
| 98 | */ |
| 99 | public function save(); |
| 100 | |
| 101 | /** |
| 102 | * Checks if an attribute is defined. |
| 103 | * |
| 104 | * @param string $name The attribute name |
| 105 | * |
| 106 | * @return bool true if the attribute is defined, false otherwise |
| 107 | */ |
| 108 | public function has($name); |
| 109 | |
| 110 | /** |
| 111 | * Returns an attribute. |
| 112 | * |
| 113 | * @param string $name The attribute name |
| 114 | * @param mixed $default The default value if not found |
| 115 | * |
| 116 | * @return mixed |
| 117 | */ |
| 118 | public function get($name, $default = null); |
| 119 | |
| 120 | /** |
| 121 | * Sets an attribute. |
| 122 | * |
| 123 | * @param string $name |
| 124 | * @param mixed $value |
| 125 | */ |
| 126 | public function set($name, $value); |
| 127 | |
| 128 | /** |
| 129 | * Returns attributes. |
| 130 | * |
| 131 | * @return array Attributes |
| 132 | */ |
| 133 | public function all(); |
| 134 | |
| 135 | /** |
| 136 | * Sets attributes. |
| 137 | * |
| 138 | * @param array $attributes Attributes |
| 139 | */ |
| 140 | public function replace(array $attributes); |
| 141 | |
| 142 | /** |
| 143 | * Removes an attribute. |
| 144 | * |
| 145 | * @param string $name |
| 146 | * |
| 147 | * @return mixed The removed value or null when it does not exist |
| 148 | */ |
| 149 | public function remove($name); |
| 150 | |
| 151 | /** |
| 152 | * Clears all attributes. |
| 153 | */ |
| 154 | public function clear(); |
| 155 | |
| 156 | /** |
| 157 | * Checks if the session was started. |
| 158 | * |
| 159 | * @return bool |
| 160 | */ |
| 161 | public function isStarted(); |
| 162 | |
| 163 | /** |
| 164 | * Registers a SessionBagInterface with the session. |
| 165 | */ |
| 166 | public function registerBag(SessionBagInterface $bag); |
| 167 | |
| 168 | /** |
| 169 | * Gets a bag instance by name. |
| 170 | * |
| 171 | * @param string $name |
| 172 | * |
| 173 | * @return SessionBagInterface |
| 174 | */ |
| 175 | public function getBag($name); |
| 176 | |
| 177 | /** |
| 178 | * Gets session meta. |
| 179 | * |
| 180 | * @return MetadataBag |
| 181 | */ |
| 182 | public function getMetadataBag(); |
| 183 | } |
| 184 |