Skip to content

Commit

Permalink
added is_object check
Browse files Browse the repository at this point in the history
added a check to ensure that the $item was an object before checking if the method exists
  • Loading branch information
Conar Welsh committed Jul 26, 2013
1 parent e147909 commit fc7e365
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Conarwelsh/MustacheL4/MustacheEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function get($path, array $data = array())
$m = new Mustache_Engine( $app['config']->get('mustache-l4::config') );

$data = array_map(function($item){
return method_exists($item, 'toArray') ? $item->toArray() : $item;
return (is_object($item) && method_exists($item, 'toArray')) ? $item->toArray() : $item;
}, $data);

return $m->render($view, $data);
Expand Down

0 comments on commit fc7e365

Please sign in to comment.