/** * Overload __get() to return the comments as an * HTML-formatted string * * @param string key */ public function __get($key) { if ($key == 'comment_list') { $return = '<ul>'; foreach (parent::__get('comments') as $comment) { $return .= '<li>' . $comment . '</li>'; } $return .= '</ul>' . PHP_EOL; return $return; } return parent::__get($key); }