From 76a5bc483a916d4b2d20382920b6c03728a39ca6 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sat, 15 Oct 2011 14:39:52 -0500 Subject: [PATCH] refactoring various classes. --- laravel/cookie.php | 4 +++- laravel/laravel.php | 14 +------------- laravel/routing/controller.php | 2 +- laravel/session/drivers/apc.php | 4 ---- laravel/session/drivers/file.php | 5 ++++- laravel/session/transporters/cookie.php | 9 ++++----- 6 files changed, 13 insertions(+), 25 deletions(-) diff --git a/laravel/cookie.php b/laravel/cookie.php index 8e370ec4..2bf806b6 100644 --- a/laravel/cookie.php +++ b/laravel/cookie.php @@ -92,7 +92,9 @@ public static function put($name, $value, $minutes = 0, $path = '/', $domain = n $time = ($minutes !== 0) ? time() + ($minutes * 60) : 0; - return setcookie($name, static::hash($name, $value).'~'.$value, $time, $path, $domain, $secure, $http_only); + $value = static::hash($name, $value).'~'.$value; + + return setcookie($name, $value, $time, $path, $domain, $secure, $http_only); } /** diff --git a/laravel/laravel.php b/laravel/laravel.php index c7a99112..8128e609 100644 --- a/laravel/laravel.php +++ b/laravel/laravel.php @@ -101,16 +101,6 @@ $response = Response::error('404'); } -if ($response instanceof Routing\Delegate) -{ - $response = Routing\Controller::call($response, $route->parameters); -} - -if ( ! $response instanceof Response) -{ - $response = new Response($response); -} - /** * Stringify the response. We need to force the response to be * stringed before closing the session, since the developer may @@ -127,9 +117,7 @@ */ if (Config::$items['session']['driver'] !== '') { - $flash = array(Input::old_input => Input::get()); - - Session\Manager::close($flash); + Session\Manager::close(array(Input::old_input => Input::get())); } /** diff --git a/laravel/routing/controller.php b/laravel/routing/controller.php index ac24aa7c..96a5afd5 100644 --- a/laravel/routing/controller.php +++ b/laravel/routing/controller.php @@ -32,7 +32,7 @@ abstract class Controller { * @param array $parameters * @return mixed */ - public static function call($destination, $parameters) + public static function call($destination, $parameters = array()) { if (strpos($destination, '@') === false) { diff --git a/laravel/session/drivers/apc.php b/laravel/session/drivers/apc.php index 8c70aaf1..61f7bcff 100644 --- a/laravel/session/drivers/apc.php +++ b/laravel/session/drivers/apc.php @@ -5,10 +5,6 @@ class APC implements Driver { /** * The APC cache driver instance. * - * This session driver relies on the APC cache driver to provide an interface for - * working with an APC equipped server. The cache driver will provide all of the - * functionality for retrieving and storing items in APC. - * * @var Cache\Drivers\APC */ private $apc; diff --git a/laravel/session/drivers/file.php b/laravel/session/drivers/file.php index 19382e32..a0892d0d 100644 --- a/laravel/session/drivers/file.php +++ b/laravel/session/drivers/file.php @@ -57,7 +57,10 @@ public function save($session, $config, $exists) */ public function delete($id) { - if (file_exists($this->path.$id)) @unlink($this->path.$id); + if (file_exists($this->path.$id)) + { + @unlink($this->path.$id); + } } /** diff --git a/laravel/session/transporters/cookie.php b/laravel/session/transporters/cookie.php index 9f58c378..fc10ada0 100644 --- a/laravel/session/transporters/cookie.php +++ b/laravel/session/transporters/cookie.php @@ -29,12 +29,11 @@ public function get($config) */ 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. - $minutes = ( ! $config['expire_on_close']) ? $config['lifetime'] : 0; + extract($config, EXTR_SKIP); - \Laravel\Cookie::put(Cookie::key, $id, $minutes, $config['path'], $config['domain'], $config['secure']); + $minutes = ( ! $expire_on_close) ? $lifetime : 0; + + \Laravel\Cookie::put(Cookie::key, $id, $minutes, $path, $domain, $secure); } } \ No newline at end of file