more dependency injection!

This commit is contained in:
Taylor Otwell
2011-08-31 00:07:45 -05:00
parent c200f3eb1e
commit c7ddbbb018
20 changed files with 118 additions and 223 deletions

View File

@@ -28,9 +28,9 @@ class Cookie extends Driver {
/**
* Create a new Cookie session driver instance.
*
* @param Crypter $crypter
* @param Crypter $crypter
* @param Laravel\Cookie $cookie
* @param array $config
* @param array $config
* @return void
*/
public function __construct(Crypter $crypter, \Laravel\Cookie $cookie, $config)

View File

@@ -1,7 +1,7 @@
<?php namespace Laravel\Session;
use Laravel\Str;
use Laravel\Input_Engine;
use Laravel\Input;
use Laravel\Cookie;
abstract class Driver {
@@ -67,11 +67,6 @@ abstract class Driver {
/**
* Determine if the session or flash data contains an item.
*
* <code>
* // Determine if "name" item exists in the session
* $exists = Session::driver()->has('name');
* </code>
*
* @param string $key
* @return bool
*/
@@ -86,14 +81,6 @@ abstract class Driver {
* A default value may also be specified, and will be returned in the requested
* item does not exist in the session.
*
* <code>
* // Get the "name" item from the session
* $name = Session::driver()->get('name');
*
* // Get the "name" item from the session or return "Fred"
* $name = Session::driver()->get('name', 'Fred');
* </code>
*
* @param string $key
* @param mixed $default
* @return mixed
@@ -111,11 +98,6 @@ abstract class Driver {
/**
* Write an item to the session.
*
* <code>
* // Write the "name" item to the session
* Session::driver()->put('name', 'Fred');
* </code>
*
* @param string $key
* @param mixed $value
* @return Driver
@@ -133,11 +115,6 @@ abstract class Driver {
* Flash data only exists for the next request. After that, it will be removed from
* the session. Flash data is useful for temporary status or welcome messages.
*
* <code>
* // Write the "name" item to the session flash data
* Session::driver()->flash('name', 'Fred');
* </code>
*
* @param string $key
* @param mixed $value
* @return Driver
@@ -152,11 +129,6 @@ abstract class Driver {
/**
* Remove an item from the session.
*
* <code>
* // Remove the "name" item from the session
* Session::driver()->forget('name');
* </code>
*
* @param string $key
* @return Driver
*/
@@ -196,11 +168,11 @@ abstract class Driver {
* The input of the current request will also be flashed to the session so it is
* available for the next request via the "old" method on the input class.
*
* @param Laravel\Input_Engine $input
* @param array $config
* @param Laravel\Input $input
* @param array $config
* @return void
*/
public function close(Input_Engine $input, $config)
public function close(Input $input, $config)
{
$this->flash('laravel_old_input', $input->get())->age();
@@ -259,11 +231,6 @@ abstract class Driver {
/**
* Magic Method for retrieving items from the session.
*
* <code>
* // Get the "name" item from the session
* $name = $application->session->name;
* </code>
*/
public function __get($key)
{
@@ -272,11 +239,6 @@ abstract class Driver {
/**
* Magic Method for writings items to the session.
*
* <code>
* // Write "Fred" to the session "name" item
* $application->session->name = 'Fred';
* </code>
*/
public function __set($key, $value)
{

View File

@@ -32,7 +32,7 @@ class Manager {
* @param string $driver
* @return Session\Driver
*/
public static function driver($driver)
public function driver($driver)
{
if (in_array($driver, array('cookie', 'file', 'database', 'apc', 'memcached')))
{