continued refactoring of view classes.

This commit is contained in:
Taylor Otwell 2011-08-29 19:27:02 -05:00
parent 15cde60794
commit 8229891d26
5 changed files with 43 additions and 11 deletions

View File

@ -37,9 +37,9 @@
|
*/
'GET /' => function($application)
'GET /' => function($laravel)
{
return $application->view->make('home.index');
return $laravel->view->make('home.index');
},
);

View File

@ -81,7 +81,7 @@
<h2><?php echo $apology; ?></h2>
<p>We couldn't find the resource you requested. Would you like go to our <a href="<?php echo Laravel\Config::get('application.url'); ?>">home page</a> instead?</p>
<p>We couldn't find the resource you requested. Would you like go to our <a href="<?php echo $homepage; ?>">home page</a> instead?</p>
</div>
</body>
</html>

View File

@ -2,6 +2,13 @@
class Download extends Response {
/**
* The file manager instance.
*
* @var File
*/
protected $file;
/**
* Create a new download generator instance.
*

View File

@ -57,6 +57,8 @@ public function view($view, $data = array())
*/
public function error($code, $data = array())
{
$data['homepage'] = IoC::resolve('laravel.config')->get('application.url');
return new Response($this->view->make('error/'.$code, $data), $code);
}
@ -221,4 +223,14 @@ public function status($status)
return $this;
}
/**
* Magic Method for passing undefined static methods to the Response_Factory instance
* registered in the application IoC container. This provides easy access to the
* response functions while still maintaining testability within the classes.
*/
public static function __callStatic($method, $parameters)
{
return call_user_func_array(array(IoC::container()->resolve('laravel.response'), $method), $parameters);
}
}

View File

@ -8,6 +8,13 @@
*/
class View_Composer {
/**
* The view composers.
*
* @var array
*/
protected $composers;
/**
* Create a new view composer instance.
*
@ -59,6 +66,20 @@ public function compose(View $view)
*/
class View_Factory {
/**
* The directory containing the views.
*
* @var string
*/
protected $path;
/**
* The view composer instance.
*
* @var View_Composer
*/
protected $composer;
/**
* Create a new view factory instance.
*
@ -114,14 +135,6 @@ protected function path($view)
/**
* Magic Method for handling the dynamic creation of named views.
*
* <code>
* // Create an instance of the "login" named view
* $view = View::of_login();
*
* // Create an instance of the "login" named view and bind data to the view
* $view = View::of_login(array('name' => 'Fred'));
* </code>
*/
public function __call($method, $parameters)
{