From fa3ec4d7960e298932beee86855d2981be2129cd Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 8 Aug 2011 10:13:22 -0500 Subject: [PATCH] Refactoring the view class. --- system/view.php | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/system/view.php b/system/view.php index 56e363e8..7f3193f5 100644 --- a/system/view.php +++ b/system/view.php @@ -115,10 +115,7 @@ class View { $path = ($module == 'application') ? VIEW_PATH : MODULE_PATH.$module.'/views/'; - if ($module != 'application') - { - $view = substr($view, strpos($view, ':') + 2); - } + if ($module != 'application') $view = substr($view, strpos($view, ':') + 2); return array($module, $path, $view); } @@ -162,7 +159,7 @@ class View { { if (is_callable($value)) return $value; } - } + } /** * Load the view composers for a given module. @@ -193,7 +190,10 @@ class View { throw new \Exception("View [$view] does not exist."); } - $this->get_sub_views(); + foreach ($this->data as &$data) + { + if ($data instanceof View or $data instanceof Response) $data = (string) $data; + } extract($this->data, EXTR_SKIP); @@ -204,22 +204,6 @@ class View { return ob_get_clean(); } - /** - * Evaluate all of the view and response instances that are bound to the view. - * - * @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. *