. */ namespace Fisharebest\Webtrees\Report; /** * Class ReportBaseElement */ class ReportBaseElement { /** @var string Text */ public $text = ''; /** * Element renderer * * @param ReportHtml|ReportTcpdf $renderer * * @return void */ public function render($renderer) { //-- to be implemented in inherited classes } /** * Get the height. * * @param ReportHtml|ReportTcpdf $renderer * * @return float */ public function getHeight($renderer): float { return 0.0; } /** * Get the width. * * @param ReportHtml|ReportTcpdf $renderer * * @return float|array */ public function getWidth($renderer) { return 0.0; } /** * Add text. * * @param string $t * * @return void */ public function addText(string $t) { $t = trim($t, "\r\n\t"); $t = str_replace([ '
', ' ', ], [ "\n", ' ', ], $t); $t = strip_tags($t); $t = htmlspecialchars_decode($t); $this->text .= $t; } /** * Add an end-of-line. * * @return int */ public function addNewline(): int { $this->text .= "\n"; return 0; } /** * Get the current text. * * @return string */ public function getValue(): string { return $this->text; } /** * Set the width to wrap text. * * @param $wrapwidth * @param $cellwidth * * @return int */ public function setWrapWidth($wrapwidth, $cellwidth): int { return 0; } /** * Render the footnotes. * * @param $renderer * * @return void */ public function renderFootnote($renderer) { } /** * Set the text. * * @param $text * * @return void */ public function setText($text) { $this->text = $text; } }