Refactor the view class.
This commit is contained in:
parent
6f847732a4
commit
1e3188479a
|
@ -194,10 +194,7 @@ public function get()
|
||||||
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);
|
||||||
|
|
||||||
|
@ -208,6 +205,22 @@ public function get()
|
||||||
return ob_get_clean();
|
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.
|
* Add a view instance to the view data.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue