From 6becbaba5193e14142bb940ff6d59aa91309736e Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 14 Sep 2011 20:49:38 -0500 Subject: [PATCH] more session refactoring. --- application/config/database.php | 4 ++-- laravel/session/drivers/driver.php | 26 +++++++++++++------------- laravel/session/manager.php | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/application/config/database.php b/application/config/database.php index b1eede3d..f46d67fb 100644 --- a/application/config/database.php +++ b/application/config/database.php @@ -47,12 +47,12 @@ 'mysql' => function($config) { - return new PDO('mysql:host=localhost;dbname=database', 'username', 'password', $config['options']); + return new PDO('mysql:host=localhost;dbname=database', 'root', 'password', $config['options']); }, 'pgsql' => function($config) { - return new PDO('pgsql:host=localhost;dbname=database', 'username', 'password', $config['options']); + return new PDO('pgsql:host=localhost;dbname=database', 'root', 'password', $config['options']); }, ), diff --git a/laravel/session/drivers/driver.php b/laravel/session/drivers/driver.php index 61500336..b2cde8d8 100644 --- a/laravel/session/drivers/driver.php +++ b/laravel/session/drivers/driver.php @@ -210,6 +210,19 @@ public final function regenerate() $this->session['id'] = Str::random(40); } + /** + * Readdress the session data by performing a string replacement on the keys. + * + * @param string $search + * @param string $replace + * @param array $keys + * @return void + */ + private function readdress($search, $replace, $keys) + { + $this->session['data'] = array_combine(str_replace($search, $replace, $keys), array_values($this->session['data'])); + } + /** * Close the session and store the session payload in persistant storage. * @@ -256,19 +269,6 @@ private function age() $this->readdress(':new:', ':old:', array_keys($this->session['data'])); } - /** - * Readdress the session data by performing a string replacement on the keys. - * - * @param string $search - * @param string $replace - * @param array $keys - * @return void - */ - private function readdress($search, $replace, $keys) - { - $this->session['data'] = array_combine(str_replace($search, $replace, $keys), array_values($this->session['data'])); - } - /** * Write the session cookie. * diff --git a/laravel/session/manager.php b/laravel/session/manager.php index 9c190b5b..619f59e2 100644 --- a/laravel/session/manager.php +++ b/laravel/session/manager.php @@ -34,12 +34,12 @@ public function __construct(Container $container) */ public function driver($driver) { - if ( ! $this->container->registered('laravel.session.'.$driver)) + if ($this->container->registered('laravel.session.'.$driver)) { - throw new \Exception("Session driver [$driver] is not supported."); + return $this->container->resolve('laravel.session.'.$driver); } - return $this->container->resolve('laravel.session.'.$driver); + throw new \Exception("Session driver [$driver] is not supported."); } } \ No newline at end of file