Attribute
1 year ago
Flash
2 years ago
Storage
1 year ago
Session.php
1 year ago
SessionBagInterface.php
2 years ago
SessionBagProxy.php
1 year ago
SessionFactory.php
2 years ago
SessionFactoryInterface.php
2 years ago
SessionInterface.php
1 year ago
SessionUtils.php
1 year ago
SessionInterface.php
147 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 | namespace Matomo\Dependencies\Symfony\Component\HttpFoundation\Session; |
| 12 | |
| 13 | use Matomo\Dependencies\Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; |
| 14 | /** |
| 15 | * Interface for the session. |
| 16 | * |
| 17 | * @author Drak <drak@zikula.org> |
| 18 | */ |
| 19 | interface SessionInterface |
| 20 | { |
| 21 | /** |
| 22 | * Starts the session storage. |
| 23 | * |
| 24 | * @return bool |
| 25 | * |
| 26 | * @throws \RuntimeException if session fails to start |
| 27 | */ |
| 28 | public function start(); |
| 29 | /** |
| 30 | * Returns the session ID. |
| 31 | * |
| 32 | * @return string |
| 33 | */ |
| 34 | public function getId(); |
| 35 | /** |
| 36 | * Sets the session ID. |
| 37 | */ |
| 38 | public function setId(string $id); |
| 39 | /** |
| 40 | * Returns the session name. |
| 41 | * |
| 42 | * @return string |
| 43 | */ |
| 44 | public function getName(); |
| 45 | /** |
| 46 | * Sets the session name. |
| 47 | */ |
| 48 | public function setName(string $name); |
| 49 | /** |
| 50 | * Invalidates the current session. |
| 51 | * |
| 52 | * Clears all session attributes and flashes and regenerates the |
| 53 | * session and deletes the old session from persistence. |
| 54 | * |
| 55 | * @param int|null $lifetime Sets the cookie lifetime for the session cookie. A null value |
| 56 | * will leave the system settings unchanged, 0 sets the cookie |
| 57 | * to expire with browser session. Time is in seconds, and is |
| 58 | * not a Unix timestamp. |
| 59 | * |
| 60 | * @return bool |
| 61 | */ |
| 62 | public function invalidate(?int $lifetime = null); |
| 63 | /** |
| 64 | * Migrates the current session to a new session id while maintaining all |
| 65 | * session attributes. |
| 66 | * |
| 67 | * @param bool $destroy Whether to delete the old session or leave it to garbage collection |
| 68 | * @param int|null $lifetime Sets the cookie lifetime for the session cookie. A null value |
| 69 | * will leave the system settings unchanged, 0 sets the cookie |
| 70 | * to expire with browser session. Time is in seconds, and is |
| 71 | * not a Unix timestamp. |
| 72 | * |
| 73 | * @return bool |
| 74 | */ |
| 75 | public function migrate(bool $destroy = \false, ?int $lifetime = null); |
| 76 | /** |
| 77 | * Force the session to be saved and closed. |
| 78 | * |
| 79 | * This method is generally not required for real sessions as |
| 80 | * the session will be automatically saved at the end of |
| 81 | * code execution. |
| 82 | */ |
| 83 | public function save(); |
| 84 | /** |
| 85 | * Checks if an attribute is defined. |
| 86 | * |
| 87 | * @return bool |
| 88 | */ |
| 89 | public function has(string $name); |
| 90 | /** |
| 91 | * Returns an attribute. |
| 92 | * |
| 93 | * @param mixed $default The default value if not found |
| 94 | * |
| 95 | * @return mixed |
| 96 | */ |
| 97 | public function get(string $name, $default = null); |
| 98 | /** |
| 99 | * Sets an attribute. |
| 100 | * |
| 101 | * @param mixed $value |
| 102 | */ |
| 103 | public function set(string $name, $value); |
| 104 | /** |
| 105 | * Returns attributes. |
| 106 | * |
| 107 | * @return array |
| 108 | */ |
| 109 | public function all(); |
| 110 | /** |
| 111 | * Sets attributes. |
| 112 | */ |
| 113 | public function replace(array $attributes); |
| 114 | /** |
| 115 | * Removes an attribute. |
| 116 | * |
| 117 | * @return mixed The removed value or null when it does not exist |
| 118 | */ |
| 119 | public function remove(string $name); |
| 120 | /** |
| 121 | * Clears all attributes. |
| 122 | */ |
| 123 | public function clear(); |
| 124 | /** |
| 125 | * Checks if the session was started. |
| 126 | * |
| 127 | * @return bool |
| 128 | */ |
| 129 | public function isStarted(); |
| 130 | /** |
| 131 | * Registers a SessionBagInterface with the session. |
| 132 | */ |
| 133 | public function registerBag(SessionBagInterface $bag); |
| 134 | /** |
| 135 | * Gets a bag instance by name. |
| 136 | * |
| 137 | * @return SessionBagInterface |
| 138 | */ |
| 139 | public function getBag(string $name); |
| 140 | /** |
| 141 | * Gets session meta. |
| 142 | * |
| 143 | * @return MetadataBag |
| 144 | */ |
| 145 | public function getMetadataBag(); |
| 146 | } |
| 147 |