Session.php
181 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWPSCOPED\Illuminate\Contracts\Session; |
| 4 | |
| 5 | /** @internal */ |
| 6 | interface Session |
| 7 | { |
| 8 | /** |
| 9 | * Get the name of the session. |
| 10 | * |
| 11 | * @return string |
| 12 | */ |
| 13 | public function getName(); |
| 14 | /** |
| 15 | * Set the name of the session. |
| 16 | * |
| 17 | * @param string $name |
| 18 | * @return void |
| 19 | */ |
| 20 | public function setName($name); |
| 21 | /** |
| 22 | * Get the current session ID. |
| 23 | * |
| 24 | * @return string |
| 25 | */ |
| 26 | public function getId(); |
| 27 | /** |
| 28 | * Set the session ID. |
| 29 | * |
| 30 | * @param string $id |
| 31 | * @return void |
| 32 | */ |
| 33 | public function setId($id); |
| 34 | /** |
| 35 | * Start the session, reading the data from a handler. |
| 36 | * |
| 37 | * @return bool |
| 38 | */ |
| 39 | public function start(); |
| 40 | /** |
| 41 | * Save the session data to storage. |
| 42 | * |
| 43 | * @return void |
| 44 | */ |
| 45 | public function save(); |
| 46 | /** |
| 47 | * Get all of the session data. |
| 48 | * |
| 49 | * @return array |
| 50 | */ |
| 51 | public function all(); |
| 52 | /** |
| 53 | * Checks if a key exists. |
| 54 | * |
| 55 | * @param string|array $key |
| 56 | * @return bool |
| 57 | */ |
| 58 | public function exists($key); |
| 59 | /** |
| 60 | * Checks if a key is present and not null. |
| 61 | * |
| 62 | * @param string|array $key |
| 63 | * @return bool |
| 64 | */ |
| 65 | public function has($key); |
| 66 | /** |
| 67 | * Get an item from the session. |
| 68 | * |
| 69 | * @param string $key |
| 70 | * @param mixed $default |
| 71 | * @return mixed |
| 72 | */ |
| 73 | public function get($key, $default = null); |
| 74 | /** |
| 75 | * Get the value of a given key and then forget it. |
| 76 | * |
| 77 | * @param string $key |
| 78 | * @param mixed $default |
| 79 | * @return mixed |
| 80 | */ |
| 81 | public function pull($key, $default = null); |
| 82 | /** |
| 83 | * Put a key / value pair or array of key / value pairs in the session. |
| 84 | * |
| 85 | * @param string|array $key |
| 86 | * @param mixed $value |
| 87 | * @return void |
| 88 | */ |
| 89 | public function put($key, $value = null); |
| 90 | /** |
| 91 | * Get the CSRF token value. |
| 92 | * |
| 93 | * @return string |
| 94 | */ |
| 95 | public function token(); |
| 96 | /** |
| 97 | * Regenerate the CSRF token value. |
| 98 | * |
| 99 | * @return void |
| 100 | */ |
| 101 | public function regenerateToken(); |
| 102 | /** |
| 103 | * Remove an item from the session, returning its value. |
| 104 | * |
| 105 | * @param string $key |
| 106 | * @return mixed |
| 107 | */ |
| 108 | public function remove($key); |
| 109 | /** |
| 110 | * Remove one or many items from the session. |
| 111 | * |
| 112 | * @param string|array $keys |
| 113 | * @return void |
| 114 | */ |
| 115 | public function forget($keys); |
| 116 | /** |
| 117 | * Remove all of the items from the session. |
| 118 | * |
| 119 | * @return void |
| 120 | */ |
| 121 | public function flush(); |
| 122 | /** |
| 123 | * Flush the session data and regenerate the ID. |
| 124 | * |
| 125 | * @return bool |
| 126 | */ |
| 127 | public function invalidate(); |
| 128 | /** |
| 129 | * Generate a new session identifier. |
| 130 | * |
| 131 | * @param bool $destroy |
| 132 | * @return bool |
| 133 | */ |
| 134 | public function regenerate($destroy = \false); |
| 135 | /** |
| 136 | * Generate a new session ID for the session. |
| 137 | * |
| 138 | * @param bool $destroy |
| 139 | * @return bool |
| 140 | */ |
| 141 | public function migrate($destroy = \false); |
| 142 | /** |
| 143 | * Determine if the session has been started. |
| 144 | * |
| 145 | * @return bool |
| 146 | */ |
| 147 | public function isStarted(); |
| 148 | /** |
| 149 | * Get the previous URL from the session. |
| 150 | * |
| 151 | * @return string|null |
| 152 | */ |
| 153 | public function previousUrl(); |
| 154 | /** |
| 155 | * Set the "previous" URL in the session. |
| 156 | * |
| 157 | * @param string $url |
| 158 | * @return void |
| 159 | */ |
| 160 | public function setPreviousUrl($url); |
| 161 | /** |
| 162 | * Get the session handler instance. |
| 163 | * |
| 164 | * @return \SessionHandlerInterface |
| 165 | */ |
| 166 | public function getHandler(); |
| 167 | /** |
| 168 | * Determine if the session handler needs a request. |
| 169 | * |
| 170 | * @return bool |
| 171 | */ |
| 172 | public function handlerNeedsRequest(); |
| 173 | /** |
| 174 | * Set the request on the handler instance. |
| 175 | * |
| 176 | * @param \Illuminate\Http\Request $request |
| 177 | * @return void |
| 178 | */ |
| 179 | public function setRequestOnHandler($request); |
| 180 | } |
| 181 |