final class Div implements HtmlWidgetInterface { private $_content; public function __construct($content) { if (!is_string($content) || empty($content)) { throw new HtmlWidgetException('Element must be a non-empty string.'); } $this->_content = $content; } public function getContent() { return $this->_content; } public function render() { return '<div>' . $this->_content . '</div>'; } }