-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor session away from Symfony's interface.
Session does not implement Symfony's SessionInterface any longer. That caused us to have to implement a bunch of logic around "Bags" which we never actually used in order to just support the interface. Instead there is a new Illuminate\Contracts\Session\Session contract to define our own interface for session handling, which allows us to slim the session store down to what Laravel actually provides instead of having to satisfy Symfony requirements. Legacy method changes: ->set() should be changed to ->put() ->getToken() should be ->token() Any type hints of Symfony session interface should be changed to new Illuminate\Contracts\Session\Session contract.
- Loading branch information
1 parent
7103b5b
commit 66976ba
Showing
13 changed files
with
379 additions
and
374 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
<?php | ||
|
||
namespace Illuminate\Contracts\Session; | ||
|
||
interface Session | ||
{ | ||
/** | ||
* Get the name of the session. | ||
* | ||
* @return string | ||
*/ | ||
public function getName(); | ||
|
||
/** | ||
* Get the current session ID. | ||
* | ||
* @return string | ||
*/ | ||
public function getId(); | ||
|
||
/** | ||
* Set the session ID. | ||
* | ||
* @param string $id | ||
* @return void | ||
*/ | ||
public function setId($id); | ||
|
||
/** | ||
* Start the session, reading the data from a handler. | ||
* | ||
* @return bool | ||
*/ | ||
public function start(); | ||
|
||
/** | ||
* Save the session data to storage. | ||
* | ||
* @return bool | ||
*/ | ||
public function save(); | ||
|
||
/** | ||
* Get all of the session data. | ||
* | ||
* @return array | ||
*/ | ||
public function all(); | ||
|
||
/** | ||
* Checks if a key exists. | ||
* | ||
* @param string|array $key | ||
* @return bool | ||
*/ | ||
public function exists($key); | ||
|
||
/** | ||
* Checks if an a key is present and not null. | ||
* | ||
* @param string|array $key | ||
* @return bool | ||
*/ | ||
public function has($key); | ||
|
||
/** | ||
* Get an item from the session. | ||
* | ||
* @param string $key | ||
* @param mixed $default | ||
* @return void | ||
*/ | ||
public function get($key, $default = null); | ||
|
||
/** | ||
* Put a key / value pair or array of key / value pairs in the session. | ||
* | ||
* @param string|array $key | ||
* @param mixed $value | ||
* @return void | ||
*/ | ||
public function put($key, $value = null); | ||
|
||
/** | ||
* Get the CSRF token value. | ||
* | ||
* @return string | ||
*/ | ||
public function token(); | ||
|
||
/** | ||
* Remove an item from the session, returning its value. | ||
* | ||
* @param string $key | ||
* @return mixed | ||
*/ | ||
public function remove($key); | ||
|
||
/** | ||
* Remove one or many items from the session. | ||
* | ||
* @param string|array $keys | ||
* @return void | ||
*/ | ||
public function forget($keys); | ||
|
||
/** | ||
* Remove all of the items from the session. | ||
* | ||
* @return void | ||
*/ | ||
public function flush(); | ||
|
||
/** | ||
* Generate a new session ID for the session. | ||
* | ||
* @param bool $destroy | ||
* @return bool | ||
*/ | ||
public function migrate($destroy = false); | ||
|
||
/** | ||
* Determine if the session has been started. | ||
* | ||
* @return bool | ||
*/ | ||
public function isStarted(); | ||
|
||
/** | ||
* Get the previous URL from the session. | ||
* | ||
* @return string|null | ||
*/ | ||
public function previousUrl(); | ||
|
||
/** | ||
* Set the "previous" URL in the session. | ||
* | ||
* @param string $url | ||
* @return void | ||
*/ | ||
public function setPreviousUrl($url); | ||
|
||
/** | ||
* Get the session handler instance. | ||
* | ||
* @return \SessionHandlerInterface | ||
*/ | ||
public function getHandler(); | ||
|
||
/** | ||
* Determine if the session handler needs a request. | ||
* | ||
* @return bool | ||
*/ | ||
public function handlerNeedsRequest(); | ||
|
||
/** | ||
* Set the request on the handler instance. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return void | ||
*/ | ||
public function setRequestOnHandler($request); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.