Refactor the view class.

This commit is contained in:
Taylor Otwell 2011-08-08 14:54:54 -05:00
parent 6ac1634fb5
commit 6278daca9c
1 changed files with 3 additions and 8 deletions

View File

@ -174,7 +174,7 @@ private function find_composer_function($composer)
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 @@ public function get()
// 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); }