Workaround for overloaded constructor in PHP
Given that php allows optional parameters and doesn't require type checking of parameters that are passed in, you can sort of "fake" an overloaded constructor.

something like this:

class CommentPanel extends Panel {
    public function __construct($text_or_comment, $username=null, $timestamp=null) {
        if (is_string($text_or_comment) {
            $this-&gt;textConstructor($text_or_comment, $username, $timestamp);
        }
        else { // assume that it's a comment since it's not a string ... there are better ways to handle this though
            $this-&gt;commentConstructor($text_or_comment);
        }
    }

    private function textConstructor($text, username, $timestampe) { /* . . . */ }
    private function commentConstructor(Comment $comment) { /* . . . */ }
}


This method will allow for a more consistent API and one that is perhaps more familiar to Java and C++ developers.

Also, I'm not positive which version of PHP you're targeting, but I believe in the current version, uses __construct instead of the class name as the constructor. I'm not sure if this is preferred but the documentation does say that it checks for __construct first and then the class name style constructor, so I would guess that using __construct() instead of CommentPanel() would reduce runtime ever so slightly. I'm not 100% sure on that though, that's just my understanding. Please correct me if I'm wrong :)