Commit 6278daca authored by Taylor Otwell's avatar Taylor Otwell

Refactor the view class.

parent 6ac1634f
...@@ -174,7 +174,7 @@ class View { ...@@ -174,7 +174,7 @@ class View {
if (is_callable($composer)) return $composer; if (is_callable($composer)) return $composer;
foreach ($composer as $value) foreach ($composer as $key => $value)
{ {
if (is_callable($value)) return $value; if (is_callable($value)) return $value;
} }
...@@ -198,15 +198,10 @@ class View { ...@@ -198,15 +198,10 @@ class View {
// evaluate any sub-views or responses that are present. // evaluate any sub-views or responses that are present.
foreach ($this->data as &$data) foreach ($this->data as &$data)
{ {
if ($data instanceof View or $data instanceof Response) if ($data instanceof View or $data instanceof Response) $data = (string) $data;
{
$data = (string) $data;
}
} }
extract($this->data, EXTR_SKIP); ob_start() and extract($this->data, EXTR_SKIP);
ob_start();
try { include $this->path.$view.EXT; } catch (\Exception $e) { Error::handle($e); } try { include $this->path.$view.EXT; } catch (\Exception $e) { Error::handle($e); }
......
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