30 lines
439 B
PHP
30 lines
439 B
PHP
|
<?php
|
||
|
|
||
|
/**
|
||
|
* A reusable page element.
|
||
|
*/
|
||
|
interface Widget {
|
||
|
/**
|
||
|
* Render HTML code for this widget.
|
||
|
*/
|
||
|
public function html() : string;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* A widget that can contain other widgets.
|
||
|
*/
|
||
|
interface Container extends Widget {
|
||
|
|
||
|
/**
|
||
|
* Add a child to this widget.
|
||
|
*/
|
||
|
public function add(Widget $widget) : Container;
|
||
|
|
||
|
/**
|
||
|
* Remove a child from this widget.
|
||
|
*/
|
||
|
public function remove(Widget $widget) : Container;
|
||
|
|
||
|
}
|
||
|
?>
|