more session refactoring.

This commit is contained in:
Taylor Otwell 2011-09-14 20:49:38 -05:00
parent ae5393f5a7
commit 6becbaba51
3 changed files with 18 additions and 18 deletions

View File

@ -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']);
},
),

View File

@ -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.
*

View File

@ -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.");
}
}