Refactor and comment the view class.
This commit is contained in:
parent
1e3188479a
commit
6ac1634fb5
|
|
@ -194,7 +194,15 @@ public function get()
|
|||
throw new \Exception("View [$view] does not exist.");
|
||||
}
|
||||
|
||||
$this->get_sub_views();
|
||||
// Before rendering the view, we need to spin through all of the bound data and
|
||||
// evaluate any sub-views or responses that are present.
|
||||
foreach ($this->data as &$data)
|
||||
{
|
||||
if ($data instanceof View or $data instanceof Response)
|
||||
{
|
||||
$data = (string) $data;
|
||||
}
|
||||
}
|
||||
|
||||
extract($this->data, EXTR_SKIP);
|
||||
|
||||
|
|
@ -205,22 +213,6 @@ public function get()
|
|||
return ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluate the content of all bound sub-views and responses.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function get_sub_views()
|
||||
{
|
||||
foreach ($this->data as &$data)
|
||||
{
|
||||
if ($data instanceof View or $data instanceof Response)
|
||||
{
|
||||
$data = (string) $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a view instance to the view data.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue