refactoring for dependency injection.

This commit is contained in:
Taylor Otwell
2011-08-29 22:02:32 -05:00
parent 8229891d26
commit f113b5c829
11 changed files with 23 additions and 153 deletions

View File

@@ -2,15 +2,31 @@
class Redirect extends Response {
/**
* The URL generator instance.
*
* @var URL
*/
private $url;
/**
* The active session driver instance.
*
* @var Session\Driver
*/
private $session;
/**
* Create a new redirect generator instance.
*
* @param URL $url
* @param Session\Driver $session
* @param URL $url
* @return void
*/
public function __construct(URL $url)
public function __construct(Session\Driver $session, URL $url)
{
$this->url = $url;
$this->session = $session;
}
/**
@@ -62,7 +78,7 @@ class Redirect extends Response {
*/
public function with($key, $value)
{
IoC::container()->resolve('laravel.session.driver')->flash($key, $value);
$this->session->flash($key, $value);
return $this;
}