cleaning up code and comments.

This commit is contained in:
Taylor Otwell 2012-04-05 21:40:56 -05:00
parent a77196db86
commit 825e8b2d49
3 changed files with 8 additions and 11 deletions

View File

@ -1,6 +1,4 @@
<?php namespace Laravel\Session\Drivers;
use Laravel\Crypter;
<?php namespace Laravel\Session\Drivers; use Laravel\Crypter, Laravel\Cookie as C;
class Cookie extends Driver {
@ -21,9 +19,9 @@ class Cookie extends Driver {
*/
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 @@ public function save($session, $config, $exists)
$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 @@ public function save($session, $config, $exists)
*/
public function delete($id)
{
\Laravel\Cookie::forget(Cookie::payload);
C::forget(Cookie::payload);
}
}

View File

@ -31,7 +31,7 @@ abstract public function save($session, $config, $exists);
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
*/

View File

@ -298,10 +298,9 @@ public function save()
// session on the user's subsequent requests to the application.
$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
// sweeper, we need to determine if garbage collection should be
// run for the request.
// sweeper, we'll calculate if we need to run garbage collection.
$sweepage = $config['sweepage'];
if ($this->driver instanceof Sweeper and (mt_rand(1, $sweepage[1]) <= $sweepage[0]))