refactoring routing and class comments.

This commit is contained in:
Taylor Otwell
2011-10-13 21:32:11 -05:00
parent cff90b52ab
commit 9fa69e0844
27 changed files with 465 additions and 435 deletions

View File

@@ -101,7 +101,7 @@ class Database implements Driver, Sweeper {
*/
private function table()
{
return $this->connection->table(Config::get('session.table'));
return $this->connection->table(Config::$items['session']['table']);
}
}

View File

@@ -1,7 +1,5 @@
<?php namespace Laravel\Session\Drivers;
use Laravel\File as F;
class File implements Driver, Sweeper {
/**
@@ -32,7 +30,10 @@ class File implements Driver, Sweeper {
*/
public function load($id)
{
if (F::exists($path = $this->path.$id)) return unserialize(F::get($path));
if (file_exists($path = $this->path.$id))
{
return unserialize(file_get_contents($path));
}
}
/**
@@ -45,7 +46,7 @@ class File implements Driver, Sweeper {
*/
public function save($session, $config, $exists)
{
F::put($this->path.$session['id'], serialize($session), LOCK_EX);
file_put_contents($this->path.$session['id'], serialize($session), LOCK_EX);
}
/**
@@ -56,7 +57,7 @@ class File implements Driver, Sweeper {
*/
public function delete($id)
{
F::delete($this->path.$id);
if (file_exists($this->path.$id)) @unlink($this->path.$id);
}
/**
@@ -69,9 +70,9 @@ class File implements Driver, Sweeper {
{
foreach (glob($this->path.'*') as $file)
{
if (F::type($file) == 'file' and F::modified($file) < $expiration)
if (filetype($file) == 'file' and filemtime($file) < $expiration)
{
F::delete($file);
@unlink($file);
}
}
}

View File

@@ -168,7 +168,10 @@ class Manager {
*/
public static function keep($key)
{
if (is_array($key)) return array_map(array('Laravel\\Session\\Manager', 'keep'), $key);
if (is_array($key))
{
return array_map(array('Laravel\\Session\\Manager', 'keep'), $key);
}
static::flash($key, static::get($key));
@@ -242,7 +245,9 @@ class Manager {
*/
protected static function replace($search, $replace, $keys)
{
static::$session['data'] = array_combine(str_replace($search, $replace, $keys), array_values(static::$session['data']));
$keys = str_replace($search, $replace, $keys);
static::$session['data'] = array_combine($keys, array_values(static::$session['data']));
}
/**

View File

@@ -29,9 +29,9 @@ class Cookie implements Transporter {
*/
public function put($id, $config)
{
// Session cookies may be set to expire on close, which means we
// will need to pass "0" into the cookie manager. This will cause
// the cookie to not be deleted until the user closes their browser.
// Session cookies may be set to expire on close, which means we will
// need to pass "0" into the cookie manager. This will cause the
// cookie to not be deleted until the user closes their browser.
$minutes = ( ! $config['expire_on_close']) ? $config['lifetime'] : 0;
\Laravel\Cookie::put(Cookie::key, $id, $minutes, $config['path'], $config['domain'], $config['secure']);