diff --git a/flight/View.php b/flight/View.php index 1a97103..3def506 100644 --- a/flight/View.php +++ b/flight/View.php @@ -22,16 +22,11 @@ class View { public function render($file, $data = null) { // Bind template data to view if (!is_null($data)) { - if (is_array($data)) { + if (is_array($data) || is_object($data)) { foreach ($data as $key => $value) { $this->{$key} = $value; } } - else if (is_object($data)) { - foreach (get_object_vars($data) as $key => $value) { - $this->{$key} = $value; - } - } } // Display template