Commit 1e318847 by Taylor Otwell

Refactor the view class.

parent 6f847732
...@@ -194,10 +194,7 @@ class View { ...@@ -194,10 +194,7 @@ class View {
throw new \Exception("View [$view] does not exist."); throw new \Exception("View [$view] does not exist.");
} }
foreach ($this->data as &$data) $this->get_sub_views();
{
if ($data instanceof View or $data instanceof Response) $data = (string) $data;
}
extract($this->data, EXTR_SKIP); extract($this->data, EXTR_SKIP);
...@@ -209,6 +206,22 @@ class View { ...@@ -209,6 +206,22 @@ class View {
} }
/** /**
* 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. * Add a view instance to the view data.
* *
* @param string $key * @param string $key
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment