From 30514d9020eb3c3abccb214925340b1d33356bf9 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 31 Aug 2011 21:57:37 -0500 Subject: [PATCH] continued refactoring. --- laravel/cache/manager.php | 2 +- laravel/cache/memcached.php | 3 +-- laravel/request.php | 14 +++++++------- laravel/response.php | 28 ---------------------------- laravel/session/apc.php | 1 + laravel/session/manager.php | 6 +++--- laravel/view.php | 24 ------------------------ 7 files changed, 13 insertions(+), 65 deletions(-) diff --git a/laravel/cache/manager.php b/laravel/cache/manager.php index 3581dfef..a70cc3ed 100644 --- a/laravel/cache/manager.php +++ b/laravel/cache/manager.php @@ -52,7 +52,7 @@ public function driver($driver = null) if ( ! array_key_exists($driver, $this->drivers)) { - if ( ! in_array($driver, array('apc', 'file', 'memcached'))) + if ( ! $this->container->registered('laravel.cache.'.$driver)) { throw new \Exception("Cache driver [$driver] is not supported."); } diff --git a/laravel/cache/memcached.php b/laravel/cache/memcached.php index 158ca886..ae862ab8 100644 --- a/laravel/cache/memcached.php +++ b/laravel/cache/memcached.php @@ -1,6 +1,5 @@ key = $key; $this->memcache = $memcache; diff --git a/laravel/request.php b/laravel/request.php index 65daec37..21ce7b3a 100644 --- a/laravel/request.php +++ b/laravel/request.php @@ -9,13 +9,6 @@ class Request { */ public $server; - /** - * The $_POST array for the request. - * - * @var array - */ - private $post; - /** * The route handling the current request. * @@ -23,6 +16,13 @@ class Request { */ public $route; + /** + * The $_POST array for the request. + * + * @var array + */ + private $post; + /** * The base URL of the application. * diff --git a/laravel/response.php b/laravel/response.php index 46ade53f..7227433b 100644 --- a/laravel/response.php +++ b/laravel/response.php @@ -155,34 +155,6 @@ public function __construct($content, $status = 200, $headers = array()) $this->status = $status; } - /** - * Create a new response instance. - * - * @param mixed $content - * @param int $status - * @return Response - */ - public static function make($content, $status = 200) - { - return IoC::container()->resolve('laravel.response')->make($content, $status); - } - - /** - * Create a new error response instance. - * - * The response status code will be set using the specified code. - * - * Note: The specified error code should correspond to a view in your views/error directory. - * - * @param int $code - * @param array $data - * @return Response - */ - public static function error($code, $data = array()) - { - return IoC::container()->resolve('laravel.response')->error($code, $data); - } - /** * Get the evaluated string contents of the response. * diff --git a/laravel/session/apc.php b/laravel/session/apc.php index 24344abe..db996e28 100644 --- a/laravel/session/apc.php +++ b/laravel/session/apc.php @@ -20,6 +20,7 @@ class APC extends Driver { * Create a new APC session driver instance. * * @param Cache\APC $apc + * @param int $lifetime * @return void */ public function __construct(\Laravel\Cache\APC $apc, $lifetime) diff --git a/laravel/session/manager.php b/laravel/session/manager.php index 1faaf9ab..9c190b5b 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 (in_array($driver, array('cookie', 'file', 'database', 'apc', 'memcached'))) + if ( ! $this->container->registered('laravel.session.'.$driver)) { - return $this->container->resolve('laravel.session.'.$driver); + throw new \Exception("Session driver [$driver] is not supported."); } - throw new \Exception("Session driver [$driver] is not supported."); + return $this->container->resolve('laravel.session.'.$driver); } } \ No newline at end of file diff --git a/laravel/view.php b/laravel/view.php index 83429b9b..90278c1e 100644 --- a/laravel/view.php +++ b/laravel/view.php @@ -93,18 +93,6 @@ public function __construct($path, View_Composer $composer) $this->composer = $composer; } - /** - * Create a new view instance. - * - * @param string $view - * @param array $data - * @return View - */ - public function make($view, $data = array()) - { - return new View($view, $data, $this->path($view), $this->composer, $this); - } - /** * Create a new view instance from a view name. * @@ -212,18 +200,6 @@ public function __construct($view, $data, $path, View_Composer $composer, View_F } } - /** - * Create a new view instance. - * - * @param string $view - * @param array $data - * @return View - */ - public static function make($view, $data = array()) - { - return IoC::container()->resolve('laravel.view')->make($view, $data); - } - /** * Get the evaluated string content of the view. *