. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Report; /** * Class ReportBaseHtml */ class ReportBaseHtml extends ReportBaseElement { /** @var string The XML tag. */ public $tag; /** @var string[] Attributes of the XML tag. */ public $attrs; /** @var ReportBaseElement[] A list of elements. */ public $elements = []; /** * Create an element. * * @param string $tag * @param string[] $attrs */ public function __construct(string $tag, array $attrs) { $this->tag = $tag; $this->attrs = $attrs; } /** * Get the start tag. * * @return string */ public function getStart(): string { $str = '<' . $this->tag . ' '; foreach ($this->attrs as $key => $value) { $str .= $key . '="' . $value . '" '; } $str .= '>'; return $str; } /** * Get the end tag. * * @return string */ public function getEnd(): string { return 'tag . '>'; } /** * Add an element. * * @param ReportBaseElement $element * * @return void */ public function addElement($element) { $this->elements[] = $element; } }