cleaning up code and comments.
This commit is contained in:
@@ -1,6 +1,4 @@
|
|||||||
<?php namespace Laravel\Session\Drivers;
|
<?php namespace Laravel\Session\Drivers; use Laravel\Crypter, Laravel\Cookie as C;
|
||||||
|
|
||||||
use Laravel\Crypter;
|
|
||||||
|
|
||||||
class Cookie extends Driver {
|
class Cookie extends Driver {
|
||||||
|
|
||||||
@@ -21,9 +19,9 @@ class Cookie extends Driver {
|
|||||||
*/
|
*/
|
||||||
public function load($id)
|
public function load($id)
|
||||||
{
|
{
|
||||||
if (\Laravel\Cookie::has(Cookie::payload))
|
if (C::has(Cookie::payload))
|
||||||
{
|
{
|
||||||
return unserialize(Crypter::decrypt(\Laravel\Cookie::get(Cookie::payload)));
|
return unserialize(Crypter::decrypt(C::get(Cookie::payload)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +39,7 @@ class Cookie extends Driver {
|
|||||||
|
|
||||||
$payload = Crypter::encrypt(serialize($session));
|
$payload = Crypter::encrypt(serialize($session));
|
||||||
|
|
||||||
\Laravel\Cookie::put(Cookie::payload, $payload, $lifetime, $path, $domain);
|
C::put(Cookie::payload, $payload, $lifetime, $path, $domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,7 +50,7 @@ class Cookie extends Driver {
|
|||||||
*/
|
*/
|
||||||
public function delete($id)
|
public function delete($id)
|
||||||
{
|
{
|
||||||
\Laravel\Cookie::forget(Cookie::payload);
|
C::forget(Cookie::payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ abstract class Driver {
|
|||||||
abstract public function delete($id);
|
abstract public function delete($id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert a fresh session and return the payload array.
|
* Create a fresh session array with a unique ID.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -298,10 +298,9 @@ class Payload {
|
|||||||
// session on the user's subsequent requests to the application.
|
// session on the user's subsequent requests to the application.
|
||||||
$this->cookie($config);
|
$this->cookie($config);
|
||||||
|
|
||||||
// Some session drivers implement the Sweeper interface, meaning that
|
// Some session drivers implement the Sweeper interface meaning that
|
||||||
// they must clean up expired sessions manually. If the driver is a
|
// they must clean up expired sessions manually. If the driver is a
|
||||||
// sweeper, we need to determine if garbage collection should be
|
// sweeper, we'll calculate if we need to run garbage collection.
|
||||||
// run for the request.
|
|
||||||
$sweepage = $config['sweepage'];
|
$sweepage = $config['sweepage'];
|
||||||
|
|
||||||
if ($this->driver instanceof Sweeper and (mt_rand(1, $sweepage[1]) <= $sweepage[0]))
|
if ($this->driver instanceof Sweeper and (mt_rand(1, $sweepage[1]) <= $sweepage[0]))
|
||||||
|
|||||||
Reference in New Issue
Block a user