diff options
54 files changed, 1348 insertions, 1239 deletions
diff --git a/app/Http/RequestHandlers/ReportGenerate.php b/app/Http/RequestHandlers/ReportGenerate.php index 05d9c82d62..eae61fb344 100644 --- a/app/Http/RequestHandlers/ReportGenerate.php +++ b/app/Http/RequestHandlers/ReportGenerate.php @@ -25,9 +25,9 @@ use Fisharebest\Webtrees\Contracts\UserInterface; use Fisharebest\Webtrees\Http\ViewResponseTrait; use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Module\ModuleReportInterface; -use Fisharebest\Webtrees\Report\ReportHtml; +use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; -use Fisharebest\Webtrees\Report\ReportPdf; +use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Tree; use League\Flysystem\FilesystemInterface; @@ -111,7 +111,7 @@ class ReportGenerate implements RequestHandlerInterface default: case 'HTML': ob_start(); - new ReportParserGenerate($xml_filename, new ReportHtml(), $variables, $tree, $data_filesystem); + new ReportParserGenerate($xml_filename, new HtmlRenderer(), $variables, $tree, $data_filesystem); $html = ob_get_clean(); $this->layout = 'layouts/report'; @@ -142,7 +142,7 @@ class ReportGenerate implements RequestHandlerInterface } ob_start(); - new ReportParserGenerate($xml_filename, new ReportPdf(), $variables, $tree, $data_filesystem); + new ReportParserGenerate($xml_filename, new PdfRenderer(), $variables, $tree, $data_filesystem); $pdf = ob_get_clean(); $headers = ['Content-Type' => 'application/pdf']; diff --git a/app/Report/AbstractReport.php b/app/Report/AbstractRenderer.php index cd4c78d27b..414290b4d6 100644 --- a/app/Report/AbstractReport.php +++ b/app/Report/AbstractRenderer.php @@ -24,10 +24,12 @@ use Fisharebest\Webtrees\MediaFile; use Fisharebest\Webtrees\Webtrees; use League\Flysystem\FilesystemInterface; +use function current; + /** - * Class AbstractReport - base for PDF and HTML reports + * Class AbstractRenderer - base for PDF and HTML reports */ -abstract class AbstractReport +abstract class AbstractRenderer { // Reports layouts are measured in points. protected const UNITS = 'pt'; @@ -49,8 +51,6 @@ abstract class AbstractReport 'US-Tabloid' => [11.0 * self::INCH_TO_POINTS, 17.0 * self::INCH_TO_POINTS], ]; - protected const DEFAULT_PAPER_SIZE = 'A4'; - /** @var float Left Margin */ public $left_margin = 18.0 * self::MM_TO_POINTS; @@ -119,14 +119,14 @@ abstract class AbstractReport * * @return void */ - abstract public function clearHeader(); + abstract public function clearHeader(): void; /** * Create a new Page Header object * - * @return ReportBasePageheader + * @return ReportBasePageHeader */ - abstract public function createPageHeader(): ReportBasePageheader; + abstract public function createPageHeader(): ReportBasePageHeader; /** * Add an element. @@ -135,14 +135,14 @@ abstract class AbstractReport * * @return void */ - abstract public function addElement($element); + abstract public function addElement($element): void; /** * Run the report. * * @return void */ - abstract public function run(); + abstract public function run(): void; /** * Create a new Cell object. @@ -307,7 +307,7 @@ abstract class AbstractReport * * @return void */ - public function setProcessing(string $p) + public function setProcessing(string $p): void { $this->processing = $p; } @@ -319,7 +319,7 @@ abstract class AbstractReport * * @return void */ - public function addTitle(string $data) + public function addTitle(string $data): void { $this->title .= $data; } @@ -331,7 +331,7 @@ abstract class AbstractReport * * @return void */ - public function addDescription(string $data) + public function addDescription(string $data): void { $this->rsubject .= $data; } @@ -343,7 +343,7 @@ abstract class AbstractReport * * @return void */ - public function addStyle(array $style) + public function addStyle(array $style): void { $this->styles[$style['name']] = $style; } diff --git a/app/Report/ReportHtml.php b/app/Report/HtmlRenderer.php index 884726c11e..6987c812a2 100644 --- a/app/Report/ReportHtml.php +++ b/app/Report/HtmlRenderer.php @@ -25,10 +25,18 @@ use Fisharebest\Webtrees\MediaFile; use Fisharebest\Webtrees\Webtrees; use League\Flysystem\FilesystemInterface; +use function ceil; +use function count; +use function explode; +use function preg_match; +use function str_replace; +use function stripos; +use function substr_count; + /** - * Class ReportHtml + * Class HtmlRenderer */ -class ReportHtml extends AbstractReport +class HtmlRenderer extends AbstractRenderer { /** * Cell padding @@ -178,7 +186,7 @@ class ReportHtml extends AbstractReport * * @return void */ - public function addElement($element) + public function addElement($element): void { if ($this->processing === 'B') { $this->bodyElements[] = $element; @@ -194,7 +202,7 @@ class ReportHtml extends AbstractReport * * @return void */ - private function runPageHeader() + private function runPageHeader(): void { foreach ($this->pageHeaderElements as $element) { if ($element instanceof ReportBaseElement) { @@ -212,7 +220,7 @@ class ReportHtml extends AbstractReport * * @return void */ - public function footnotes() + public function footnotes(): void { $this->currentStyle = ''; if (!empty($this->printedfootnotes)) { @@ -227,7 +235,7 @@ class ReportHtml extends AbstractReport * * @return void */ - public function run() + public function run(): void { // Setting up the styles echo '<style type="text/css">'; @@ -254,7 +262,7 @@ class ReportHtml extends AbstractReport } echo '}', PHP_EOL; } - unset($class, $style); + //-- header divider echo '</style>', PHP_EOL; echo '<div id="headermargin" style="position: relative; top: auto; height: ', $this->header_margin, 'pt; width: ', $this->noMarginWidth, 'pt;"></div>'; @@ -394,11 +402,11 @@ class ReportHtml extends AbstractReport /** * Create a new Page Header object * - * @return ReportBasePageheader + * @return ReportBasePageHeader */ - public function createPageHeader(): ReportBasePageheader + public function createPageHeader(): ReportBasePageHeader { - return new ReportHtmlPageheader(); + return new ReportHtmlPageHeader(); } /** @@ -479,7 +487,7 @@ class ReportHtml extends AbstractReport * * @return void */ - public function clearHeader() + public function clearHeader(): void { $this->headerElements = []; } @@ -489,7 +497,7 @@ class ReportHtml extends AbstractReport * * @return void */ - public function addPage() + public function addPage(): void { $this->pageN++; @@ -513,7 +521,7 @@ class ReportHtml extends AbstractReport * * @return void */ - public function addMaxY($y) + public function addMaxY($y): void { if ($this->maxY < $y) { $this->maxY = $y; @@ -523,11 +531,11 @@ class ReportHtml extends AbstractReport /** * Add a page header. * - * @param $element + * @param ReportBaseElement $element * * @return void */ - public function addPageHeader($element) + public function addPageHeader($element): void { $this->pageHeaderElements[] = $element; } @@ -545,7 +553,7 @@ class ReportHtml extends AbstractReport $i = 0; $val = $footnote->getValue(); while ($i < $ct) { - if ($this->printedfootnotes[$i]->getValue() == $val) { + if ($this->printedfootnotes[$i]->getValue() === $val) { // If this footnote already exist then set up the numbers for this object $footnote->setNum($i + 1); $footnote->setAddlink((string) ($i + 1)); @@ -567,7 +575,7 @@ class ReportHtml extends AbstractReport * * @return void */ - public function clearPageHeader() + public function clearPageHeader(): void { $this->pageHeaderElements = []; } @@ -717,7 +725,7 @@ class ReportHtml extends AbstractReport * * @void */ - public function setCurrentStyle(string $s) + public function setCurrentStyle(string $s): void { $this->currentStyle = $s; } @@ -729,7 +737,7 @@ class ReportHtml extends AbstractReport * * @return void */ - public function setX($x) + public function setX($x): void { $this->X = $x; } @@ -743,7 +751,7 @@ class ReportHtml extends AbstractReport * * @return void */ - public function setY($y) + public function setY($y): void { $this->Y = $y; if ($this->maxY < $y) { @@ -761,7 +769,7 @@ class ReportHtml extends AbstractReport * * @return void */ - public function setXy($x, $y) + public function setXy($x, $y): void { $this->setX($x); $this->setY($y); @@ -806,18 +814,16 @@ class ReportHtml extends AbstractReport * * @return void */ - public function write($text, $color = '', $useclass = true) + public function write($text, $color = '', $useclass = true): void { $style = $this->getStyle($this->getCurrentStyle()); $htmlcode = '<span dir="' . I18N::direction() . '"'; if ($useclass) { $htmlcode .= ' class="' . $style['name'] . '"'; } - if (!empty($color)) { - // Check if Text Color is set and if it’s valid HTML color - if (preg_match('/#?(..)(..)(..)/', $color)) { - $htmlcode .= ' style="color:' . $color . ';"'; - } + // Check if Text Color is set and if it’s valid HTML color + if (preg_match('/#?(..)(..)(..)/', $color)) { + $htmlcode .= ' style="color:' . $color . ';"'; } $htmlcode .= '>' . $text . '</span>'; diff --git a/app/Report/PdfRenderer.php b/app/Report/PdfRenderer.php new file mode 100644 index 0000000000..a632d457e5 --- /dev/null +++ b/app/Report/PdfRenderer.php @@ -0,0 +1,737 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2019 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +declare(strict_types=1); + +namespace Fisharebest\Webtrees\Report; + +use Fisharebest\Webtrees\MediaFile; +use Fisharebest\Webtrees\Webtrees; +use League\Flysystem\FilesystemInterface; + +use function count; + +/** + * Class PdfRenderer + */ +class PdfRenderer extends AbstractRenderer +{ + /** + * PDF compression - Zlib extension is required + * + * @var bool const + */ + private const COMPRESSION = true; + + /** + * If true reduce the RAM memory usage by caching temporary data on filesystem (slower). + * + * @var bool const + */ + private const DISK_CACHE = false; + + /** + * true means that the input text is unicode (PDF) + * + * @var bool const + */ + private const UNICODE = true; + + /** + * false means that the full font is embedded, true means only the used chars + * in TCPDF v5.9 font subsetting is a very slow process, this leads to larger files + * + * @var bool const + */ + private const SUBSETTING = false; + + /** + * @var TcpdfWrapper + */ + public $tcpdf; + + /** @var ReportBaseElement[] Array of elements in the header */ + public $headerElements = []; + + /** @var ReportBaseElement[] Array of elements in the page header */ + public $pageHeaderElements = []; + + /** @var ReportBaseElement[] Array of elements in the footer */ + public $footerElements = []; + + /** @var ReportBaseElement[] Array of elements in the body */ + public $bodyElements = []; + + /** @var ReportPdfFootnote[] Array of elements in the footer notes */ + public $printedfootnotes = []; + + /** @var string Currently used style name */ + public $currentStyle = ''; + + /** @var float The last cell height */ + public $lastCellHeight = 0; + + /** @var float The largest font size within a TextBox to calculate the height */ + public $largestFontHeight = 0; + + /** @var int The last pictures page number */ + public $lastpicpage = 0; + + /** @var PdfRenderer The current report. */ + public $wt_report; + + /** + * PDF Header -PDF + * + * @return void + */ + public function header(): void + { + foreach ($this->headerElements as $element) { + if ($element instanceof ReportBaseElement) { + $element->render($this); + } elseif ($element === 'footnotetexts') { + $this->footnotes(); + } elseif ($element === 'addpage') { + $this->newPage(); + } + } + + foreach ($this->pageHeaderElements as $element) { + if ($element instanceof ReportBaseElement) { + $element->render($this); + } elseif ($element === 'footnotetexts') { + $this->footnotes(); + } elseif ($element === 'addpage') { + $this->newPage(); + } + } + } + + /** + * PDF Body -PDF + * + * @return void + */ + public function body(): void + { + $this->tcpdf->AddPage(); + + foreach ($this->bodyElements as $key => $element) { + if ($element instanceof ReportBaseElement) { + $element->render($this); + } elseif ($element === 'footnotetexts') { + $this->footnotes(); + } elseif ($element === 'addpage') { + $this->newPage(); + } + } + } + + /** + * PDF Footnotes -PDF + * + * @return void + */ + public function footnotes(): void + { + foreach ($this->printedfootnotes as $element) { + if (($this->tcpdf->GetY() + $element->getFootnoteHeight($this)) > $this->tcpdf->getPageHeight()) { + $this->tcpdf->AddPage(); + } + + $element->renderFootnote($this); + + if ($this->tcpdf->GetY() > $this->tcpdf->getPageHeight()) { + $this->tcpdf->AddPage(); + } + } + } + + /** + * PDF Footer -PDF + * + * @return void + */ + public function footer(): void + { + foreach ($this->footerElements as $element) { + if ($element instanceof ReportBaseElement) { + $element->render($this); + } elseif ($element === 'footnotetexts') { + $this->footnotes(); + } elseif ($element === 'addpage') { + $this->newPage(); + } + } + } + + /** + * Add an element to the Header -PDF + * + * @param ReportBaseElement|string $element + * + * @return void + */ + public function addHeader($element): void + { + $this->headerElements[] = $element; + } + + /** + * Add an element to the Page Header -PDF + * + * @param ReportBaseElement|string $element + * + * @return void + */ + public function addPageHeader($element): void + { + $this->pageHeaderElements[] = $element; + } + + /** + * Add an element to the Body -PDF + * + * @param ReportBaseElement|string $element + * + * @return void + */ + public function addBody($element): void + { + $this->bodyElements[] = $element; + } + + /** + * Add an element to the Footer -PDF + * + * @param ReportBaseElement|string $element + * + * @return void + */ + public function addFooter($element): void + { + $this->footerElements[] = $element; + } + + /** + * Remove the header. + * + * @param int $index + * + * @return void + */ + public function removeHeader(int $index): void + { + unset($this->headerElements[$index]); + } + + /** + * Remove the page header. + * + * @param int $index + * + * @return void + */ + public function removePageHeader(int $index): void + { + unset($this->pageHeaderElements[$index]); + } + + /** + * Remove the body. + * + * @param int $index + * + * @return void + */ + public function removeBody(int $index): void + { + unset($this->bodyElements[$index]); + } + + /** + * Remove the footer. + * + * @param int $index + * + * @return void + */ + public function removeFooter(int $index): void + { + unset($this->footerElements[$index]); + } + + /** + * Clear the Header -PDF + * + * @return void + */ + public function clearHeader(): void + { + unset($this->headerElements); + $this->headerElements = []; + } + + /** + * Clear the Page Header -PDF + * + * @return void + */ + public function clearPageHeader(): void + { + unset($this->pageHeaderElements); + $this->pageHeaderElements = []; + } + + /** + * Set the report. + * + * @param PdfRenderer $report + * + * @return void + */ + public function setReport(PdfRenderer $report): void + { + $this->wt_report = $report; + } + + /** + * Get the currently used style name -PDF + * + * @return string + */ + public function getCurrentStyle(): string + { + return $this->currentStyle; + } + + /** + * Setup a style for usage -PDF + * + * @param string $s Style name + * + * @return void + */ + public function setCurrentStyle(string $s): void + { + $this->currentStyle = $s; + $style = $this->wt_report->getStyle($s); + $this->tcpdf->SetFont($style['font'], $style['style'], $style['size']); + } + + /** + * Get the style -PDF + * + * @param string $s Style name + * + * @return array + */ + public function getStyle(string $s): array + { + if (!isset($this->wt_report->styles[$s])) { + $s = $this->getCurrentStyle(); + $this->wt_report->styles[$s] = $s; + } + + return $this->wt_report->styles[$s]; + } + + /** + * Add margin when static horizontal position is used -PDF + * RTL supported + * + * @param float $x Static position + * + * @return float + */ + public function addMarginX(float $x): float + { + $m = $this->tcpdf->getMargins(); + if ($this->tcpdf->getRTL()) { + $x += $m['right']; + } else { + $x += $m['left']; + } + $this->tcpdf->SetX($x); + + return $x; + } + + /** + * Get the maximum line width to draw from the curren position -PDF + * RTL supported + * + * @return float + */ + public function getMaxLineWidth(): float + { + $m = $this->tcpdf->getMargins(); + if ($this->tcpdf->getRTL()) { + return ($this->tcpdf->getRemainingWidth() + $m['right']); + } + + return ($this->tcpdf->getRemainingWidth() + $m['left']); + } + + /** + * Get the height of the footnote. + * + * @return float + */ + public function getFootnotesHeight(): float + { + $h = 0; + foreach ($this->printedfootnotes as $element) { + $h += $element->getHeight($this); + } + + return $h; + } + + /** + * Returns the the current font size height -PDF + * + * @return float + */ + public function getCurrentStyleHeight(): float + { + if ($this->currentStyle === '') { + return $this->wt_report->default_font_size; + } + $style = $this->wt_report->getStyle($this->currentStyle); + + return (float) $style['size']; + } + + /** + * Checks the Footnote and numbers them + * + * @param ReportPdfFootnote $footnote + * + * @return ReportPdfFootnote|bool object if already numbered, false otherwise + */ + public function checkFootnote(ReportPdfFootnote $footnote) + { + $ct = count($this->printedfootnotes); + $val = $footnote->getValue(); + $i = 0; + while ($i < $ct) { + if ($this->printedfootnotes[$i]->getValue() == $val) { + // If this footnote already exist then set up the numbers for this object + $footnote->setNum($i + 1); + $footnote->setAddlink((string) ($i + 1)); + + return $this->printedfootnotes[$i]; + } + $i++; + } + // If this Footnote has not been set up yet + $footnote->setNum($ct + 1); + $footnote->setAddlink((string) $this->tcpdf->AddLink()); + $this->printedfootnotes[] = $footnote; + + return false; + } + + /** + * Used this function instead of AddPage() + * This function will make sure that images will not be overwritten + * + * @return void + */ + public function newPage(): void + { + if ($this->lastpicpage > $this->tcpdf->getPage()) { + $this->tcpdf->setPage($this->lastpicpage); + } + $this->tcpdf->AddPage(); + } + + /** + * Add a page if needed -PDF + * + * @param float $height Cell height + * + * @return bool true in case of page break, false otherwise + */ + public function checkPageBreakPDF(float $height): bool + { + return $this->tcpdf->checkPageBreak($height); + } + + /** + * Returns the remaining width between the current position and margins -PDF + * + * @return float Remaining width + */ + public function getRemainingWidthPDF(): float + { + return $this->tcpdf->getRemainingWidth(); + } + /** + * PDF Setup - ReportPdf + * + * @return void + */ + public function setup(): void + { + parent::setup(); + + // Setup the PDF class with custom size pages because WT supports more page sizes. If WT sends an unknown size name then the default would be A4 + $this->tcpdf = new TcpdfWrapper($this->orientation, parent::UNITS, [ + $this->page_width, + $this->page_height, + ], self::UNICODE, 'UTF-8', self::DISK_CACHE); + + // Setup the PDF margins + $this->tcpdf->SetMargins($this->left_margin, $this->top_margin, $this->right_margin); + $this->tcpdf->setHeaderMargin($this->header_margin); + $this->tcpdf->setFooterMargin($this->footer_margin); + //Set auto page breaks + $this->tcpdf->SetAutoPageBreak(true, $this->bottom_margin); + // Set font subsetting + $this->tcpdf->setFontSubsetting(self::SUBSETTING); + // Setup PDF compression + $this->tcpdf->SetCompression(self::COMPRESSION); + // Setup RTL support + $this->tcpdf->setRTL($this->rtl); + // Set the document information + $this->tcpdf->SetCreator(Webtrees::NAME . ' ' . Webtrees::VERSION); + $this->tcpdf->SetAuthor($this->rauthor); + $this->tcpdf->SetTitle($this->title); + $this->tcpdf->SetSubject($this->rsubject); + $this->tcpdf->SetKeywords($this->rkeywords); + + $this->setReport($this); + + if ($this->show_generated_by) { + // The default style name for Generated by.... is 'genby' + $element = new ReportPdfCell(0, 10, 0, 'C', '', 'genby', 1, ReportBaseElement::CURRENT_POSITION, ReportBaseElement::CURRENT_POSITION, 0, 0, '', '', true); + $element->addText($this->generated_by); + $element->setUrl(Webtrees::URL); + $this->addFooter($element); + } + } + + /** + * Add an element. + * + * @param ReportBaseElement|string $element + * + * @return void + */ + public function addElement($element): void + { + if ($this->processing === 'B') { + $this->addBody($element); + + return; + } + + if ($this->processing === 'H') { + $this->addHeader($element); + + return; + } + + if ($this->processing === 'F') { + $this->addFooter($element); + + return; + } + } + + /** + * Run the report. + * + * @return void + */ + public function run(): void + { + $this->body(); + echo $this->tcpdf->Output('doc.pdf', 'S'); + } + + /** + * Create a new Cell object. + * + * @param int $width cell width (expressed in points) + * @param int $height cell height (expressed in points) + * @param mixed $border Border style + * @param string $align Text alignement + * @param string $bgcolor Background color code + * @param string $style The name of the text style + * @param int $ln Indicates where the current position should go after the call + * @param mixed $top Y-position + * @param mixed $left X-position + * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 1 + * @param int $stretch Stretch carachter mode + * @param string $bocolor Border color + * @param string $tcolor Text color + * @param bool $reseth + * + * @return ReportBaseCell + */ + public function createCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth): ReportBaseCell + { + return new ReportPdfCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth); + } + + /** + * Create a new TextBox object. + * + * @param float $width Text box width + * @param float $height Text box height + * @param bool $border + * @param string $bgcolor Background color code in HTML + * @param bool $newline + * @param float $left + * @param float $top + * @param bool $pagecheck + * @param string $style + * @param bool $fill + * @param bool $padding + * @param bool $reseth + * + * @return ReportBaseTextbox + */ + public function createTextBox( + float $width, + float $height, + bool $border, + string $bgcolor, + bool $newline, + float $left, + float $top, + bool $pagecheck, + string $style, + bool $fill, + bool $padding, + bool $reseth + ): ReportBaseTextbox { + return new ReportPdfTextBox($width, $height, $border, $bgcolor, $newline, $left, $top, $pagecheck, $style, $fill, $padding, $reseth); + } + + /** + * Create a text element. + * + * @param string $style + * @param string $color + * + * @return ReportBaseText + */ + public function createText(string $style, string $color): ReportBaseText + { + return new ReportPdfText($style, $color); + } + + /** + * Create a new Footnote object. + * + * @param string $style Style name + * + * @return ReportBaseFootnote + */ + public function createFootnote($style): ReportBaseFootnote + { + return new ReportPdfFootnote($style); + } + + /** + * Create a new Page Header object + * + * @return ReportBasePageHeader + */ + public function createPageHeader(): ReportBasePageHeader + { + return new ReportPdfPageHeader(); + } + + /** + * Create a new image object. + * + * @param string $file Filename + * @param float $x + * @param float $y + * @param float $w Image width + * @param float $h Image height + * @param string $align L:left, C:center, R:right or empty to use x/y + * @param string $ln T:same line, N:next line + * + * @return ReportBaseImage + */ + public function createImage(string $file, float $x, float $y, float $w, float $h, string $align, string $ln): ReportBaseImage + { + return new ReportPdfImage($file, $x, $y, $w, $h, $align, $ln); + } + + /** + * Create a new image object from Media Object. + * + * @param MediaFile $media_file + * @param float $x + * @param float $y + * @param float $w Image width + * @param float $h Image height + * @param string $align L:left, C:center, R:right or empty to use x/y + * @param string $ln T:same line, N:next line + * @param FilesystemInterface $data_filesystem + * + * @return ReportBaseImage + */ + public function createImageFromObject( + MediaFile $media_file, + float $x, + float $y, + float $w, + float $h, + string $align, + string $ln, + FilesystemInterface $data_filesystem + ): ReportBaseImage { + return new ReportPdfImage('@' . $media_file->fileContents($data_filesystem), $x, $y, $w, $h, $align, $ln); + } + + /** + * Create a line. + * + * @param float $x1 + * @param float $y1 + * @param float $x2 + * @param float $y2 + * + * @return ReportBaseLine + */ + public function createLine(float $x1, float $y1, float $x2, float $y2): ReportBaseLine + { + return new ReportPdfLine($x1, $y1, $x2, $y2); + } + + /** + * Create an HTML element. + * + * @param string $tag + * @param string[] $attrs + * + * @return ReportBaseHtml + */ + public function createHTML(string $tag, array $attrs): ReportBaseHtml + { + return new ReportPdfHtml($tag, $attrs); + } +} diff --git a/app/Report/ReportBaseCell.php b/app/Report/ReportBaseCell.php index fafceabdcb..92c74b4cf7 100644 --- a/app/Report/ReportBaseCell.php +++ b/app/Report/ReportBaseCell.php @@ -134,8 +134,22 @@ class ReportBaseCell extends ReportBaseElement * @param string $tcolor Text color * @param bool $reseth */ - public function __construct($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, int $fill, int $stretch, string $bocolor, string $tcolor, bool $reseth) - { + public function __construct( + $width, + $height, + $border, + $align, + string $bgcolor, + string $style, + int $ln, + $top, + $left, + int $fill, + int $stretch, + string $bocolor, + string $tcolor, + bool $reseth + ) { $this->align = $align; $this->border = $border; $this->bgcolor = $bgcolor; @@ -157,7 +171,7 @@ class ReportBaseCell extends ReportBaseElement /** * Get the cell height * - * @param ReportHtml|ReportTcpdf $renderer + * @param HtmlRenderer|PdfRenderer $renderer * * @return float */ @@ -173,7 +187,7 @@ class ReportBaseCell extends ReportBaseElement * * @return void */ - public function setUrl($url) + public function setUrl($url): void { $this->url = $url; } @@ -181,7 +195,7 @@ class ReportBaseCell extends ReportBaseElement /** * Get the cell width * - * @param ReportHtml|ReportTcpdf $renderer + * @param HtmlRenderer|PdfRenderer $renderer * * @return float|array */ diff --git a/app/Report/ReportBaseElement.php b/app/Report/ReportBaseElement.php index 468cdf2879..e878a1144d 100644 --- a/app/Report/ReportBaseElement.php +++ b/app/Report/ReportBaseElement.php @@ -19,6 +19,11 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Report; +use function htmlspecialchars_decode; +use function str_replace; +use function strip_tags; +use function trim; + /** * Class ReportBaseElement */ @@ -33,7 +38,7 @@ class ReportBaseElement /** * Element renderer * - * @param ReportHtml|ReportTcpdf $renderer + * @param HtmlRenderer|PdfRenderer $renderer * * @return void */ @@ -45,7 +50,7 @@ class ReportBaseElement /** * Get the height. * - * @param ReportHtml|ReportTcpdf $renderer + * @param HtmlRenderer|PdfRenderer $renderer * * @return float */ @@ -57,7 +62,7 @@ class ReportBaseElement /** * Get the width. * - * @param ReportHtml|ReportTcpdf $renderer + * @param HtmlRenderer|PdfRenderer $renderer * * @return float|array */ @@ -73,7 +78,7 @@ class ReportBaseElement * * @return void */ - public function addText(string $t) + public function addText(string $t): void { $t = trim($t, "\r\n\t"); $t = str_replace([ @@ -93,7 +98,7 @@ class ReportBaseElement * * @return void */ - public function addNewline() + public function addNewline(): void { $this->text .= "\n"; } @@ -124,11 +129,11 @@ class ReportBaseElement /** * Render the footnotes. * - * @param ReportHtml|ReportTcpdf $renderer + * @param HtmlRenderer|PdfRenderer $renderer * * @return void */ - public function renderFootnote($renderer) + public function renderFootnote($renderer): void { } @@ -139,7 +144,7 @@ class ReportBaseElement * * @return void */ - public function setText(string $text) + public function setText(string $text): void { $this->text = $text; } diff --git a/app/Report/ReportBaseFootnote.php b/app/Report/ReportBaseFootnote.php index 54f4b473b9..1bb46de9b1 100644 --- a/app/Report/ReportBaseFootnote.php +++ b/app/Report/ReportBaseFootnote.php @@ -19,6 +19,12 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Report; +use function htmlspecialchars_decode; +use function str_replace; +use function strip_tags; +use function strpos; +use function trim; + /** * Class ReportBaseFootnote */ @@ -84,7 +90,7 @@ class ReportBaseFootnote extends ReportBaseElement * * @return void */ - public function addText(string $t) + public function addText(string $t): void { $t = trim($t, "\r\n\t"); $t = str_replace([ diff --git a/app/Report/ReportBaseHtml.php b/app/Report/ReportBaseHtml.php index b1229bfa9d..ce35333171 100644 --- a/app/Report/ReportBaseHtml.php +++ b/app/Report/ReportBaseHtml.php @@ -78,7 +78,7 @@ class ReportBaseHtml extends ReportBaseElement * * @return void */ - public function addElement($element) + public function addElement($element): void { $this->elements[] = $element; } diff --git a/app/Report/ReportBaseImage.php b/app/Report/ReportBaseImage.php index 3f3a6c6699..94c27a49aa 100644 --- a/app/Report/ReportBaseImage.php +++ b/app/Report/ReportBaseImage.php @@ -70,7 +70,7 @@ class ReportBaseImage extends ReportBaseElement /** * Get the height. * - * @param ReportHtml|ReportTcpdf $renderer + * @param HtmlRenderer|PdfRenderer $renderer * * @return float */ @@ -82,7 +82,7 @@ class ReportBaseImage extends ReportBaseElement /** * Get the width. * - * @param ReportHtml|ReportTcpdf $renderer + * @param HtmlRenderer|PdfRenderer $renderer * * @return float|array */ diff --git a/app/Report/ReportBaseLine.php b/app/Report/ReportBaseLine.php index cda2daae06..c1908464fe 100644 --- a/app/Report/ReportBaseLine.php +++ b/app/Report/ReportBaseLine.php @@ -19,6 +19,8 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Report; +use function abs; + /** * Class ReportBaseLine */ @@ -68,7 +70,7 @@ class ReportBaseLine extends ReportBaseElement /** * Get the height of the line. * - * @param ReportHtml|ReportTcpdf $renderer + * @param HtmlRenderer|PdfRenderer $renderer * * @return float */ @@ -80,7 +82,7 @@ class ReportBaseLine extends ReportBaseElement /** * Get the width of the line. * - * @param ReportHtml|ReportTcpdf $renderer + * @param HtmlRenderer|PdfRenderer $renderer * * @return float|array */ diff --git a/app/Report/ReportBasePageheader.php b/app/Report/ReportBasePageHeader.php index 721ac25a2c..c8ae8141e7 100644 --- a/app/Report/ReportBasePageheader.php +++ b/app/Report/ReportBasePageHeader.php @@ -20,9 +20,9 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Report; /** - * Class ReportBasePageheader + * Class ReportBasePageHeader */ -class ReportBasePageheader extends ReportBaseElement +class ReportBasePageHeader extends ReportBaseElement { /** @var ReportBaseElement[] Elements */ public $elements = []; @@ -40,7 +40,7 @@ class ReportBasePageheader extends ReportBaseElement * * @return void */ - public function textBox() + public function textBox(): void { $this->elements = []; } @@ -52,7 +52,7 @@ class ReportBasePageheader extends ReportBaseElement * * @return void */ - public function addElement($element) + public function addElement($element): void { $this->elements[] = $element; } diff --git a/app/Report/ReportBaseText.php b/app/Report/ReportBaseText.php index f0a2ea6e3a..abd7fe6685 100644 --- a/app/Report/ReportBaseText.php +++ b/app/Report/ReportBaseText.php @@ -19,6 +19,8 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Report; +use function strpos; + /** * Class ReportBaseText */ diff --git a/app/Report/ReportBaseTextbox.php b/app/Report/ReportBaseTextbox.php index c3c0177c34..d5e2db0ef5 100644 --- a/app/Report/ReportBaseTextbox.php +++ b/app/Report/ReportBaseTextbox.php @@ -170,7 +170,7 @@ class ReportBaseTextbox extends ReportBaseElement * * @return void */ - public function addElement($element) + public function addElement($element): void { $this->elements[] = $element; } diff --git a/app/Report/ReportHtmlCell.php b/app/Report/ReportHtmlCell.php index 7eb0446bbd..5172a4a369 100644 --- a/app/Report/ReportHtmlCell.php +++ b/app/Report/ReportHtmlCell.php @@ -19,6 +19,10 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Report; +use function str_replace; +use function stripos; +use function strpos; + /** * Class ReportHtmlCell */ @@ -27,7 +31,7 @@ class ReportHtmlCell extends ReportBaseCell /** * HTML Cell renderer * - * @param ReportHtml $renderer + * @param HtmlRenderer $renderer * * @return void */ diff --git a/app/Report/ReportHtmlFootnote.php b/app/Report/ReportHtmlFootnote.php index 82c36801eb..9f1fc430ff 100644 --- a/app/Report/ReportHtmlFootnote.php +++ b/app/Report/ReportHtmlFootnote.php @@ -19,6 +19,11 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Report; +use function count; +use function explode; +use function str_replace; +use function substr_count; + /** * Class ReportHtmlFootnote */ @@ -27,7 +32,7 @@ class ReportHtmlFootnote extends ReportBaseFootnote /** * HTML Footnotes number renderer * - * @param ReportHtml $renderer + * @param HtmlRenderer $renderer * * @return void */ @@ -43,13 +48,13 @@ class ReportHtmlFootnote extends ReportBaseFootnote * Write the Footnote text * Uses style name "footnote" by default * - * @param ReportHtml $renderer + * @param HtmlRenderer $renderer * * @return void */ - public function renderFootnote($renderer) + public function renderFootnote($renderer): void { - if ($renderer->getCurrentStyle() != $this->styleName) { + if ($renderer->getCurrentStyle() !== $this->styleName) { $renderer->setCurrentStyle($this->styleName); } @@ -62,7 +67,7 @@ class ReportHtmlFootnote extends ReportBaseFootnote '<u>', '</u>', ], $temptext); - echo "\n<div><a name=\"footnote", $this->num, '"></a>'; + echo '<div><a id="footnote', $this->num, '"></a>'; $renderer->write($this->num . '. ' . $temptext); echo '</div>'; @@ -72,14 +77,14 @@ class ReportHtmlFootnote extends ReportBaseFootnote /** * Calculates the Footnotes height * - * @param ReportHtml $html - * @param float $cellWidth The width of the cell to use it for text wraping + * @param HtmlRenderer $html + * @param float $cellWidth The width of the cell to use it for text wraping * * @return float Footnote height in points */ public function getFootnoteHeight($html, float $cellWidth = 0): float { - if ($html->getCurrentStyle() != $this->styleName) { + if ($html->getCurrentStyle() !== $this->styleName) { $html->setCurrentStyle($this->styleName); } @@ -98,7 +103,7 @@ class ReportHtmlFootnote extends ReportBaseFootnote * Get the width of text * Breaks up a text into lines if needed * - * @param ReportHtml $renderer + * @param HtmlRenderer $renderer * * @return float|array */ @@ -143,13 +148,13 @@ class ReportHtmlFootnote extends ReportBaseFootnote $lw += $renderer->getStringWidth($word . ' '); if ($lw <= $wrapWidthRemaining) { $newtext .= $word; - if ($addspace != 0) { + if ($addspace !== 0) { $newtext .= ' '; } } else { $lw = $renderer->getStringWidth($word . ' '); $newtext .= "\n$word"; - if ($addspace != 0) { + if ($addspace !== 0) { $newtext .= ' '; } // Reset the wrap width to the cell width diff --git a/app/Report/ReportHtmlHtml.php b/app/Report/ReportHtmlHtml.php index 4b6938695b..e2e21ee9b6 100644 --- a/app/Report/ReportHtmlHtml.php +++ b/app/Report/ReportHtmlHtml.php @@ -27,9 +27,9 @@ class ReportHtmlHtml extends ReportBaseHtml /** * Render the elements. * - * @param ReportHtml $renderer - * @param bool $sub - * @param bool $inat + * @param HtmlRenderer $renderer + * @param bool $sub + * @param bool $inat * * @return void|string */ diff --git a/app/Report/ReportHtmlImage.php b/app/Report/ReportHtmlImage.php index 5f3dbb98b5..316d138f87 100644 --- a/app/Report/ReportHtmlImage.php +++ b/app/Report/ReportHtmlImage.php @@ -27,7 +27,7 @@ class ReportHtmlImage extends ReportBaseImage /** * Image renderer * - * @param ReportHtml $renderer + * @param HtmlRenderer $renderer * * @return void */ @@ -41,10 +41,8 @@ class ReportHtmlImage extends ReportBaseImage } if ($this->y === ReportBaseElement::CURRENT_POSITION) { //-- first check for a collision with the last picture - if (isset($lastpicbottom)) { - if (($renderer->pageNo() == $lastpicpage) && ($lastpicbottom >= $renderer->getY()) && ($this->x >= $lastpicleft) && ($this->x <= $lastpicright)) { - $renderer->setY($lastpicbottom + ($renderer->cPadding * 2)); - } + if ($lastpicbottom !== null && $renderer->pageNo() === $lastpicpage && $lastpicbottom >= $renderer->getY() && $this->x >= $lastpicleft && $this->x <= $lastpicright) { + $renderer->setY($lastpicbottom + ($renderer->cPadding * 2)); } $this->y = $renderer->getY(); } @@ -84,7 +82,7 @@ class ReportHtmlImage extends ReportBaseImage * This would be called from the TextBox only for multiple images * so we add a bit bottom space between the images * - * @param ReportHtml $renderer + * @param HtmlRenderer $renderer * * @return float */ diff --git a/app/Report/ReportHtmlLine.php b/app/Report/ReportHtmlLine.php index a06ad2ab88..5bee1a2e6e 100644 --- a/app/Report/ReportHtmlLine.php +++ b/app/Report/ReportHtmlLine.php @@ -27,7 +27,7 @@ class ReportHtmlLine extends ReportBaseLine /** * HTML line renderer * - * @param ReportHtml $renderer + * @param HtmlRenderer $renderer * * @return void */ diff --git a/app/Report/ReportHtmlPageheader.php b/app/Report/ReportHtmlPageHeader.php index 61640fc0b3..c9f3f48058 100644 --- a/app/Report/ReportHtmlPageheader.php +++ b/app/Report/ReportHtmlPageHeader.php @@ -20,14 +20,14 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Report; /** - * Class ReportHtmlPageheader + * Class ReportHtmlPageHeader */ -class ReportHtmlPageheader extends ReportBasePageheader +class ReportHtmlPageHeader extends ReportBasePageHeader { /** * PageHeader element renderer * - * @param ReportHtml $renderer + * @param HtmlRenderer $renderer * * @return void */ diff --git a/app/Report/ReportHtmlText.php b/app/Report/ReportHtmlText.php index ae03abd14d..ff44a4989f 100644 --- a/app/Report/ReportHtmlText.php +++ b/app/Report/ReportHtmlText.php @@ -19,6 +19,11 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Report; +use function count; +use function explode; +use function str_replace; +use function substr_count; + /** * Class ReportHtmlText */ @@ -27,16 +32,16 @@ class ReportHtmlText extends ReportBaseText /** * Render the elements. * - * @param ReportHtml $renderer - * @param int $curx - * @param bool $attrib Is is called from a different element? + * @param HtmlRenderer $renderer + * @param int $curx + * @param bool $attrib Is is called from a different element? * * @return void */ public function render($renderer, $curx = 0, $attrib = true) { // Set up the style - if ($renderer->getCurrentStyle() != $this->styleName) { + if ($renderer->getCurrentStyle() !== $this->styleName) { $renderer->setCurrentStyle($this->styleName); } $temptext = str_replace('#PAGENUM#', (string) $renderer->pageNo(), $this->text); @@ -75,7 +80,7 @@ class ReportHtmlText extends ReportBaseText $renderer->write($temptext, $this->color); echo "</div>\n"; $renderer->setX($startX + $renderer->getStringWidth($temptext)); - if ($renderer->countLines($temptext) != 1) { + if ($renderer->countLines($temptext) !== 1) { $renderer->setXy(0, $startY + $renderer->getTextCellHeight($temptext)); } } @@ -87,7 +92,7 @@ class ReportHtmlText extends ReportBaseText * Returns the height in points of the text element * The height is already calculated in getWidth() * - * @param ReportHtml $renderer + * @param HtmlRenderer $renderer * * @return float */ @@ -105,14 +110,14 @@ class ReportHtmlText extends ReportBaseText /** * Get the width of text and wrap it too * - * @param ReportHtml $renderer + * @param HtmlRenderer $renderer * * @return float|array */ public function getWidth($renderer) { // Setup the style name, a font must be selected to calculate the width - if ($renderer->getCurrentStyle() != $this->styleName) { + if ($renderer->getCurrentStyle() !== $this->styleName) { $renderer->setCurrentStyle($this->styleName); } @@ -147,13 +152,13 @@ class ReportHtmlText extends ReportBaseText $lw += $renderer->getStringWidth($word . ' '); if ($lw <= $wrapWidthRemaining) { $newtext .= $word; - if ($addspace != 0) { + if ($addspace !== 0) { $newtext .= ' '; } } else { $lw = $renderer->getStringWidth($word . ' '); $newtext .= "\n$word"; - if ($addspace != 0) { + if ($addspace !== 0) { $newtext .= ' '; } // Reset the wrap width to the cell width diff --git a/app/Report/ReportHtmlTextbox.php b/app/Report/ReportHtmlTextbox.php index 1820048a98..f01d479caf 100644 --- a/app/Report/ReportHtmlTextbox.php +++ b/app/Report/ReportHtmlTextbox.php @@ -19,6 +19,13 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Report; +use function abs; +use function count; +use function is_object; +use function ksort; +use function str_replace; +use function trim; + /** * Class ReportHtmlTextbox */ @@ -27,7 +34,7 @@ class ReportHtmlTextbox extends ReportBaseTextbox /** * Render the elements. * - * @param ReportHtml $renderer + * @param HtmlRenderer $renderer * * @return void */ @@ -224,10 +231,8 @@ class ReportHtmlTextbox extends ReportBaseTextbox // LTR (left) or RTL (right) echo $renderer->alignRTL, ':', $cX, 'pt;'; // Background color - if ($this->fill) { - if (!empty($this->bgcolor)) { - echo ' background-color:', $this->bgcolor, ';'; - } + if ($this->fill && $this->bgcolor !== '') { + echo ' background-color:', $this->bgcolor, ';'; } // Print padding only when it’s set if ($this->padding) { diff --git a/app/Report/ReportParserBase.php b/app/Report/ReportParserBase.php index 3614bc8330..a72806bcbc 100644 --- a/app/Report/ReportParserBase.php +++ b/app/Report/ReportParserBase.php @@ -23,7 +23,23 @@ use DomainException; use Exception; use function call_user_func; +use function fclose; +use function feof; +use function fopen; +use function fread; use function method_exists; +use function sprintf; +use function xml_error_string; +use function xml_get_current_line_number; +use function xml_get_error_code; +use function xml_parse; +use function xml_parser_create; +use function xml_parser_free; +use function xml_parser_set_option; +use function xml_set_character_data_handler; +use function xml_set_element_handler; + +use const XML_OPTION_CASE_FOLDING; /** * Class ReportParserBase diff --git a/app/Report/ReportParserGenerate.php b/app/Report/ReportParserGenerate.php index fe33c352f0..22d07d100d 100644 --- a/app/Report/ReportParserGenerate.php +++ b/app/Report/ReportParserGenerate.php @@ -48,13 +48,52 @@ use stdClass; use Symfony\Component\Cache\Adapter\NullAdapter; use Symfony\Component\ExpressionLanguage\ExpressionLanguage; +use function addcslashes; +use function addslashes; +use function array_pop; +use function array_shift; +use function assert; use function call_user_func; +use function count; +use function end; use function explode; +use function file; +use function file_exists; +use function getimagesize; use function imagecreatefromstring; use function imagesx; use function imagesy; +use function in_array; use function method_exists; +use function preg_match; +use function preg_match_all; +use function preg_replace; +use function preg_replace_callback; +use function preg_split; +use function reset; +use function round; +use function sprintf; +use function str_replace; +use function strip_tags; +use function strlen; +use function strpos; +use function strstr; +use function strtoupper; +use function substr; use function trim; +use function uasort; +use function xml_error_string; +use function xml_get_current_line_number; +use function xml_get_error_code; +use function xml_parse; +use function xml_parser_create; +use function xml_parser_free; +use function xml_parser_set_option; +use function xml_set_character_data_handler; +use function xml_set_element_handler; + +use const PREG_SET_ORDER; +use const XML_OPTION_CASE_FOLDING; /** * Class ReportParserGenerate - parse a report.xml file and generate the report. @@ -88,7 +127,7 @@ class ReportParserGenerate extends ReportParserBase /** @var array[] Nested repeating data */ private $repeats_stack = []; - /** @var AbstractReport[] Nested repeating data */ + /** @var AbstractRenderer[] Nested repeating data */ private $wt_report_stack = []; /** @var resource Nested repeating data */ @@ -133,10 +172,10 @@ class ReportParserGenerate extends ReportParserBase /** @var string The filename of the XML report */ protected $report; - /** @var AbstractReport A factory for creating report elements */ + /** @var AbstractRenderer A factory for creating report elements */ private $report_root; - /** @var AbstractReport Nested report elements */ + /** @var AbstractRenderer Nested report elements */ private $wt_report; /** @var string[][] Variables defined in the report at run-time */ @@ -152,14 +191,14 @@ class ReportParserGenerate extends ReportParserBase * Create a parser for a report * * @param string $report The XML filename - * @param AbstractReport $report_root + * @param AbstractRenderer $report_root * @param string[][] $vars * @param Tree $tree * @param FilesystemInterface $data_filesystem */ public function __construct( string $report, - AbstractReport $report_root, + AbstractRenderer $report_root, array $vars, Tree $tree, FilesystemInterface $data_filesystem @@ -1676,7 +1715,7 @@ class ReportParserGenerate extends ReportParserBase if ($media_file instanceof MediaFile && $media_file->fileExists($this->data_filesystem)) { $image = imagecreatefromstring($media_file->fileContents($this->data_filesystem)); - $attributes = [(int) imagesx($image), (int) imagesy($image)]; + $attributes = [imagesx($image), imagesy($image)]; if ($width > 0 && $height == 0) { $perc = $width / $attributes[0]; @@ -1728,7 +1767,7 @@ class ReportParserGenerate extends ReportParserBase if ($media_file instanceof MediaFile && $media_file->fileExists($this->data_filesystem)) { $image = imagecreatefromstring($media_file->fileContents($this->data_filesystem)); - $attributes = [(int) imagesx($image), (int) imagesy($image)]; + $attributes = [imagesx($image), imagesy($image)]; if ($width > 0 && $height == 0) { $perc = $width / $attributes[0]; diff --git a/app/Report/ReportParserSetup.php b/app/Report/ReportParserSetup.php index 3792e4b494..b8a4059079 100644 --- a/app/Report/ReportParserSetup.php +++ b/app/Report/ReportParserSetup.php @@ -23,6 +23,9 @@ use Fisharebest\Webtrees\Auth; use Fisharebest\Webtrees\Carbon; use Fisharebest\Webtrees\I18N; +use function preg_match; +use function strtoupper; + /** * Class ReportParserSetup - parse a report.xml file and extract the setup options. */ diff --git a/app/Report/ReportPdf.php b/app/Report/ReportPdf.php deleted file mode 100644 index 7bd6d40093..0000000000 --- a/app/Report/ReportPdf.php +++ /dev/null @@ -1,338 +0,0 @@ -<?php - -/** - * webtrees: online genealogy - * Copyright (C) 2019 webtrees development team - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -declare(strict_types=1); - -namespace Fisharebest\Webtrees\Report; - -use Fisharebest\Webtrees\MediaFile; -use Fisharebest\Webtrees\Webtrees; -use League\Flysystem\FilesystemInterface; - -/** - * Class ReportPdf - */ -class ReportPdf extends AbstractReport -{ - /** - * PDF compression - Zlib extension is required - * - * @var bool const - */ - private const COMPRESSION = true; - - /** - * If true reduce the RAM memory usage by caching temporary data on filesystem (slower). - * - * @var bool const - */ - private const DISK_CACHE = false; - - /** - * true means that the input text is unicode (PDF) - * - * @var bool const - */ - private const UNICODE = true; - - /** - * false means that the full font is embedded, true means only the used chars - * in TCPDF v5.9 font subsetting is a very slow process, this leads to larger files - * - * @var bool const - */ - private const SUBSETTING = false; - - /** - * A new object of the PDF class - * - * @var ReportTcpdf - */ - public $pdf; - - /** - * PDF Setup - ReportPdf - * - * @return void - */ - public function setup(): void - { - parent::setup(); - - // Setup the PDF class with custom size pages because WT supports more page sizes. If WT sends an unknown size name then the default would be A4 - $this->pdf = new ReportTcpdf($this->orientation, parent::UNITS, [ - $this->page_width, - $this->page_height, - ], self::UNICODE, 'UTF-8', self::DISK_CACHE); - - // Setup the PDF margins - $this->pdf->SetMargins($this->left_margin, $this->top_margin, $this->right_margin); - $this->pdf->setHeaderMargin($this->header_margin); - $this->pdf->setFooterMargin($this->footer_margin); - //Set auto page breaks - $this->pdf->SetAutoPageBreak(true, $this->bottom_margin); - // Set font subsetting - $this->pdf->setFontSubsetting(self::SUBSETTING); - // Setup PDF compression - $this->pdf->SetCompression(self::COMPRESSION); - // Setup RTL support - $this->pdf->setRTL($this->rtl); - // Set the document information - $this->pdf->SetCreator(Webtrees::NAME . ' ' . Webtrees::VERSION); - $this->pdf->SetAuthor($this->rauthor); - $this->pdf->SetTitle($this->title); - $this->pdf->SetSubject($this->rsubject); - $this->pdf->SetKeywords($this->rkeywords); - - $this->pdf->setReport($this); - - if ($this->show_generated_by) { - // The default style name for Generated by.... is 'genby' - $element = new ReportPdfCell(0, 10, 0, 'C', '', 'genby', 1, ReportBaseElement::CURRENT_POSITION, ReportBaseElement::CURRENT_POSITION, 0, 0, '', '', true); - $element->addText($this->generated_by); - $element->setUrl(Webtrees::URL); - $this->pdf->addFooter($element); - } - } - - /** - * Add an element. - * - * @param ReportBaseElement|string $element - * - * @return void - */ - public function addElement($element) - { - if ($this->processing === 'B') { - $this->pdf->addBody($element); - - return; - } - - if ($this->processing === 'H') { - $this->pdf->addHeader($element); - - return; - } - - if ($this->processing === 'F') { - $this->pdf->addFooter($element); - - return; - } - } - - /** - * Run the report. - * - * @return void - */ - public function run() - { - $this->pdf->body(); - echo $this->pdf->Output('doc.pdf', 'S'); - } - - /** - * Clear the Header. - * - * @return void - */ - public function clearHeader() - { - $this->pdf->clearHeader(); - } - - /** - * Clear the Page Header - ReportPdf - * - * @return void - */ - public function clearPageHeader() - { - $this->pdf->clearPageHeader(); - } - - /** - * Create a new Cell object. - * - * @param int $width cell width (expressed in points) - * @param int $height cell height (expressed in points) - * @param mixed $border Border style - * @param string $align Text alignement - * @param string $bgcolor Background color code - * @param string $style The name of the text style - * @param int $ln Indicates where the current position should go after the call - * @param mixed $top Y-position - * @param mixed $left X-position - * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 1 - * @param int $stretch Stretch carachter mode - * @param string $bocolor Border color - * @param string $tcolor Text color - * @param bool $reseth - * - * @return ReportBaseCell - */ - public function createCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth): ReportBaseCell - { - return new ReportPdfCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth); - } - - /** - * Create a new TextBox object. - * - * @param float $width Text box width - * @param float $height Text box height - * @param bool $border - * @param string $bgcolor Background color code in HTML - * @param bool $newline - * @param float $left - * @param float $top - * @param bool $pagecheck - * @param string $style - * @param bool $fill - * @param bool $padding - * @param bool $reseth - * - * @return ReportBaseTextbox - */ - public function createTextBox( - float $width, - float $height, - bool $border, - string $bgcolor, - bool $newline, - float $left, - float $top, - bool $pagecheck, - string $style, - bool $fill, - bool $padding, - bool $reseth - ): ReportBaseTextbox { - return new ReportPdfTextbox($width, $height, $border, $bgcolor, $newline, $left, $top, $pagecheck, $style, $fill, $padding, $reseth); - } - - /** - * Create a text element. - * - * @param string $style - * @param string $color - * - * @return ReportBaseText - */ - public function createText(string $style, string $color): ReportBaseText - { - return new ReportPdfText($style, $color); - } - - /** - * Create a new Footnote object. - * - * @param string $style Style name - * - * @return ReportBaseFootnote - */ - public function createFootnote($style): ReportBaseFootnote - { - return new ReportPdfFootnote($style); - } - - /** - * Create a new Page Header object - * - * @return ReportBasePageheader - */ - public function createPageHeader(): ReportBasePageheader - { - return new ReportPdfPageheader(); - } - - /** - * Create a new image object. - * - * @param string $file Filename - * @param float $x - * @param float $y - * @param float $w Image width - * @param float $h Image height - * @param string $align L:left, C:center, R:right or empty to use x/y - * @param string $ln T:same line, N:next line - * - * @return ReportBaseImage - */ - public function createImage(string $file, float $x, float $y, float $w, float $h, string $align, string $ln): ReportBaseImage - { - return new ReportPdfImage($file, $x, $y, $w, $h, $align, $ln); - } - - /** - * Create a new image object from Media Object. - * - * @param MediaFile $media_file - * @param float $x - * @param float $y - * @param float $w Image width - * @param float $h Image height - * @param string $align L:left, C:center, R:right or empty to use x/y - * @param string $ln T:same line, N:next line - * @param FilesystemInterface $data_filesystem - * - * @return ReportBaseImage - */ - public function createImageFromObject( - MediaFile $media_file, - float $x, - float $y, - float $w, - float $h, - string $align, - string $ln, - FilesystemInterface $data_filesystem - ): ReportBaseImage { - return new ReportPdfImage('@' . $media_file->fileContents($data_filesystem), $x, $y, $w, $h, $align, $ln); - } - - /** - * Create a line. - * - * @param float $x1 - * @param float $y1 - * @param float $x2 - * @param float $y2 - * - * @return ReportBaseLine - */ - public function createLine(float $x1, float $y1, float $x2, float $y2): ReportBaseLine - { - return new ReportPdfLine($x1, $y1, $x2, $y2); - } - - /** - * Create an HTML element. - * - * @param string $tag - * @param string[] $attrs - * - * @return ReportBaseHtml - */ - public function createHTML(string $tag, array $attrs): ReportBaseHtml - { - return new ReportPdfHtml($tag, $attrs); - } -} diff --git a/app/Report/ReportPdfCell.php b/app/Report/ReportPdfCell.php index 1ae10a8b15..68d547a724 100644 --- a/app/Report/ReportPdfCell.php +++ b/app/Report/ReportPdfCell.php @@ -21,6 +21,11 @@ namespace Fisharebest\Webtrees\Report; use Fisharebest\Webtrees\Functions\FunctionsRtl; +use function hexdec; +use function is_array; +use function preg_match; +use function str_replace; + /** * Class ReportPdfCell */ @@ -29,13 +34,13 @@ class ReportPdfCell extends ReportBaseCell /** * PDF Cell renderer * - * @param ReportTcpdf $renderer + * @param PdfRenderer $renderer * * @return void */ public function render($renderer) { - $temptext = str_replace('#PAGENUM#', (string) $renderer->PageNo(), $this->text); + $temptext = str_replace('#PAGENUM#', (string) $renderer->tcpdf->PageNo(), $this->text); // underline «title» part of Source item $temptext = str_replace([ '«', @@ -53,14 +58,14 @@ class ReportPdfCell extends ReportBaseCell // Background color $match = []; // Indicates if the cell background must be painted (1) or transparent (0) - if ($this->fill == 1) { + if ($this->fill === 1) { if (!empty($this->bgcolor)) { // HTML color to RGB if (preg_match('/#?(..)(..)(..)/', $this->bgcolor, $match)) { $r = hexdec($match[1]); $g = hexdec($match[2]); $b = hexdec($match[3]); - $renderer->SetFillColor($r, $g, $b); + $renderer->tcpdf->SetFillColor($r, $g, $b); } } else { // If no color set then don't fill @@ -69,28 +74,27 @@ class ReportPdfCell extends ReportBaseCell } // Borders - if (!empty($this->bocolor)) { - // HTML color to RGB - if (preg_match('/#?(..)(..)(..)/', $this->bocolor, $match)) { - $r = hexdec($match[1]); - $g = hexdec($match[2]); - $b = hexdec($match[3]); - $renderer->SetDrawColor($r, $g, $b); - } + // HTML color to RGB + if (preg_match('/#?(..)(..)(..)/', $this->bocolor, $match)) { + $r = hexdec($match[1]); + $g = hexdec($match[2]); + $b = hexdec($match[3]); + $renderer->tcpdf->SetDrawColor($r, $g, $b); } + // Paint the text color or they might use inherited colors by the previous function if (preg_match('/#?(..)(..)(..)/', $this->tcolor, $match)) { $r = hexdec($match[1]); $g = hexdec($match[2]); $b = hexdec($match[3]); - $renderer->SetTextColor($r, $g, $b); + $renderer->tcpdf->SetTextColor($r, $g, $b); } else { - $renderer->SetTextColor(0, 0, 0); + $renderer->tcpdf->SetTextColor(0, 0, 0); } // If current position (left) if ($this->left === ReportBaseElement::CURRENT_POSITION) { - $cX = $renderer->GetX(); + $cX = $renderer->tcpdf->GetX(); } else { // For static position add margin (also updates X) $cX = $renderer->addMarginX($this->left); @@ -102,9 +106,9 @@ class ReportPdfCell extends ReportBaseCell } // For current position if ($this->top === ReportBaseElement::CURRENT_POSITION) { - $this->top = $renderer->GetY(); + $this->top = $renderer->tcpdf->GetY(); } else { - $renderer->SetY($this->top); + $renderer->tcpdf->SetY($this->top); } // Check the last cell height and adjust the current cell height if needed @@ -113,9 +117,9 @@ class ReportPdfCell extends ReportBaseCell } // Check for pagebreak if (!empty($temptext)) { - $cHT = $renderer->getNumLines($temptext, $this->width); - $cHT = $cHT * $renderer->getCellHeightRatio() * $renderer->getCurrentStyleHeight(); - $cM = $renderer->getMargins(); + $cHT = $renderer->tcpdf->getNumLines($temptext, $this->width); + $cHT = $cHT * $renderer->tcpdf->getCellHeightRatio() * $renderer->getCurrentStyleHeight(); + $cM = $renderer->tcpdf->getMargins(); // Add padding if (is_array($cM['cell'])) { $cHT += ($cM['padding_bottom'] + $cM['padding_top']); @@ -124,12 +128,12 @@ class ReportPdfCell extends ReportBaseCell } // Add a new page if needed if ($renderer->checkPageBreakPDF($cHT)) { - $this->top = $renderer->GetY(); + $this->top = $renderer->tcpdf->GetY(); } $temptext = FunctionsRtl::spanLtrRtl($temptext); } // HTML ready - last value is true - $renderer->MultiCell( + $renderer->tcpdf->MultiCell( $this->width, $this->height, $temptext, @@ -146,17 +150,17 @@ class ReportPdfCell extends ReportBaseCell // Reset the last cell height for the next line if ($this->newline >= 1) { $renderer->lastCellHeight = 0; - } elseif ($renderer->lastCellHeight < $renderer->getLastH()) { + } elseif ($renderer->lastCellHeight < $renderer->tcpdf->getLastH()) { // OR save the last height if heigher then before - $renderer->lastCellHeight = $renderer->getLastH(); + $renderer->lastCellHeight = $renderer->tcpdf->getLastH(); } // Set up the url link if exists ontop of the cell if (!empty($this->url)) { - $renderer->Link($cX, $this->top, $this->width, $this->height, $this->url); + $renderer->tcpdf->Link($cX, $this->top, $this->width, $this->height, $this->url); } // Reset the border and the text color to black or they will be inherited - $renderer->SetDrawColor(0, 0, 0); - $renderer->SetTextColor(0, 0, 0); + $renderer->tcpdf->SetDrawColor(0, 0, 0); + $renderer->tcpdf->SetTextColor(0, 0, 0); } } diff --git a/app/Report/ReportPdfFootnote.php b/app/Report/ReportPdfFootnote.php index e2593cd1c6..4d34c74c14 100644 --- a/app/Report/ReportPdfFootnote.php +++ b/app/Report/ReportPdfFootnote.php @@ -19,6 +19,12 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Report; +use function ceil; +use function count; +use function explode; +use function str_replace; +use function substr_count; + /** * Class ReportPdfFootnote */ @@ -27,36 +33,36 @@ class ReportPdfFootnote extends ReportBaseFootnote /** * PDF Footnotes number renderer * - * @param ReportTcpdf $renderer + * @param PdfRenderer $renderer * * @return void */ public function render($renderer) { $renderer->setCurrentStyle('footnotenum'); - $renderer->Write($renderer->getCurrentStyleHeight(), $this->numText, $this->addlink); //source link numbers after name + $renderer->tcpdf->Write($renderer->getCurrentStyleHeight(), $this->numText, $this->addlink); //source link numbers after name } /** * Write the Footnote text * Uses style name "footnote" by default * - * @param ReportTcpdf $renderer + * @param PdfRenderer $renderer * * @return void */ - public function renderFootnote($renderer) + public function renderFootnote($renderer): void { - if ($renderer->getCurrentStyle() != $this->styleName) { + if ($renderer->getCurrentStyle() !== $this->styleName) { $renderer->setCurrentStyle($this->styleName); } - $temptext = str_replace('#PAGENUM#', (string) $renderer->PageNo(), $this->text); + $temptext = str_replace('#PAGENUM#', (string) $renderer->tcpdf->PageNo(), $this->text); // Set the link to this y/page position - $renderer->SetLink($this->addlink, -1, -1); + $renderer->tcpdf->SetLink($this->addlink, -1, -1); // Print first the source number // working - if ($renderer->getRTL()) { - $renderer->writeHTML('<span> .' . $this->num . '</span>', false, false, false, false, ''); + if ($renderer->tcpdf->getRTL()) { + $renderer->tcpdf->writeHTML('<span> .' . $this->num . '</span>', false, false, false, false, ''); } else { $temptext = '<span>' . $this->num . '. </span>' . $temptext; } @@ -68,13 +74,13 @@ class ReportPdfFootnote extends ReportBaseFootnote '<u>', '</u>', ], $temptext); - $renderer->writeHTML($temptext, true, false, true, false, ''); + $renderer->tcpdf->writeHTML($temptext, true, false, true, false, ''); } /** * Returns the height in points of the Footnote element * - * @param ReportTcpdf $renderer + * @param PdfRenderer $renderer * * @return float $h */ @@ -87,7 +93,7 @@ class ReportPdfFootnote extends ReportBaseFootnote * Splits the text into lines to fit into a giving cell * and returns the last lines width * - * @param ReportTcpdf $renderer + * @param PdfRenderer $renderer * * @return float|array */ @@ -108,7 +114,7 @@ class ReportPdfFootnote extends ReportBaseFootnote } // Get the line width - $lw = ceil($renderer->GetStringWidth($this->numText)); + $lw = ceil($renderer->tcpdf->GetStringWidth($this->numText)); // Line Feed counter - Number of lines in the text $lfct = substr_count($this->numText, "\n") + 1; // If there is still remaining wrap width... @@ -121,7 +127,7 @@ class ReportPdfFootnote extends ReportBaseFootnote // Go throught the text line by line foreach ($lines as $line) { // Line width in points - $lw = ceil($renderer->GetStringWidth($line)); + $lw = ceil($renderer->tcpdf->GetStringWidth($line)); // If the line has to be wraped if ($lw >= $wrapWidthRemaining) { $words = explode(' ', $line); @@ -129,16 +135,16 @@ class ReportPdfFootnote extends ReportBaseFootnote $lw = 0; foreach ($words as $word) { $addspace--; - $lw += ceil($renderer->GetStringWidth($word . ' ')); + $lw += ceil($renderer->tcpdf->GetStringWidth($word . ' ')); if ($lw < $wrapWidthRemaining) { $newtext .= $word; - if ($addspace != 0) { + if ($addspace !== 0) { $newtext .= ' '; } } else { - $lw = $renderer->GetStringWidth($word . ' '); + $lw = $renderer->tcpdf->GetStringWidth($word . ' '); $newtext .= "\n$word"; - if ($addspace != 0) { + if ($addspace !== 0) { $newtext .= ' '; } // Reset the wrap width to the cell width diff --git a/app/Report/ReportPdfHtml.php b/app/Report/ReportPdfHtml.php index cd8746ea67..f44c4eb59f 100644 --- a/app/Report/ReportPdfHtml.php +++ b/app/Report/ReportPdfHtml.php @@ -27,8 +27,8 @@ class ReportPdfHtml extends ReportBaseHtml /** * Render the output. * - * @param $renderer - * @param bool $sub + * @param PdfRenderer $renderer + * @param bool $sub * * @return string|void */ @@ -57,6 +57,6 @@ class ReportPdfHtml extends ReportBaseHtml if ($sub) { return $this->text; } - $renderer->writeHTML($this->text); //prints 2 empty cells in the Expanded Relatives report + $renderer->tcpdf->writeHTML($this->text); //prints 2 empty cells in the Expanded Relatives report } } diff --git a/app/Report/ReportPdfImage.php b/app/Report/ReportPdfImage.php index a4075667f4..8c94cb3dff 100644 --- a/app/Report/ReportPdfImage.php +++ b/app/Report/ReportPdfImage.php @@ -27,7 +27,7 @@ class ReportPdfImage extends ReportBaseImage /** * PDF image renderer * - * @param ReportTcpdf $renderer + * @param PdfRenderer $renderer * * @return void */ @@ -37,34 +37,32 @@ class ReportPdfImage extends ReportBaseImage // Check for a pagebreak first if ($renderer->checkPageBreakPDF($this->height + 5)) { - $this->y = $renderer->GetY(); + $this->y = $renderer->tcpdf->GetY(); } - $curx = $renderer->GetX(); + $curx = $renderer->tcpdf->GetX(); // Get the current positions if ($this->x === ReportBaseElement::CURRENT_POSITION) { - $this->x = $renderer->GetX(); + $this->x = $renderer->tcpdf->GetX(); } else { // For static position add margin $this->x = $renderer->addMarginX($this->x); - $renderer->SetX($curx); + $renderer->tcpdf->SetX($curx); } if ($this->y === ReportBaseElement::CURRENT_POSITION) { //-- first check for a collision with the last picture - if (isset($lastpicbottom)) { - if ($renderer->PageNo() === $lastpicpage && $lastpicbottom >= $renderer->GetY() && $this->x >= $lastpicleft && $this->x <= $lastpicright) { - $renderer->SetY($lastpicbottom + 5); - } + if ($lastpicbottom !== null && $renderer->tcpdf->PageNo() === $lastpicpage && $lastpicbottom >= $renderer->tcpdf->GetY() && $this->x >= $lastpicleft && $this->x <= $lastpicright) { + $renderer->tcpdf->SetY($lastpicbottom + 5); } - $this->y = $renderer->GetY(); + $this->y = $renderer->tcpdf->GetY(); } else { - $renderer->SetY($this->y); + $renderer->tcpdf->SetY($this->y); } - if ($renderer->getRTL()) { - $renderer->Image( + if ($renderer->tcpdf->getRTL()) { + $renderer->tcpdf->Image( $this->file, - $renderer->getPageWidth() - $this->x, + $renderer->tcpdf->getPageWidth() - $this->x, $this->y, $this->width, $this->height, @@ -76,7 +74,7 @@ class ReportPdfImage extends ReportBaseImage $this->align ); } else { - $renderer->Image( + $renderer->tcpdf->Image( $this->file, $this->x, $this->y, @@ -90,38 +88,14 @@ class ReportPdfImage extends ReportBaseImage $this->align ); } - $lastpicpage = $renderer->PageNo(); - $renderer->lastpicpage = $renderer->getPage(); + $lastpicpage = $renderer->tcpdf->PageNo(); + $renderer->lastpicpage = $renderer->tcpdf->getPage(); $lastpicleft = $this->x; $lastpicright = $this->x + $this->width; $lastpicbottom = $this->y + $this->height; // Setup for the next line if ($this->line === 'N') { - $renderer->SetY($lastpicbottom); + $renderer->tcpdf->SetY($lastpicbottom); } } - - /** - * Get the image height - * - * @param ReportTcpdf $renderer - * - * @return float - */ - public function getHeight($renderer): float - { - return $this->height; - } - - /** - * Get the image width. - * - * @param $renderer - * - * @return float|array - */ - public function getWidth($renderer) - { - return $this->width; - } } diff --git a/app/Report/ReportPdfLine.php b/app/Report/ReportPdfLine.php index be6938f382..cdf29f8c65 100644 --- a/app/Report/ReportPdfLine.php +++ b/app/Report/ReportPdfLine.php @@ -27,28 +27,28 @@ class ReportPdfLine extends ReportBaseLine /** * PDF line renderer * - * @param ReportTcpdf $renderer + * @param PdfRenderer $renderer * * @return void */ public function render($renderer) { if ($this->x1 === ReportBaseElement::CURRENT_POSITION) { - $this->x1 = $renderer->GetX(); + $this->x1 = $renderer->tcpdf->GetX(); } if ($this->y1 === ReportBaseElement::CURRENT_POSITION) { - $this->y1 = $renderer->GetY(); + $this->y1 = $renderer->tcpdf->GetY(); } if ($this->x2 === ReportBaseElement::CURRENT_POSITION) { $this->x2 = $renderer->getMaxLineWidth(); } if ($this->y2 === ReportBaseElement::CURRENT_POSITION) { - $this->y2 = $renderer->GetY(); + $this->y2 = $renderer->tcpdf->GetY(); } - if ($renderer->getRTL()) { - $renderer->Line($renderer->getPageWidth() - $this->x1, $this->y1, $renderer->getPageWidth() - $this->x2, $this->y2); + if ($renderer->tcpdf->getRTL()) { + $renderer->tcpdf->Line($renderer->tcpdf->getPageWidth() - $this->x1, $this->y1, $renderer->tcpdf->getPageWidth() - $this->x2, $this->y2); } else { - $renderer->Line($this->x1, $this->y1, $this->x2, $this->y2); + $renderer->tcpdf->Line($this->x1, $this->y1, $this->x2, $this->y2); } } } diff --git a/app/Report/ReportPdfPageheader.php b/app/Report/ReportPdfPageHeader.php index e907efbcdf..652fb0bd32 100644 --- a/app/Report/ReportPdfPageheader.php +++ b/app/Report/ReportPdfPageHeader.php @@ -20,14 +20,14 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Report; /** - * class ReportPdfPageheader + * class ReportPdfPageHeader */ -class ReportPdfPageheader extends ReportBasePageheader +class ReportPdfPageHeader extends ReportBasePageHeader { /** * PageHeader element renderer * - * @param ReportTcpdf $renderer + * @param PdfRenderer $renderer * * @return void */ diff --git a/app/Report/ReportPdfText.php b/app/Report/ReportPdfText.php index be7c8ee50d..1da12dbfb1 100644 --- a/app/Report/ReportPdfText.php +++ b/app/Report/ReportPdfText.php @@ -21,6 +21,13 @@ namespace Fisharebest\Webtrees\Report; use Fisharebest\Webtrees\Functions\FunctionsRtl; +use function count; +use function explode; +use function hexdec; +use function preg_match; +use function str_replace; +use function substr_count; + /** * Class ReportPdfText */ @@ -29,17 +36,17 @@ class ReportPdfText extends ReportBaseText /** * PDF Text renderer * - * @param ReportTcpdf $renderer + * @param PdfRenderer $renderer * * @return void */ public function render($renderer) { // Set up the style - if ($renderer->getCurrentStyle() != $this->styleName) { + if ($renderer->getCurrentStyle() !== $this->styleName) { $renderer->setCurrentStyle($this->styleName); } - $temptext = str_replace('#PAGENUM#', (string) $renderer->PageNo(), $this->text); + $temptext = str_replace('#PAGENUM#', (string) $renderer->tcpdf->PageNo(), $this->text); // underline «title» part of Source item $temptext = str_replace([ '«', @@ -55,9 +62,9 @@ class ReportPdfText extends ReportBaseText $r = hexdec($match[1]); $g = hexdec($match[2]); $b = hexdec($match[3]); - $renderer->SetTextColor($r, $g, $b); + $renderer->tcpdf->SetTextColor($r, $g, $b); } else { - $renderer->SetTextColor(0, 0, 0); + $renderer->tcpdf->SetTextColor(0, 0, 0); } $temptext = FunctionsRtl::spanLtrRtl($temptext); $temptext = str_replace( @@ -75,7 +82,7 @@ class ReportPdfText extends ReportBaseText ], $temptext ); - $renderer->writeHTML( + $renderer->tcpdf->writeHTML( $temptext, false, false, @@ -84,14 +91,14 @@ class ReportPdfText extends ReportBaseText '' ); //change height - line break etc. - the form is mirror on rtl pages // Reset the text color to black or it will be inherited - $renderer->SetTextColor(0, 0, 0); + $renderer->tcpdf->SetTextColor(0, 0, 0); } /** * Returns the height in points of the text element * The height is already calculated in getWidth() * - * @param ReportTcpdf $renderer + * @param PdfRenderer $renderer * * @return float */ @@ -103,14 +110,14 @@ class ReportPdfText extends ReportBaseText /** * Splits the text into lines if necessary to fit into a giving cell * - * @param ReportTcpdf $renderer + * @param PdfRenderer $renderer * * @return float|array */ public function getWidth($renderer) { // Setup the style name, a font must be selected to calculate the width - if ($renderer->getCurrentStyle() != $this->styleName) { + if ($renderer->getCurrentStyle() !== $this->styleName) { $renderer->setCurrentStyle($this->styleName); } @@ -121,7 +128,7 @@ class ReportPdfText extends ReportBaseText } // Get the line width for the text in points - $lw = $renderer->GetStringWidth($this->text); + $lw = $renderer->tcpdf->GetStringWidth($this->text); // Line Feed counter - Number of lines in the text $lfct = substr_count($this->text, "\n") + 1; // If there is still remaining wrap width... @@ -134,7 +141,7 @@ class ReportPdfText extends ReportBaseText // Go throught the text line by line foreach ($lines as $line) { // Line width in points + a little margin - $lw = $renderer->GetStringWidth($line); + $lw = $renderer->tcpdf->GetStringWidth($line); // If the line has to be wraped if ($lw > $wrapWidthRemaining) { $words = explode(' ', $line); @@ -142,16 +149,16 @@ class ReportPdfText extends ReportBaseText $lw = 0; foreach ($words as $word) { $addspace--; - $lw += $renderer->GetStringWidth($word . ' '); + $lw += $renderer->tcpdf->GetStringWidth($word . ' '); if ($lw <= $wrapWidthRemaining) { $newtext .= $word; - if ($addspace != 0) { + if ($addspace !== 0) { $newtext .= ' '; } } else { - $lw = $renderer->GetStringWidth($word . ' '); + $lw = $renderer->tcpdf->GetStringWidth($word . ' '); $newtext .= "\n$word"; - if ($addspace != 0) { + if ($addspace !== 0) { $newtext .= ' '; } // Reset the wrap width to the cell width diff --git a/app/Report/ReportPdfTextbox.php b/app/Report/ReportPdfTextBox.php index a12e4894ec..958803edeb 100644 --- a/app/Report/ReportPdfTextbox.php +++ b/app/Report/ReportPdfTextBox.php @@ -19,15 +19,24 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Report; +use function count; +use function hexdec; +use function is_array; +use function is_object; +use function ksort; +use function preg_match; +use function str_replace; +use function trim; + /** - * Class ReportPdfTextbox + * Class ReportPdfTextBox */ -class ReportPdfTextbox extends ReportBaseTextbox +class ReportPdfTextBox extends ReportBaseTextbox { /** * PDF Text Box renderer * - * @param ReportTcpdf $renderer + * @param PdfRenderer $renderer * * @return void */ @@ -118,7 +127,7 @@ class ReportPdfTextbox extends ReportBaseTextbox // If current position (left) if ($this->left === ReportBaseElement::CURRENT_POSITION) { - $cX = $renderer->GetX(); + $cX = $renderer->tcpdf->GetX(); } else { // For static position add margin (returns and updates X) $cX = $renderer->addMarginX($this->left); @@ -126,10 +135,10 @@ class ReportPdfTextbox extends ReportBaseTextbox // If current position (top) if ($this->top === ReportBaseElement::CURRENT_POSITION) { - $cY = $renderer->GetY(); + $cY = $renderer->tcpdf->GetY(); } else { $cY = $this->top; - $renderer->SetY($cY); + $renderer->tcpdf->SetY($cY); } // Check the width if set to page wide OR set by xml to larger then page width (margin) @@ -140,7 +149,7 @@ class ReportPdfTextbox extends ReportBaseTextbox } // Save the original margins - $cM = $renderer->getMargins(); + $cM = $renderer->tcpdf->getMargins(); // Use cell padding to wrap the width // Temp Width with cell padding if (is_array($cM['cell'])) { @@ -194,7 +203,7 @@ class ReportPdfTextbox extends ReportBaseTextbox // Check if this is text or some other element, like images if ($eH == 0) { // This is text elements. Number of LF but at least one line - $cHT = ($cHT + 1) * $renderer->getCellHeightRatio(); + $cHT = ($cHT + 1) * $renderer->tcpdf->getCellHeightRatio(); // Calculate the cell hight with the largest font size used within this Box $cHT *= $renderer->largestFontHeight; // Add cell padding @@ -222,7 +231,7 @@ class ReportPdfTextbox extends ReportBaseTextbox // Reset last cell height or Header/Footer will inherit it, in case of pagebreak $renderer->lastCellHeight = 0; if ($renderer->checkPageBreakPDF($cH)) { - $cY = $renderer->GetY(); + $cY = $renderer->tcpdf->GetY(); } } @@ -234,65 +243,63 @@ class ReportPdfTextbox extends ReportBaseTextbox $match = []; // Fill the background if ($this->fill) { - if (!empty($this->bgcolor)) { - if (preg_match('/#?(..)(..)(..)/', $this->bgcolor, $match)) { - $cS .= 'F'; // F: Fill the background - $r = hexdec($match[1]); - $g = hexdec($match[2]); - $b = hexdec($match[3]); - $renderer->SetFillColor($r, $g, $b); - } + if (preg_match('/#?(..)(..)(..)/', $this->bgcolor, $match)) { + $cS .= 'F'; // F: Fill the background + $r = hexdec($match[1]); + $g = hexdec($match[2]); + $b = hexdec($match[3]); + $renderer->tcpdf->SetFillColor($r, $g, $b); } } // Clean up a bit unset($lw, $w, $match, $cE, $eH); // Draw the border if (!empty($cS)) { - if (!$renderer->getRTL()) { + if (!$renderer->tcpdf->getRTL()) { $cXM = $cX; } else { - $cXM = $renderer->getPageWidth() - $cX - $cW; + $cXM = $renderer->tcpdf->getPageWidth() - $cX - $cW; } - $renderer->Rect($cXM, $cY, $cW, $cH, $cS); + $renderer->tcpdf->Rect($cXM, $cY, $cW, $cH, $cS); } // Add cell padding if set and if any text (element) exist if ($this->padding) { if ($cHT > 0) { if (is_array($cM['cell'])) { - $renderer->SetY($cY + $cM['padding_top']); + $renderer->tcpdf->SetY($cY + $cM['padding_top']); } else { - $renderer->SetY($cY + $cM['cell']); + $renderer->tcpdf->SetY($cY + $cM['cell']); } } } // Change the margins X, Width - if (!$renderer->getRTL()) { + if (!$renderer->tcpdf->getRTL()) { if ($this->padding) { if (is_array($cM['cell'])) { - $renderer->SetLeftMargin($cX + $cM['padding_left']); + $renderer->tcpdf->SetLeftMargin($cX + $cM['padding_left']); } else { - $renderer->SetLeftMargin($cX + $cM['cell']); + $renderer->tcpdf->SetLeftMargin($cX + $cM['cell']); } - $renderer->SetRightMargin($renderer->getRemainingWidthPDF() - $cW + $cM['right']); + $renderer->tcpdf->SetRightMargin($renderer->getRemainingWidthPDF() - $cW + $cM['right']); } else { - $renderer->SetLeftMargin($cX); - $renderer->SetRightMargin($renderer->getRemainingWidthPDF() - $cW + $cM['right']); + $renderer->tcpdf->SetLeftMargin($cX); + $renderer->tcpdf->SetRightMargin($renderer->getRemainingWidthPDF() - $cW + $cM['right']); } } else { if ($this->padding) { if (is_array($cM['cell'])) { - $renderer->SetRightMargin($cX + $cM['padding_right']); + $renderer->tcpdf->SetRightMargin($cX + $cM['padding_right']); } else { - $renderer->SetRightMargin($cX + $cM['cell']); + $renderer->tcpdf->SetRightMargin($cX + $cM['cell']); } - $renderer->SetLeftMargin($renderer->getRemainingWidthPDF() - $cW + $cM['left']); + $renderer->tcpdf->SetLeftMargin($renderer->getRemainingWidthPDF() - $cW + $cM['left']); } else { - $renderer->SetRightMargin($cX); - $renderer->SetLeftMargin($renderer->getRemainingWidthPDF() - $cW + $cM['left']); + $renderer->tcpdf->SetRightMargin($cX); + $renderer->tcpdf->SetLeftMargin($renderer->getRemainingWidthPDF() - $cW + $cM['left']); } } // Save the current page number - $cPN = $renderer->getPage(); + $cPN = $renderer->tcpdf->getPage(); // Render the elements (write text, print picture...) foreach ($this->elements as $element) { @@ -305,25 +312,25 @@ class ReportPdfTextbox extends ReportBaseTextbox } } // Restore the margins - $renderer->SetLeftMargin($cM['left']); - $renderer->SetRightMargin($cM['right']); + $renderer->tcpdf->SetLeftMargin($cM['left']); + $renderer->tcpdf->SetRightMargin($cM['right']); // This will be mostly used to trick the multiple images last height if ($this->reseth) { $cH = 0; // This can only happen with multiple images and with pagebreak - if ($cPN != $renderer->getPage()) { - $renderer->setPage($cPN); + if ($cPN != $renderer->tcpdf->getPage()) { + $renderer->tcpdf->setPage($cPN); } } // New line and some clean up if (!$this->newline) { - $renderer->SetXY($cX + $cW, $cY); + $renderer->tcpdf->SetXY($cX + $cW, $cY); $renderer->lastCellHeight = $cH; } else { // addMarginX() also updates X $renderer->addMarginX(0); - $renderer->SetY($cY + $cH); + $renderer->tcpdf->SetY($cY + $cH); $renderer->lastCellHeight = 0; } } diff --git a/app/Report/ReportTcpdf.php b/app/Report/ReportTcpdf.php deleted file mode 100644 index 59679cec70..0000000000 --- a/app/Report/ReportTcpdf.php +++ /dev/null @@ -1,450 +0,0 @@ -<?php - -/** - * webtrees: online genealogy - * Copyright (C) 2019 webtrees development team - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -declare(strict_types=1); - -namespace Fisharebest\Webtrees\Report; - -use TCPDF; - -/** - * WT Report PDF Class - * - * This class inherits from the TCPDF class and is used to generate the PDF document - */ -class ReportTcpdf extends TCPDF -{ - /** @var ReportBaseElement[] Array of elements in the header */ - public $headerElements = []; - - /** @var ReportBaseElement[] Array of elements in the page header */ - public $pageHeaderElements = []; - - /** @var ReportBaseElement[] Array of elements in the footer */ - public $footerElements = []; - - /** @var ReportBaseElement[] Array of elements in the body */ - public $bodyElements = []; - - /** @var ReportPdfFootnote[] Array of elements in the footer notes */ - public $printedfootnotes = []; - - /** @var string Currently used style name */ - public $currentStyle = ''; - - /** @var float The last cell height */ - public $lastCellHeight = 0; - - /** @var float The largest font size within a TextBox to calculate the height */ - public $largestFontHeight = 0; - - /** @var int The last pictures page number */ - public $lastpicpage = 0; - - /** @var ReportPdf The current report. */ - public $wt_report; - - /** - * PDF Header -PDF - * - * @return void - */ - public function header() - { - foreach ($this->headerElements as $element) { - if ($element instanceof ReportBaseElement) { - $element->render($this); - } elseif ($element === 'footnotetexts') { - $this->footnotes(); - } elseif ($element === 'addpage') { - $this->newPage(); - } - } - - foreach ($this->pageHeaderElements as $element) { - if ($element instanceof ReportBaseElement) { - $element->render($this); - } elseif ($element === 'footnotetexts') { - $this->footnotes(); - } elseif ($element === 'addpage') { - $this->newPage(); - } - } - } - - /** - * PDF Body -PDF - * - * @return void - */ - public function body() - { - $this->AddPage(); - - foreach ($this->bodyElements as $key => $element) { - if ($element instanceof ReportBaseElement) { - $element->render($this); - } elseif ($element === 'footnotetexts') { - $this->footnotes(); - } elseif ($element === 'addpage') { - $this->newPage(); - } - } - } - - /** - * PDF Footnotes -PDF - * - * @return void - */ - public function footnotes() - { - foreach ($this->printedfootnotes as $element) { - if (($this->GetY() + $element->getFootnoteHeight($this)) > $this->getPageHeight()) { - $this->AddPage(); - } - - $element->renderFootnote($this); - - if ($this->GetY() > $this->getPageHeight()) { - $this->AddPage(); - } - } - } - - /** - * PDF Footer -PDF - * - * @return void - */ - public function footer() - { - foreach ($this->footerElements as $element) { - if ($element instanceof ReportBaseElement) { - $element->render($this); - } elseif ($element === 'footnotetexts') { - $this->footnotes(); - } elseif ($element === 'addpage') { - $this->newPage(); - } - } - } - - /** - * Add an element to the Header -PDF - * - * @param ReportBaseElement|string $element - * - * @return void - */ - public function addHeader($element) - { - $this->headerElements[] = $element; - } - - /** - * Add an element to the Page Header -PDF - * - * @param ReportBaseElement|string $element - * - * @return void - */ - public function addPageHeader($element) - { - $this->pageHeaderElements[] = $element; - } - - /** - * Add an element to the Body -PDF - * - * @param ReportBaseElement|string $element - * - * @return void - */ - public function addBody($element) - { - $this->bodyElements[] = $element; - } - - /** - * Add an element to the Footer -PDF - * - * @param ReportBaseElement|string $element - * - * @return void - */ - public function addFooter($element) - { - $this->footerElements[] = $element; - } - - /** - * Remove the header. - * - * @param int $index - * - * @return void - */ - public function removeHeader(int $index) - { - unset($this->headerElements[$index]); - } - - /** - * Remove the page header. - * - * @param int $index - * - * @return void - */ - public function removePageHeader(int $index) - { - unset($this->pageHeaderElements[$index]); - } - - /** - * Remove the body. - * - * @param int $index - * - * @return void - */ - public function removeBody(int $index) - { - unset($this->bodyElements[$index]); - } - - /** - * Remove the footer. - * - * @param int $index - * - * @return void - */ - public function removeFooter(int $index) - { - unset($this->footerElements[$index]); - } - - /** - * Clear the Header -PDF - * - * @return void - */ - public function clearHeader() - { - unset($this->headerElements); - $this->headerElements = []; - } - - /** - * Clear the Page Header -PDF - * - * @return void - */ - public function clearPageHeader() - { - unset($this->pageHeaderElements); - $this->pageHeaderElements = []; - } - - /** - * Set the report. - * - * @param ReportPdf $report - * - * @return void - */ - public function setReport(ReportPdf $report) - { - $this->wt_report = $report; - } - - /** - * Get the currently used style name -PDF - * - * @return string - */ - public function getCurrentStyle(): string - { - return $this->currentStyle; - } - - /** - * Setup a style for usage -PDF - * - * @param string $s Style name - * - * @return void - */ - public function setCurrentStyle(string $s) - { - $this->currentStyle = $s; - $style = $this->wt_report->getStyle($s); - $this->SetFont($style['font'], $style['style'], $style['size']); - } - - /** - * Get the style -PDF - * - * @param string $s Style name - * - * @return array - */ - public function getStyle(string $s): array - { - if (!isset($this->wt_report->styles[$s])) { - $s = $this->getCurrentStyle(); - $this->wt_report->styles[$s] = $s; - } - - return $this->wt_report->styles[$s]; - } - - /** - * Add margin when static horizontal position is used -PDF - * RTL supported - * - * @param float $x Static position - * - * @return float - */ - public function addMarginX(float $x): float - { - $m = $this->getMargins(); - if ($this->getRTL()) { - $x += $m['right']; - } else { - $x += $m['left']; - } - $this->SetX($x); - - return $x; - } - - /** - * Get the maximum line width to draw from the curren position -PDF - * RTL supported - * - * @return float - */ - public function getMaxLineWidth() - { - $m = $this->getMargins(); - if ($this->getRTL()) { - return ($this->getRemainingWidth() + $m['right']); - } - - return ($this->getRemainingWidth() + $m['left']); - } - - /** - * Get the height of the footnote. - * - * @return float - */ - public function getFootnotesHeight(): float - { - $h = 0; - foreach ($this->printedfootnotes as $element) { - $h += $element->getHeight($this); - } - - return $h; - } - - /** - * Returns the the current font size height -PDF - * - * @return float - */ - public function getCurrentStyleHeight(): float - { - if ($this->currentStyle === '') { - return $this->wt_report->default_font_size; - } - $style = $this->wt_report->getStyle($this->currentStyle); - - return (float) $style['size']; - } - - /** - * Checks the Footnote and numbers them - * - * @param ReportPdfFootnote $footnote - * - * @return ReportPdfFootnote|bool object if already numbered, false otherwise - */ - public function checkFootnote(ReportPdfFootnote $footnote) - { - $ct = count($this->printedfootnotes); - $val = $footnote->getValue(); - $i = 0; - while ($i < $ct) { - if ($this->printedfootnotes[$i]->getValue() == $val) { - // If this footnote already exist then set up the numbers for this object - $footnote->setNum($i + 1); - $footnote->setAddlink((string) ($i + 1)); - - return $this->printedfootnotes[$i]; - } - $i++; - } - // If this Footnote has not been set up yet - $footnote->setNum($ct + 1); - $footnote->setAddlink((string) $this->AddLink()); - $this->printedfootnotes[] = $footnote; - - return false; - } - - /** - * Used this function instead of AddPage() - * This function will make sure that images will not be overwritten - * - * @return void - */ - public function newPage() - { - if ($this->lastpicpage > $this->getPage()) { - $this->setPage($this->lastpicpage); - } - $this->AddPage(); - } - - /** - * Add a page if needed -PDF - * - * @param float $height Cell height - * - * @return bool true in case of page break, false otherwise - */ - public function checkPageBreakPDF(float $height): bool - { - return $this->checkPageBreak($height); - } - - /** - * Returns the remaining width between the current position and margins -PDF - * - * @return float Remaining width - */ - public function getRemainingWidthPDF(): float - { - return $this->getRemainingWidth(); - } -} diff --git a/app/Report/TcpdfWrapper.php b/app/Report/TcpdfWrapper.php new file mode 100644 index 0000000000..e50b8c0873 --- /dev/null +++ b/app/Report/TcpdfWrapper.php @@ -0,0 +1,52 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2019 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +declare(strict_types=1); + +namespace Fisharebest\Webtrees\Report; + +use TCPDF; + +/** + * Class TcpdfWrapper + */ +class TcpdfWrapper extends TCPDF +{ + /** + * Expose protected method in base class. + * + * @return float Return the remaining width + */ + public function getRemainingWidth(): float + { + return parent::getRemainingWidth(); + } + + /** + * Expose protected method in base class. + * + * @param mixed $h Cell height. Default value: 0. + * @param mixed $y Starting y position, leave empty for current position. + * @param bool $add_page If true add a page, otherwise only return the true/false state + * + * @return boolean true in case of page break, false otherwise. + */ + public function checkPageBreak($h = 0, $y = '', $add_page = true): bool + { + return parent::checkPageBreak($h, $y, $add_page); + } +} diff --git a/tests/app/Module/AhnentafelReportModuleTest.php b/tests/app/Module/AhnentafelReportModuleTest.php index 60e956a4d0..aa2a39ac34 100644 --- a/tests/app/Module/AhnentafelReportModuleTest.php +++ b/tests/app/Module/AhnentafelReportModuleTest.php @@ -20,10 +20,10 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Auth; -use Fisharebest\Webtrees\Report\ReportHtml; +use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Report\ReportPdf; +use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\User; @@ -36,38 +36,38 @@ use League\Flysystem\Filesystem; * * @covers \Fisharebest\Webtrees\Module\AhnentafelReportModule * @covers \Fisharebest\Webtrees\Module\ModuleReportTrait - * @covers \Fisharebest\Webtrees\Report\AbstractReport + * @covers \Fisharebest\Webtrees\Report\AbstractRenderer * @covers \Fisharebest\Webtrees\Report\ReportBaseCell * @covers \Fisharebest\Webtrees\Report\ReportBaseElement * @covers \Fisharebest\Webtrees\Report\ReportBaseFootnote * @covers \Fisharebest\Webtrees\Report\ReportBaseHtml * @covers \Fisharebest\Webtrees\Report\ReportBaseImage * @covers \Fisharebest\Webtrees\Report\ReportBaseLine - * @covers \Fisharebest\Webtrees\Report\ReportBasePageheader + * @covers \Fisharebest\Webtrees\Report\ReportBasePageHeader * @covers \Fisharebest\Webtrees\Report\ReportBaseText * @covers \Fisharebest\Webtrees\Report\ReportBaseTextbox * @covers \Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider - * @covers \Fisharebest\Webtrees\Report\ReportHtml + * @covers \Fisharebest\Webtrees\Report\HtmlRenderer * @covers \Fisharebest\Webtrees\Report\ReportHtmlCell * @covers \Fisharebest\Webtrees\Report\ReportHtmlFootnote * @covers \Fisharebest\Webtrees\Report\ReportHtmlHtml * @covers \Fisharebest\Webtrees\Report\ReportHtmlImage * @covers \Fisharebest\Webtrees\Report\ReportHtmlLine - * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageheader + * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageHeader * @covers \Fisharebest\Webtrees\Report\ReportHtmlText * @covers \Fisharebest\Webtrees\Report\ReportHtmlTextbox * @covers \Fisharebest\Webtrees\Report\ReportParserBase * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate * @covers \Fisharebest\Webtrees\Report\ReportParserSetup - * @covers \Fisharebest\Webtrees\Report\ReportPdf + * @covers \Fisharebest\Webtrees\Report\PdfRenderer * @covers \Fisharebest\Webtrees\Report\ReportPdfCell * @covers \Fisharebest\Webtrees\Report\ReportPdfFootnote * @covers \Fisharebest\Webtrees\Report\ReportPdfHtml * @covers \Fisharebest\Webtrees\Report\ReportPdfImage * @covers \Fisharebest\Webtrees\Report\ReportPdfLine - * @covers \Fisharebest\Webtrees\Report\ReportPdfPageheader + * @covers \Fisharebest\Webtrees\Report\ReportPdfPageHeader * @covers \Fisharebest\Webtrees\Report\ReportPdfText - * @covers \Fisharebest\Webtrees\Report\ReportPdfTextbox + * @covers \Fisharebest\Webtrees\Report\ReportPdfTextBox * @covers \Fisharebest\Webtrees\Report\ReportTcpdf */ class AhnentafelReportModuleTest extends TestCase @@ -102,13 +102,13 @@ class AhnentafelReportModuleTest extends TestCase $this->assertIsArray($report->reportProperties()); ob_start(); - new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree, $data_filesystem); $html = ob_get_clean(); $this->assertStringStartsWith('<', $html); $this->assertStringEndsWith('>', $html); ob_start(); - new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new PdfRenderer(), $vars, $tree, $data_filesystem); $pdf = ob_get_clean(); $this->assertStringStartsWith('%PDF', $pdf); $this->assertStringEndsWith("%%EOF\n", $pdf); diff --git a/tests/app/Module/BirthDeathMarriageReportModuleTest.php b/tests/app/Module/BirthDeathMarriageReportModuleTest.php index a10e846d91..5b14d8c161 100644 --- a/tests/app/Module/BirthDeathMarriageReportModuleTest.php +++ b/tests/app/Module/BirthDeathMarriageReportModuleTest.php @@ -19,10 +19,10 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; -use Fisharebest\Webtrees\Report\ReportHtml; +use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Report\ReportPdf; +use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\Webtrees; use League\Flysystem\Adapter\NullAdapter; @@ -33,38 +33,38 @@ use League\Flysystem\Filesystem; * * @covers \Fisharebest\Webtrees\Module\BirthDeathMarriageReportModule * @covers \Fisharebest\Webtrees\Module\ModuleReportTrait - * @covers \Fisharebest\Webtrees\Report\AbstractReport + * @covers \Fisharebest\Webtrees\Report\AbstractRenderer * @covers \Fisharebest\Webtrees\Report\ReportBaseCell * @covers \Fisharebest\Webtrees\Report\ReportBaseElement * @covers \Fisharebest\Webtrees\Report\ReportBaseFootnote * @covers \Fisharebest\Webtrees\Report\ReportBaseHtml * @covers \Fisharebest\Webtrees\Report\ReportBaseImage * @covers \Fisharebest\Webtrees\Report\ReportBaseLine - * @covers \Fisharebest\Webtrees\Report\ReportBasePageheader + * @covers \Fisharebest\Webtrees\Report\ReportBasePageHeader * @covers \Fisharebest\Webtrees\Report\ReportBaseText * @covers \Fisharebest\Webtrees\Report\ReportBaseTextbox * @covers \Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider - * @covers \Fisharebest\Webtrees\Report\ReportHtml + * @covers \Fisharebest\Webtrees\Report\HtmlRenderer * @covers \Fisharebest\Webtrees\Report\ReportHtmlCell * @covers \Fisharebest\Webtrees\Report\ReportHtmlFootnote * @covers \Fisharebest\Webtrees\Report\ReportHtmlHtml * @covers \Fisharebest\Webtrees\Report\ReportHtmlImage * @covers \Fisharebest\Webtrees\Report\ReportHtmlLine - * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageheader + * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageHeader * @covers \Fisharebest\Webtrees\Report\ReportHtmlText * @covers \Fisharebest\Webtrees\Report\ReportHtmlTextbox * @covers \Fisharebest\Webtrees\Report\ReportParserBase * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate * @covers \Fisharebest\Webtrees\Report\ReportParserSetup - * @covers \Fisharebest\Webtrees\Report\ReportPdf + * @covers \Fisharebest\Webtrees\Report\PdfRenderer * @covers \Fisharebest\Webtrees\Report\ReportPdfCell * @covers \Fisharebest\Webtrees\Report\ReportPdfFootnote * @covers \Fisharebest\Webtrees\Report\ReportPdfHtml * @covers \Fisharebest\Webtrees\Report\ReportPdfImage * @covers \Fisharebest\Webtrees\Report\ReportPdfLine - * @covers \Fisharebest\Webtrees\Report\ReportPdfPageheader + * @covers \Fisharebest\Webtrees\Report\ReportPdfPageHeader * @covers \Fisharebest\Webtrees\Report\ReportPdfText - * @covers \Fisharebest\Webtrees\Report\ReportPdfTextbox + * @covers \Fisharebest\Webtrees\Report\ReportPdfTextBox * @covers \Fisharebest\Webtrees\Report\ReportTcpdf */ class BirthDeathMarriageReportModuleTest extends TestCase @@ -95,13 +95,13 @@ class BirthDeathMarriageReportModuleTest extends TestCase $this->assertIsArray($report->reportProperties()); ob_start(); - new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree, $data_filesystem); $html = ob_get_clean(); $this->assertStringStartsWith('<', $html); $this->assertStringEndsWith('>', $html); ob_start(); - new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new PdfRenderer(), $vars, $tree, $data_filesystem); $pdf = ob_get_clean(); $this->assertStringStartsWith('%PDF', $pdf); $this->assertStringEndsWith("%%EOF\n", $pdf); diff --git a/tests/app/Module/BirthReportModuleTest.php b/tests/app/Module/BirthReportModuleTest.php index dde50c493d..84419ff784 100644 --- a/tests/app/Module/BirthReportModuleTest.php +++ b/tests/app/Module/BirthReportModuleTest.php @@ -20,10 +20,10 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Auth; -use Fisharebest\Webtrees\Report\ReportHtml; +use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Report\ReportPdf; +use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\User; @@ -36,38 +36,38 @@ use League\Flysystem\Filesystem; * * @covers \Fisharebest\Webtrees\Module\BirthReportModule * @covers \Fisharebest\Webtrees\Module\ModuleReportTrait - * @covers \Fisharebest\Webtrees\Report\AbstractReport + * @covers \Fisharebest\Webtrees\Report\AbstractRenderer * @covers \Fisharebest\Webtrees\Report\ReportBaseCell * @covers \Fisharebest\Webtrees\Report\ReportBaseElement * @covers \Fisharebest\Webtrees\Report\ReportBaseFootnote * @covers \Fisharebest\Webtrees\Report\ReportBaseHtml * @covers \Fisharebest\Webtrees\Report\ReportBaseImage * @covers \Fisharebest\Webtrees\Report\ReportBaseLine - * @covers \Fisharebest\Webtrees\Report\ReportBasePageheader + * @covers \Fisharebest\Webtrees\Report\ReportBasePageHeader * @covers \Fisharebest\Webtrees\Report\ReportBaseText * @covers \Fisharebest\Webtrees\Report\ReportBaseTextbox * @covers \Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider - * @covers \Fisharebest\Webtrees\Report\ReportHtml + * @covers \Fisharebest\Webtrees\Report\HtmlRenderer * @covers \Fisharebest\Webtrees\Report\ReportHtmlCell * @covers \Fisharebest\Webtrees\Report\ReportHtmlFootnote * @covers \Fisharebest\Webtrees\Report\ReportHtmlHtml * @covers \Fisharebest\Webtrees\Report\ReportHtmlImage * @covers \Fisharebest\Webtrees\Report\ReportHtmlLine - * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageheader + * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageHeader * @covers \Fisharebest\Webtrees\Report\ReportHtmlText * @covers \Fisharebest\Webtrees\Report\ReportHtmlTextbox * @covers \Fisharebest\Webtrees\Report\ReportParserBase * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate * @covers \Fisharebest\Webtrees\Report\ReportParserSetup - * @covers \Fisharebest\Webtrees\Report\ReportPdf + * @covers \Fisharebest\Webtrees\Report\PdfRenderer * @covers \Fisharebest\Webtrees\Report\ReportPdfCell * @covers \Fisharebest\Webtrees\Report\ReportPdfFootnote * @covers \Fisharebest\Webtrees\Report\ReportPdfHtml * @covers \Fisharebest\Webtrees\Report\ReportPdfImage * @covers \Fisharebest\Webtrees\Report\ReportPdfLine - * @covers \Fisharebest\Webtrees\Report\ReportPdfPageheader + * @covers \Fisharebest\Webtrees\Report\ReportPdfPageHeader * @covers \Fisharebest\Webtrees\Report\ReportPdfText - * @covers \Fisharebest\Webtrees\Report\ReportPdfTextbox + * @covers \Fisharebest\Webtrees\Report\ReportPdfTextBox * @covers \Fisharebest\Webtrees\Report\ReportTcpdf */ class BirthReportModuleTest extends TestCase @@ -100,13 +100,13 @@ class BirthReportModuleTest extends TestCase $this->assertIsArray($report->reportProperties()); ob_start(); - new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree, $data_filesystem); $html = ob_get_clean(); $this->assertStringStartsWith('<', $html); $this->assertStringEndsWith('>', $html); ob_start(); - new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new PdfRenderer(), $vars, $tree, $data_filesystem); $pdf = ob_get_clean(); $this->assertStringStartsWith('%PDF', $pdf); $this->assertStringEndsWith("%%EOF\n", $pdf); diff --git a/tests/app/Module/CemeteryReportModuleTest.php b/tests/app/Module/CemeteryReportModuleTest.php index 6c99165a57..6102bc9bcf 100644 --- a/tests/app/Module/CemeteryReportModuleTest.php +++ b/tests/app/Module/CemeteryReportModuleTest.php @@ -20,10 +20,10 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Auth; -use Fisharebest\Webtrees\Report\ReportHtml; +use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Report\ReportPdf; +use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\User; @@ -36,38 +36,38 @@ use League\Flysystem\Filesystem; * * @covers \Fisharebest\Webtrees\Module\CemeteryReportModule * @covers \Fisharebest\Webtrees\Module\ModuleReportTrait - * @covers \Fisharebest\Webtrees\Report\AbstractReport + * @covers \Fisharebest\Webtrees\Report\AbstractRenderer * @covers \Fisharebest\Webtrees\Report\ReportBaseCell * @covers \Fisharebest\Webtrees\Report\ReportBaseElement * @covers \Fisharebest\Webtrees\Report\ReportBaseFootnote * @covers \Fisharebest\Webtrees\Report\ReportBaseHtml * @covers \Fisharebest\Webtrees\Report\ReportBaseImage * @covers \Fisharebest\Webtrees\Report\ReportBaseLine - * @covers \Fisharebest\Webtrees\Report\ReportBasePageheader + * @covers \Fisharebest\Webtrees\Report\ReportBasePageHeader * @covers \Fisharebest\Webtrees\Report\ReportBaseText * @covers \Fisharebest\Webtrees\Report\ReportBaseTextbox * @covers \Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider - * @covers \Fisharebest\Webtrees\Report\ReportHtml + * @covers \Fisharebest\Webtrees\Report\HtmlRenderer * @covers \Fisharebest\Webtrees\Report\ReportHtmlCell * @covers \Fisharebest\Webtrees\Report\ReportHtmlFootnote * @covers \Fisharebest\Webtrees\Report\ReportHtmlHtml * @covers \Fisharebest\Webtrees\Report\ReportHtmlImage * @covers \Fisharebest\Webtrees\Report\ReportHtmlLine - * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageheader + * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageHeader * @covers \Fisharebest\Webtrees\Report\ReportHtmlText * @covers \Fisharebest\Webtrees\Report\ReportHtmlTextbox * @covers \Fisharebest\Webtrees\Report\ReportParserBase * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate * @covers \Fisharebest\Webtrees\Report\ReportParserSetup - * @covers \Fisharebest\Webtrees\Report\ReportPdf + * @covers \Fisharebest\Webtrees\Report\PdfRenderer * @covers \Fisharebest\Webtrees\Report\ReportPdfCell * @covers \Fisharebest\Webtrees\Report\ReportPdfFootnote * @covers \Fisharebest\Webtrees\Report\ReportPdfHtml * @covers \Fisharebest\Webtrees\Report\ReportPdfImage * @covers \Fisharebest\Webtrees\Report\ReportPdfLine - * @covers \Fisharebest\Webtrees\Report\ReportPdfPageheader + * @covers \Fisharebest\Webtrees\Report\ReportPdfPageHeader * @covers \Fisharebest\Webtrees\Report\ReportPdfText - * @covers \Fisharebest\Webtrees\Report\ReportPdfTextbox + * @covers \Fisharebest\Webtrees\Report\ReportPdfTextBox * @covers \Fisharebest\Webtrees\Report\ReportTcpdf */ class CemeteryReportModuleTest extends TestCase @@ -98,13 +98,13 @@ class CemeteryReportModuleTest extends TestCase $this->assertIsArray($report->reportProperties()); ob_start(); - new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree, $data_filesystem); $html = ob_get_clean(); $this->assertStringStartsWith('<', $html); $this->assertStringEndsWith('>', $html); ob_start(); - new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new PdfRenderer(), $vars, $tree, $data_filesystem); $pdf = ob_get_clean(); $this->assertStringStartsWith('%PDF', $pdf); $this->assertStringEndsWith("%%EOF\n", $pdf); diff --git a/tests/app/Module/ChangeReportModuleTest.php b/tests/app/Module/ChangeReportModuleTest.php index e41b329181..4c62652b13 100644 --- a/tests/app/Module/ChangeReportModuleTest.php +++ b/tests/app/Module/ChangeReportModuleTest.php @@ -21,10 +21,10 @@ namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Auth; use Fisharebest\Webtrees\Carbon; -use Fisharebest\Webtrees\Report\ReportHtml; +use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Report\ReportPdf; +use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\User; @@ -37,38 +37,38 @@ use League\Flysystem\Filesystem; * * @covers \Fisharebest\Webtrees\Module\ChangeReportModule * @covers \Fisharebest\Webtrees\Module\ModuleReportTrait - * @covers \Fisharebest\Webtrees\Report\AbstractReport + * @covers \Fisharebest\Webtrees\Report\AbstractRenderer * @covers \Fisharebest\Webtrees\Report\ReportBaseCell * @covers \Fisharebest\Webtrees\Report\ReportBaseElement * @covers \Fisharebest\Webtrees\Report\ReportBaseFootnote * @covers \Fisharebest\Webtrees\Report\ReportBaseHtml * @covers \Fisharebest\Webtrees\Report\ReportBaseImage * @covers \Fisharebest\Webtrees\Report\ReportBaseLine - * @covers \Fisharebest\Webtrees\Report\ReportBasePageheader + * @covers \Fisharebest\Webtrees\Report\ReportBasePageHeader * @covers \Fisharebest\Webtrees\Report\ReportBaseText * @covers \Fisharebest\Webtrees\Report\ReportBaseTextbox * @covers \Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider - * @covers \Fisharebest\Webtrees\Report\ReportHtml + * @covers \Fisharebest\Webtrees\Report\HtmlRenderer * @covers \Fisharebest\Webtrees\Report\ReportHtmlCell * @covers \Fisharebest\Webtrees\Report\ReportHtmlFootnote * @covers \Fisharebest\Webtrees\Report\ReportHtmlHtml * @covers \Fisharebest\Webtrees\Report\ReportHtmlImage * @covers \Fisharebest\Webtrees\Report\ReportHtmlLine - * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageheader + * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageHeader * @covers \Fisharebest\Webtrees\Report\ReportHtmlText * @covers \Fisharebest\Webtrees\Report\ReportHtmlTextbox * @covers \Fisharebest\Webtrees\Report\ReportParserBase * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate * @covers \Fisharebest\Webtrees\Report\ReportParserSetup - * @covers \Fisharebest\Webtrees\Report\ReportPdf + * @covers \Fisharebest\Webtrees\Report\PdfRenderer * @covers \Fisharebest\Webtrees\Report\ReportPdfCell * @covers \Fisharebest\Webtrees\Report\ReportPdfFootnote * @covers \Fisharebest\Webtrees\Report\ReportPdfHtml * @covers \Fisharebest\Webtrees\Report\ReportPdfImage * @covers \Fisharebest\Webtrees\Report\ReportPdfLine - * @covers \Fisharebest\Webtrees\Report\ReportPdfPageheader + * @covers \Fisharebest\Webtrees\Report\ReportPdfPageHeader * @covers \Fisharebest\Webtrees\Report\ReportPdfText - * @covers \Fisharebest\Webtrees\Report\ReportPdfTextbox + * @covers \Fisharebest\Webtrees\Report\ReportPdfTextBox * @covers \Fisharebest\Webtrees\Report\ReportTcpdf */ class ChangeReportModuleTest extends TestCase @@ -101,13 +101,13 @@ class ChangeReportModuleTest extends TestCase $this->assertIsArray($report->reportProperties()); ob_start(); - new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree, $data_filesystem); $html = ob_get_clean(); $this->assertStringStartsWith('<', $html); $this->assertStringEndsWith('>', $html); ob_start(); - new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new PdfRenderer(), $vars, $tree, $data_filesystem); $pdf = ob_get_clean(); $this->assertStringStartsWith('%PDF', $pdf); $this->assertStringEndsWith("%%EOF\n", $pdf); diff --git a/tests/app/Module/DeathReportModuleTest.php b/tests/app/Module/DeathReportModuleTest.php index 27f6fef821..b5ec3e3862 100644 --- a/tests/app/Module/DeathReportModuleTest.php +++ b/tests/app/Module/DeathReportModuleTest.php @@ -20,10 +20,10 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Auth; -use Fisharebest\Webtrees\Report\ReportHtml; +use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Report\ReportPdf; +use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\User; @@ -36,38 +36,38 @@ use League\Flysystem\Filesystem; * * @covers \Fisharebest\Webtrees\Module\FactSourcesReportModule * @covers \Fisharebest\Webtrees\Module\ModuleReportTrait - * @covers \Fisharebest\Webtrees\Report\AbstractReport + * @covers \Fisharebest\Webtrees\Report\AbstractRenderer * @covers \Fisharebest\Webtrees\Report\ReportBaseCell * @covers \Fisharebest\Webtrees\Report\ReportBaseElement * @covers \Fisharebest\Webtrees\Report\ReportBaseFootnote * @covers \Fisharebest\Webtrees\Report\ReportBaseHtml * @covers \Fisharebest\Webtrees\Report\ReportBaseImage * @covers \Fisharebest\Webtrees\Report\ReportBaseLine - * @covers \Fisharebest\Webtrees\Report\ReportBasePageheader + * @covers \Fisharebest\Webtrees\Report\ReportBasePageHeader * @covers \Fisharebest\Webtrees\Report\ReportBaseText * @covers \Fisharebest\Webtrees\Report\ReportBaseTextbox * @covers \Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider - * @covers \Fisharebest\Webtrees\Report\ReportHtml + * @covers \Fisharebest\Webtrees\Report\HtmlRenderer * @covers \Fisharebest\Webtrees\Report\ReportHtmlCell * @covers \Fisharebest\Webtrees\Report\ReportHtmlFootnote * @covers \Fisharebest\Webtrees\Report\ReportHtmlHtml * @covers \Fisharebest\Webtrees\Report\ReportHtmlImage * @covers \Fisharebest\Webtrees\Report\ReportHtmlLine - * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageheader + * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageHeader * @covers \Fisharebest\Webtrees\Report\ReportHtmlText * @covers \Fisharebest\Webtrees\Report\ReportHtmlTextbox * @covers \Fisharebest\Webtrees\Report\ReportParserBase * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate * @covers \Fisharebest\Webtrees\Report\ReportParserSetup - * @covers \Fisharebest\Webtrees\Report\ReportPdf + * @covers \Fisharebest\Webtrees\Report\PdfRenderer * @covers \Fisharebest\Webtrees\Report\ReportPdfCell * @covers \Fisharebest\Webtrees\Report\ReportPdfFootnote * @covers \Fisharebest\Webtrees\Report\ReportPdfHtml * @covers \Fisharebest\Webtrees\Report\ReportPdfImage * @covers \Fisharebest\Webtrees\Report\ReportPdfLine - * @covers \Fisharebest\Webtrees\Report\ReportPdfPageheader + * @covers \Fisharebest\Webtrees\Report\ReportPdfPageHeader * @covers \Fisharebest\Webtrees\Report\ReportPdfText - * @covers \Fisharebest\Webtrees\Report\ReportPdfTextbox + * @covers \Fisharebest\Webtrees\Report\ReportPdfTextBox * @covers \Fisharebest\Webtrees\Report\ReportTcpdf */ class DeathReportModuleTest extends TestCase @@ -101,13 +101,13 @@ class DeathReportModuleTest extends TestCase $this->assertIsArray($report->reportProperties()); ob_start(); - new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree, $data_filesystem); $html = ob_get_clean(); $this->assertStringStartsWith('<', $html); $this->assertStringEndsWith('>', $html); ob_start(); - new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new PdfRenderer(), $vars, $tree, $data_filesystem); $pdf = ob_get_clean(); $this->assertStringStartsWith('%PDF', $pdf); $this->assertStringEndsWith("%%EOF\n", $pdf); diff --git a/tests/app/Module/DescendancyReportModuleTest.php b/tests/app/Module/DescendancyReportModuleTest.php index a1d7dec0d2..66990f20b7 100644 --- a/tests/app/Module/DescendancyReportModuleTest.php +++ b/tests/app/Module/DescendancyReportModuleTest.php @@ -20,10 +20,10 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Auth; -use Fisharebest\Webtrees\Report\ReportHtml; +use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Report\ReportPdf; +use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\User; @@ -36,38 +36,38 @@ use League\Flysystem\Filesystem; * * @covers \Fisharebest\Webtrees\Module\DescendancyReportModule * @covers \Fisharebest\Webtrees\Module\ModuleReportTrait - * @covers \Fisharebest\Webtrees\Report\AbstractReport + * @covers \Fisharebest\Webtrees\Report\AbstractRenderer * @covers \Fisharebest\Webtrees\Report\ReportBaseCell * @covers \Fisharebest\Webtrees\Report\ReportBaseElement * @covers \Fisharebest\Webtrees\Report\ReportBaseFootnote * @covers \Fisharebest\Webtrees\Report\ReportBaseHtml * @covers \Fisharebest\Webtrees\Report\ReportBaseImage * @covers \Fisharebest\Webtrees\Report\ReportBaseLine - * @covers \Fisharebest\Webtrees\Report\ReportBasePageheader + * @covers \Fisharebest\Webtrees\Report\ReportBasePageHeader * @covers \Fisharebest\Webtrees\Report\ReportBaseText * @covers \Fisharebest\Webtrees\Report\ReportBaseTextbox * @covers \Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider - * @covers \Fisharebest\Webtrees\Report\ReportHtml + * @covers \Fisharebest\Webtrees\Report\HtmlRenderer * @covers \Fisharebest\Webtrees\Report\ReportHtmlCell * @covers \Fisharebest\Webtrees\Report\ReportHtmlFootnote * @covers \Fisharebest\Webtrees\Report\ReportHtmlHtml * @covers \Fisharebest\Webtrees\Report\ReportHtmlImage * @covers \Fisharebest\Webtrees\Report\ReportHtmlLine - * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageheader + * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageHeader * @covers \Fisharebest\Webtrees\Report\ReportHtmlText * @covers \Fisharebest\Webtrees\Report\ReportHtmlTextbox * @covers \Fisharebest\Webtrees\Report\ReportParserBase * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate * @covers \Fisharebest\Webtrees\Report\ReportParserSetup - * @covers \Fisharebest\Webtrees\Report\ReportPdf + * @covers \Fisharebest\Webtrees\Report\PdfRenderer * @covers \Fisharebest\Webtrees\Report\ReportPdfCell * @covers \Fisharebest\Webtrees\Report\ReportPdfFootnote * @covers \Fisharebest\Webtrees\Report\ReportPdfHtml * @covers \Fisharebest\Webtrees\Report\ReportPdfImage * @covers \Fisharebest\Webtrees\Report\ReportPdfLine - * @covers \Fisharebest\Webtrees\Report\ReportPdfPageheader + * @covers \Fisharebest\Webtrees\Report\ReportPdfPageHeader * @covers \Fisharebest\Webtrees\Report\ReportPdfText - * @covers \Fisharebest\Webtrees\Report\ReportPdfTextbox + * @covers \Fisharebest\Webtrees\Report\ReportPdfTextBox * @covers \Fisharebest\Webtrees\Report\ReportTcpdf */ class DescendancyReportModuleTest extends TestCase @@ -98,13 +98,13 @@ class DescendancyReportModuleTest extends TestCase $this->assertIsArray($report->reportProperties()); ob_start(); - new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree, $data_filesystem); $html = ob_get_clean(); $this->assertStringStartsWith('<', $html); $this->assertStringEndsWith('>', $html); ob_start(); - new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new PdfRenderer(), $vars, $tree, $data_filesystem); $pdf = ob_get_clean(); $this->assertStringStartsWith('%PDF', $pdf); $this->assertStringEndsWith("%%EOF\n", $pdf); diff --git a/tests/app/Module/FactSourcesReportModuleTest.php b/tests/app/Module/FactSourcesReportModuleTest.php index 7791ebfc7e..5f9a0d0ebb 100644 --- a/tests/app/Module/FactSourcesReportModuleTest.php +++ b/tests/app/Module/FactSourcesReportModuleTest.php @@ -20,10 +20,10 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Auth; -use Fisharebest\Webtrees\Report\ReportHtml; +use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Report\ReportPdf; +use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\User; @@ -36,38 +36,38 @@ use League\Flysystem\Filesystem; * * @covers \Fisharebest\Webtrees\Module\FactSourcesReportModule * @covers \Fisharebest\Webtrees\Module\ModuleReportTrait - * @covers \Fisharebest\Webtrees\Report\AbstractReport + * @covers \Fisharebest\Webtrees\Report\AbstractRenderer * @covers \Fisharebest\Webtrees\Report\ReportBaseCell * @covers \Fisharebest\Webtrees\Report\ReportBaseElement * @covers \Fisharebest\Webtrees\Report\ReportBaseFootnote * @covers \Fisharebest\Webtrees\Report\ReportBaseHtml * @covers \Fisharebest\Webtrees\Report\ReportBaseImage * @covers \Fisharebest\Webtrees\Report\ReportBaseLine - * @covers \Fisharebest\Webtrees\Report\ReportBasePageheader + * @covers \Fisharebest\Webtrees\Report\ReportBasePageHeader * @covers \Fisharebest\Webtrees\Report\ReportBaseText * @covers \Fisharebest\Webtrees\Report\ReportBaseTextbox * @covers \Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider - * @covers \Fisharebest\Webtrees\Report\ReportHtml + * @covers \Fisharebest\Webtrees\Report\HtmlRenderer * @covers \Fisharebest\Webtrees\Report\ReportHtmlCell * @covers \Fisharebest\Webtrees\Report\ReportHtmlFootnote * @covers \Fisharebest\Webtrees\Report\ReportHtmlHtml * @covers \Fisharebest\Webtrees\Report\ReportHtmlImage * @covers \Fisharebest\Webtrees\Report\ReportHtmlLine - * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageheader + * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageHeader * @covers \Fisharebest\Webtrees\Report\ReportHtmlText * @covers \Fisharebest\Webtrees\Report\ReportHtmlTextbox * @covers \Fisharebest\Webtrees\Report\ReportParserBase * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate * @covers \Fisharebest\Webtrees\Report\ReportParserSetup - * @covers \Fisharebest\Webtrees\Report\ReportPdf + * @covers \Fisharebest\Webtrees\Report\PdfRenderer * @covers \Fisharebest\Webtrees\Report\ReportPdfCell * @covers \Fisharebest\Webtrees\Report\ReportPdfFootnote * @covers \Fisharebest\Webtrees\Report\ReportPdfHtml * @covers \Fisharebest\Webtrees\Report\ReportPdfImage * @covers \Fisharebest\Webtrees\Report\ReportPdfLine - * @covers \Fisharebest\Webtrees\Report\ReportPdfPageheader + * @covers \Fisharebest\Webtrees\Report\ReportPdfPageHeader * @covers \Fisharebest\Webtrees\Report\ReportPdfText - * @covers \Fisharebest\Webtrees\Report\ReportPdfTextbox + * @covers \Fisharebest\Webtrees\Report\ReportPdfTextBox * @covers \Fisharebest\Webtrees\Report\ReportTcpdf */ class FactSourcesReportModuleTest extends TestCase @@ -98,13 +98,13 @@ class FactSourcesReportModuleTest extends TestCase $this->assertIsArray($report->reportProperties()); ob_start(); - new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree, $data_filesystem); $html = ob_get_clean(); $this->assertStringStartsWith('<', $html); $this->assertStringEndsWith('>', $html); ob_start(); - new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new PdfRenderer(), $vars, $tree, $data_filesystem); $pdf = ob_get_clean(); $this->assertStringStartsWith('%PDF', $pdf); $this->assertStringEndsWith("%%EOF\n", $pdf); diff --git a/tests/app/Module/FamilyGroupReportModuleTest.php b/tests/app/Module/FamilyGroupReportModuleTest.php index 9b8ff9be25..85ba46c699 100644 --- a/tests/app/Module/FamilyGroupReportModuleTest.php +++ b/tests/app/Module/FamilyGroupReportModuleTest.php @@ -20,10 +20,10 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Auth; -use Fisharebest\Webtrees\Report\ReportHtml; +use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Report\ReportPdf; +use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\User; @@ -36,38 +36,38 @@ use League\Flysystem\Filesystem; * * @covers \Fisharebest\Webtrees\Module\FamilyGroupReportModule * @covers \Fisharebest\Webtrees\Module\ModuleReportTrait - * @covers \Fisharebest\Webtrees\Report\AbstractReport + * @covers \Fisharebest\Webtrees\Report\AbstractRenderer * @covers \Fisharebest\Webtrees\Report\ReportBaseCell * @covers \Fisharebest\Webtrees\Report\ReportBaseElement * @covers \Fisharebest\Webtrees\Report\ReportBaseFootnote * @covers \Fisharebest\Webtrees\Report\ReportBaseHtml * @covers \Fisharebest\Webtrees\Report\ReportBaseImage * @covers \Fisharebest\Webtrees\Report\ReportBaseLine - * @covers \Fisharebest\Webtrees\Report\ReportBasePageheader + * @covers \Fisharebest\Webtrees\Report\ReportBasePageHeader * @covers \Fisharebest\Webtrees\Report\ReportBaseText * @covers \Fisharebest\Webtrees\Report\ReportBaseTextbox * @covers \Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider - * @covers \Fisharebest\Webtrees\Report\ReportHtml + * @covers \Fisharebest\Webtrees\Report\HtmlRenderer * @covers \Fisharebest\Webtrees\Report\ReportHtmlCell * @covers \Fisharebest\Webtrees\Report\ReportHtmlFootnote * @covers \Fisharebest\Webtrees\Report\ReportHtmlHtml * @covers \Fisharebest\Webtrees\Report\ReportHtmlImage * @covers \Fisharebest\Webtrees\Report\ReportHtmlLine - * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageheader + * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageHeader * @covers \Fisharebest\Webtrees\Report\ReportHtmlText * @covers \Fisharebest\Webtrees\Report\ReportHtmlTextbox * @covers \Fisharebest\Webtrees\Report\ReportParserBase * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate * @covers \Fisharebest\Webtrees\Report\ReportParserSetup - * @covers \Fisharebest\Webtrees\Report\ReportPdf + * @covers \Fisharebest\Webtrees\Report\PdfRenderer * @covers \Fisharebest\Webtrees\Report\ReportPdfCell * @covers \Fisharebest\Webtrees\Report\ReportPdfFootnote * @covers \Fisharebest\Webtrees\Report\ReportPdfHtml * @covers \Fisharebest\Webtrees\Report\ReportPdfImage * @covers \Fisharebest\Webtrees\Report\ReportPdfLine - * @covers \Fisharebest\Webtrees\Report\ReportPdfPageheader + * @covers \Fisharebest\Webtrees\Report\ReportPdfPageHeader * @covers \Fisharebest\Webtrees\Report\ReportPdfText - * @covers \Fisharebest\Webtrees\Report\ReportPdfTextbox + * @covers \Fisharebest\Webtrees\Report\ReportPdfTextBox * @covers \Fisharebest\Webtrees\Report\ReportTcpdf */ class FamilyGroupReportModuleTest extends TestCase @@ -101,13 +101,13 @@ class FamilyGroupReportModuleTest extends TestCase $this->assertIsArray($report->reportProperties()); ob_start(); - new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree, $data_filesystem); $html = ob_get_clean(); $this->assertStringStartsWith('<', $html); $this->assertStringEndsWith('>', $html); ob_start(); - new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new PdfRenderer(), $vars, $tree, $data_filesystem); $pdf = ob_get_clean(); $this->assertStringStartsWith('%PDF', $pdf); $this->assertStringEndsWith("%%EOF\n", $pdf); diff --git a/tests/app/Module/IndividualFamiliesReportModuleTest.php b/tests/app/Module/IndividualFamiliesReportModuleTest.php index 0deb3ba11a..ee1bfa9d81 100644 --- a/tests/app/Module/IndividualFamiliesReportModuleTest.php +++ b/tests/app/Module/IndividualFamiliesReportModuleTest.php @@ -20,10 +20,10 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Auth; -use Fisharebest\Webtrees\Report\ReportHtml; +use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Report\ReportPdf; +use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\User; @@ -36,38 +36,38 @@ use League\Flysystem\Filesystem; * * @covers \Fisharebest\Webtrees\Module\IndividualFamiliesReportModule * @covers \Fisharebest\Webtrees\Module\ModuleReportTrait - * @covers \Fisharebest\Webtrees\Report\AbstractReport + * @covers \Fisharebest\Webtrees\Report\AbstractRenderer * @covers \Fisharebest\Webtrees\Report\ReportBaseCell * @covers \Fisharebest\Webtrees\Report\ReportBaseElement * @covers \Fisharebest\Webtrees\Report\ReportBaseFootnote * @covers \Fisharebest\Webtrees\Report\ReportBaseHtml * @covers \Fisharebest\Webtrees\Report\ReportBaseImage * @covers \Fisharebest\Webtrees\Report\ReportBaseLine - * @covers \Fisharebest\Webtrees\Report\ReportBasePageheader + * @covers \Fisharebest\Webtrees\Report\ReportBasePageHeader * @covers \Fisharebest\Webtrees\Report\ReportBaseText * @covers \Fisharebest\Webtrees\Report\ReportBaseTextbox * @covers \Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider - * @covers \Fisharebest\Webtrees\Report\ReportHtml + * @covers \Fisharebest\Webtrees\Report\HtmlRenderer * @covers \Fisharebest\Webtrees\Report\ReportHtmlCell * @covers \Fisharebest\Webtrees\Report\ReportHtmlFootnote * @covers \Fisharebest\Webtrees\Report\ReportHtmlHtml * @covers \Fisharebest\Webtrees\Report\ReportHtmlImage * @covers \Fisharebest\Webtrees\Report\ReportHtmlLine - * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageheader + * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageHeader * @covers \Fisharebest\Webtrees\Report\ReportHtmlText * @covers \Fisharebest\Webtrees\Report\ReportHtmlTextbox * @covers \Fisharebest\Webtrees\Report\ReportParserBase * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate * @covers \Fisharebest\Webtrees\Report\ReportParserSetup - * @covers \Fisharebest\Webtrees\Report\ReportPdf + * @covers \Fisharebest\Webtrees\Report\PdfRenderer * @covers \Fisharebest\Webtrees\Report\ReportPdfCell * @covers \Fisharebest\Webtrees\Report\ReportPdfFootnote * @covers \Fisharebest\Webtrees\Report\ReportPdfHtml * @covers \Fisharebest\Webtrees\Report\ReportPdfImage * @covers \Fisharebest\Webtrees\Report\ReportPdfLine - * @covers \Fisharebest\Webtrees\Report\ReportPdfPageheader + * @covers \Fisharebest\Webtrees\Report\ReportPdfPageHeader * @covers \Fisharebest\Webtrees\Report\ReportPdfText - * @covers \Fisharebest\Webtrees\Report\ReportPdfTextbox + * @covers \Fisharebest\Webtrees\Report\ReportPdfTextBox * @covers \Fisharebest\Webtrees\Report\ReportTcpdf */ class IndividualFamiliesReportModuleTest extends TestCase @@ -103,13 +103,13 @@ class IndividualFamiliesReportModuleTest extends TestCase $this->assertIsArray($report->reportProperties()); ob_start(); - new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree, $data_filesystem); $html = ob_get_clean(); $this->assertStringStartsWith('<', $html); $this->assertStringEndsWith('>', $html); ob_start(); - new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new PdfRenderer(), $vars, $tree, $data_filesystem); $pdf = ob_get_clean(); $this->assertStringStartsWith('%PDF', $pdf); $this->assertStringEndsWith("%%EOF\n", $pdf); diff --git a/tests/app/Module/IndividualReportModuleTest.php b/tests/app/Module/IndividualReportModuleTest.php index b29e29791b..1e73a4113c 100644 --- a/tests/app/Module/IndividualReportModuleTest.php +++ b/tests/app/Module/IndividualReportModuleTest.php @@ -20,10 +20,10 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Auth; -use Fisharebest\Webtrees\Report\ReportHtml; +use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Report\ReportPdf; +use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\User; @@ -36,40 +36,40 @@ use League\Flysystem\Filesystem; * * @covers \Fisharebest\Webtrees\Module\IndividualReportModule * @covers \Fisharebest\Webtrees\Module\ModuleReportTrait - * @covers \Fisharebest\Webtrees\Report\AbstractReport + * @covers \Fisharebest\Webtrees\Report\AbstractRenderer * @covers \Fisharebest\Webtrees\Report\ReportBaseCell * @covers \Fisharebest\Webtrees\Report\ReportBaseElement * @covers \Fisharebest\Webtrees\Report\ReportBaseFootnote * @covers \Fisharebest\Webtrees\Report\ReportBaseHtml * @covers \Fisharebest\Webtrees\Report\ReportBaseImage * @covers \Fisharebest\Webtrees\Report\ReportBaseLine - * @covers \Fisharebest\Webtrees\Report\ReportBasePageheader + * @covers \Fisharebest\Webtrees\Report\ReportBasePageHeader * @covers \Fisharebest\Webtrees\Report\ReportBaseText * @covers \Fisharebest\Webtrees\Report\ReportBaseTextbox * @covers \Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider - * @covers \Fisharebest\Webtrees\Report\ReportHtml + * @covers \Fisharebest\Webtrees\Report\HtmlRenderer * @covers \Fisharebest\Webtrees\Report\ReportHtmlCell * @covers \Fisharebest\Webtrees\Report\ReportHtmlFootnote * @covers \Fisharebest\Webtrees\Report\ReportHtmlHtml * @covers \Fisharebest\Webtrees\Report\ReportHtmlImage * @covers \Fisharebest\Webtrees\Report\ReportHtmlLine - * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageheader + * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageHeader * @covers \Fisharebest\Webtrees\Report\ReportHtmlText * @covers \Fisharebest\Webtrees\Report\ReportHtmlTextbox * @covers \Fisharebest\Webtrees\Report\ReportParserBase * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate * @covers \Fisharebest\Webtrees\Report\ReportParserSetup - * @covers \Fisharebest\Webtrees\Report\ReportPdf + * @covers \Fisharebest\Webtrees\Report\PdfRenderer * @covers \Fisharebest\Webtrees\Report\ReportPdfCell * @covers \Fisharebest\Webtrees\Report\ReportPdfFootnote * @covers \Fisharebest\Webtrees\Report\ReportPdfHtml * @covers \Fisharebest\Webtrees\Report\ReportPdfImage * @covers \Fisharebest\Webtrees\Report\ReportPdfLine - * @covers \Fisharebest\Webtrees\Report\ReportPdfPageheader + * @covers \Fisharebest\Webtrees\Report\ReportPdfPageHeader * @covers \Fisharebest\Webtrees\Report\ReportPdfText - * @covers \Fisharebest\Webtrees\Report\ReportPdfTextbox + * @covers \Fisharebest\Webtrees\Report\ReportPdfTextBox * @covers \Fisharebest\Webtrees\Report\ReportTcpdf - * @covers \Fisharebest\Webtrees\Report\ReportPdf + * @covers \Fisharebest\Webtrees\Report\PdfRenderer */ class IndividualReportModuleTest extends TestCase { @@ -101,13 +101,13 @@ class IndividualReportModuleTest extends TestCase $this->assertIsArray($report->reportProperties()); ob_start(); - new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree, $data_filesystem); $html = ob_get_clean(); $this->assertStringStartsWith('<', $html); $this->assertStringEndsWith('>', $html); ob_start(); - new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new PdfRenderer(), $vars, $tree, $data_filesystem); $pdf = ob_get_clean(); $this->assertStringStartsWith('%PDF', $pdf); $this->assertStringEndsWith("%%EOF\n", $pdf); diff --git a/tests/app/Module/MarriageReportModuleTest.php b/tests/app/Module/MarriageReportModuleTest.php index e3a992865f..215aa9ac6a 100644 --- a/tests/app/Module/MarriageReportModuleTest.php +++ b/tests/app/Module/MarriageReportModuleTest.php @@ -20,10 +20,10 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Auth; -use Fisharebest\Webtrees\Report\ReportHtml; +use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Report\ReportPdf; +use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\User; @@ -36,38 +36,38 @@ use League\Flysystem\Filesystem; * * @covers \Fisharebest\Webtrees\Module\MarriageReportModule * @covers \Fisharebest\Webtrees\Module\ModuleReportTrait - * @covers \Fisharebest\Webtrees\Report\AbstractReport + * @covers \Fisharebest\Webtrees\Report\AbstractRenderer * @covers \Fisharebest\Webtrees\Report\ReportBaseCell * @covers \Fisharebest\Webtrees\Report\ReportBaseElement * @covers \Fisharebest\Webtrees\Report\ReportBaseFootnote * @covers \Fisharebest\Webtrees\Report\ReportBaseHtml * @covers \Fisharebest\Webtrees\Report\ReportBaseImage * @covers \Fisharebest\Webtrees\Report\ReportBaseLine - * @covers \Fisharebest\Webtrees\Report\ReportBasePageheader + * @covers \Fisharebest\Webtrees\Report\ReportBasePageHeader * @covers \Fisharebest\Webtrees\Report\ReportBaseText * @covers \Fisharebest\Webtrees\Report\ReportBaseTextbox * @covers \Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider - * @covers \Fisharebest\Webtrees\Report\ReportHtml + * @covers \Fisharebest\Webtrees\Report\HtmlRenderer * @covers \Fisharebest\Webtrees\Report\ReportHtmlCell * @covers \Fisharebest\Webtrees\Report\ReportHtmlFootnote * @covers \Fisharebest\Webtrees\Report\ReportHtmlHtml * @covers \Fisharebest\Webtrees\Report\ReportHtmlImage * @covers \Fisharebest\Webtrees\Report\ReportHtmlLine - * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageheader + * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageHeader * @covers \Fisharebest\Webtrees\Report\ReportHtmlText * @covers \Fisharebest\Webtrees\Report\ReportHtmlTextbox * @covers \Fisharebest\Webtrees\Report\ReportParserBase * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate * @covers \Fisharebest\Webtrees\Report\ReportParserSetup - * @covers \Fisharebest\Webtrees\Report\ReportPdf + * @covers \Fisharebest\Webtrees\Report\PdfRenderer * @covers \Fisharebest\Webtrees\Report\ReportPdfCell * @covers \Fisharebest\Webtrees\Report\ReportPdfFootnote * @covers \Fisharebest\Webtrees\Report\ReportPdfHtml * @covers \Fisharebest\Webtrees\Report\ReportPdfImage * @covers \Fisharebest\Webtrees\Report\ReportPdfLine - * @covers \Fisharebest\Webtrees\Report\ReportPdfPageheader + * @covers \Fisharebest\Webtrees\Report\ReportPdfPageHeader * @covers \Fisharebest\Webtrees\Report\ReportPdfText - * @covers \Fisharebest\Webtrees\Report\ReportPdfTextbox + * @covers \Fisharebest\Webtrees\Report\ReportPdfTextBox * @covers \Fisharebest\Webtrees\Report\ReportTcpdf */ class MarriageReportModuleTest extends TestCase @@ -100,13 +100,13 @@ class MarriageReportModuleTest extends TestCase $this->assertIsArray($report->reportProperties()); ob_start(); - new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree, $data_filesystem); $html = ob_get_clean(); $this->assertStringStartsWith('<', $html); $this->assertStringEndsWith('>', $html); ob_start(); - new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new PdfRenderer(), $vars, $tree, $data_filesystem); $pdf = ob_get_clean(); $this->assertStringStartsWith('%PDF', $pdf); $this->assertStringEndsWith("%%EOF\n", $pdf); diff --git a/tests/app/Module/MissingFactsReportModuleTest.php b/tests/app/Module/MissingFactsReportModuleTest.php index 900d289737..e8fc653dbe 100644 --- a/tests/app/Module/MissingFactsReportModuleTest.php +++ b/tests/app/Module/MissingFactsReportModuleTest.php @@ -20,10 +20,10 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Auth; -use Fisharebest\Webtrees\Report\ReportHtml; +use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Report\ReportPdf; +use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\User; @@ -36,38 +36,38 @@ use League\Flysystem\Filesystem; * * @covers \Fisharebest\Webtrees\Module\MissingFactsReportModule * @covers \Fisharebest\Webtrees\Module\ModuleReportTrait - * @covers \Fisharebest\Webtrees\Report\AbstractReport + * @covers \Fisharebest\Webtrees\Report\AbstractRenderer * @covers \Fisharebest\Webtrees\Report\ReportBaseCell * @covers \Fisharebest\Webtrees\Report\ReportBaseElement * @covers \Fisharebest\Webtrees\Report\ReportBaseFootnote * @covers \Fisharebest\Webtrees\Report\ReportBaseHtml * @covers \Fisharebest\Webtrees\Report\ReportBaseImage * @covers \Fisharebest\Webtrees\Report\ReportBaseLine - * @covers \Fisharebest\Webtrees\Report\ReportBasePageheader + * @covers \Fisharebest\Webtrees\Report\ReportBasePageHeader * @covers \Fisharebest\Webtrees\Report\ReportBaseText * @covers \Fisharebest\Webtrees\Report\ReportBaseTextbox * @covers \Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider - * @covers \Fisharebest\Webtrees\Report\ReportHtml + * @covers \Fisharebest\Webtrees\Report\HtmlRenderer * @covers \Fisharebest\Webtrees\Report\ReportHtmlCell * @covers \Fisharebest\Webtrees\Report\ReportHtmlFootnote * @covers \Fisharebest\Webtrees\Report\ReportHtmlHtml * @covers \Fisharebest\Webtrees\Report\ReportHtmlImage * @covers \Fisharebest\Webtrees\Report\ReportHtmlLine - * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageheader + * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageHeader * @covers \Fisharebest\Webtrees\Report\ReportHtmlText * @covers \Fisharebest\Webtrees\Report\ReportHtmlTextbox * @covers \Fisharebest\Webtrees\Report\ReportParserBase * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate * @covers \Fisharebest\Webtrees\Report\ReportParserSetup - * @covers \Fisharebest\Webtrees\Report\ReportPdf + * @covers \Fisharebest\Webtrees\Report\PdfRenderer * @covers \Fisharebest\Webtrees\Report\ReportPdfCell * @covers \Fisharebest\Webtrees\Report\ReportPdfFootnote * @covers \Fisharebest\Webtrees\Report\ReportPdfHtml * @covers \Fisharebest\Webtrees\Report\ReportPdfImage * @covers \Fisharebest\Webtrees\Report\ReportPdfLine - * @covers \Fisharebest\Webtrees\Report\ReportPdfPageheader + * @covers \Fisharebest\Webtrees\Report\ReportPdfPageHeader * @covers \Fisharebest\Webtrees\Report\ReportPdfText - * @covers \Fisharebest\Webtrees\Report\ReportPdfTextbox + * @covers \Fisharebest\Webtrees\Report\ReportPdfTextBox * @covers \Fisharebest\Webtrees\Report\ReportTcpdf */ class MissingFactsReportModuleTest extends TestCase @@ -112,13 +112,13 @@ class MissingFactsReportModuleTest extends TestCase $this->assertIsArray($report->reportProperties()); ob_start(); - new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree, $data_filesystem); $html = ob_get_clean(); $this->assertStringStartsWith('<', $html); $this->assertStringEndsWith('>', $html); ob_start(); - new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new PdfRenderer(), $vars, $tree, $data_filesystem); $pdf = ob_get_clean(); $this->assertStringStartsWith('%PDF', $pdf); $this->assertStringEndsWith("%%EOF\n", $pdf); diff --git a/tests/app/Module/OccupationReportModuleTest.php b/tests/app/Module/OccupationReportModuleTest.php index 30321edc14..90b122ef27 100644 --- a/tests/app/Module/OccupationReportModuleTest.php +++ b/tests/app/Module/OccupationReportModuleTest.php @@ -20,10 +20,10 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Auth; -use Fisharebest\Webtrees\Report\ReportHtml; +use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Report\ReportPdf; +use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\User; @@ -36,38 +36,38 @@ use League\Flysystem\Filesystem; * * @covers \Fisharebest\Webtrees\Module\ModuleReportTrait * @covers \Fisharebest\Webtrees\Module\OccupationReportModule - * @covers \Fisharebest\Webtrees\Report\AbstractReport + * @covers \Fisharebest\Webtrees\Report\AbstractRenderer * @covers \Fisharebest\Webtrees\Report\ReportBaseCell * @covers \Fisharebest\Webtrees\Report\ReportBaseElement * @covers \Fisharebest\Webtrees\Report\ReportBaseFootnote * @covers \Fisharebest\Webtrees\Report\ReportBaseHtml * @covers \Fisharebest\Webtrees\Report\ReportBaseImage * @covers \Fisharebest\Webtrees\Report\ReportBaseLine - * @covers \Fisharebest\Webtrees\Report\ReportBasePageheader + * @covers \Fisharebest\Webtrees\Report\ReportBasePageHeader * @covers \Fisharebest\Webtrees\Report\ReportBaseText * @covers \Fisharebest\Webtrees\Report\ReportBaseTextbox * @covers \Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider - * @covers \Fisharebest\Webtrees\Report\ReportHtml + * @covers \Fisharebest\Webtrees\Report\HtmlRenderer * @covers \Fisharebest\Webtrees\Report\ReportHtmlCell * @covers \Fisharebest\Webtrees\Report\ReportHtmlFootnote * @covers \Fisharebest\Webtrees\Report\ReportHtmlHtml * @covers \Fisharebest\Webtrees\Report\ReportHtmlImage * @covers \Fisharebest\Webtrees\Report\ReportHtmlLine - * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageheader + * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageHeader * @covers \Fisharebest\Webtrees\Report\ReportHtmlText * @covers \Fisharebest\Webtrees\Report\ReportHtmlTextbox * @covers \Fisharebest\Webtrees\Report\ReportParserBase * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate * @covers \Fisharebest\Webtrees\Report\ReportParserSetup - * @covers \Fisharebest\Webtrees\Report\ReportPdf + * @covers \Fisharebest\Webtrees\Report\PdfRenderer * @covers \Fisharebest\Webtrees\Report\ReportPdfCell * @covers \Fisharebest\Webtrees\Report\ReportPdfFootnote * @covers \Fisharebest\Webtrees\Report\ReportPdfHtml * @covers \Fisharebest\Webtrees\Report\ReportPdfImage * @covers \Fisharebest\Webtrees\Report\ReportPdfLine - * @covers \Fisharebest\Webtrees\Report\ReportPdfPageheader + * @covers \Fisharebest\Webtrees\Report\ReportPdfPageHeader * @covers \Fisharebest\Webtrees\Report\ReportPdfText - * @covers \Fisharebest\Webtrees\Report\ReportPdfTextbox + * @covers \Fisharebest\Webtrees\Report\ReportPdfTextBox * @covers \Fisharebest\Webtrees\Report\ReportTcpdf */ class OccupationReportModuleTest extends TestCase @@ -97,13 +97,13 @@ class OccupationReportModuleTest extends TestCase $this->assertIsArray($report->reportProperties()); ob_start(); - new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree, $data_filesystem); $html = ob_get_clean(); $this->assertStringStartsWith('<', $html); $this->assertStringEndsWith('>', $html); ob_start(); - new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new PdfRenderer(), $vars, $tree, $data_filesystem); $pdf = ob_get_clean(); $this->assertStringStartsWith('%PDF', $pdf); $this->assertStringEndsWith("%%EOF\n", $pdf); diff --git a/tests/app/Module/PedigreeReportModuleTest.php b/tests/app/Module/PedigreeReportModuleTest.php index 660b65089b..aa185761ae 100644 --- a/tests/app/Module/PedigreeReportModuleTest.php +++ b/tests/app/Module/PedigreeReportModuleTest.php @@ -20,10 +20,10 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Auth; -use Fisharebest\Webtrees\Report\ReportHtml; +use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Report\ReportPdf; +use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\User; @@ -36,38 +36,38 @@ use League\Flysystem\Filesystem; * * @covers \Fisharebest\Webtrees\Module\ModuleReportTrait * @covers \Fisharebest\Webtrees\Module\PedigreeReportModule - * @covers \Fisharebest\Webtrees\Report\AbstractReport + * @covers \Fisharebest\Webtrees\Report\AbstractRenderer * @covers \Fisharebest\Webtrees\Report\ReportBaseCell * @covers \Fisharebest\Webtrees\Report\ReportBaseElement * @covers \Fisharebest\Webtrees\Report\ReportBaseFootnote * @covers \Fisharebest\Webtrees\Report\ReportBaseHtml * @covers \Fisharebest\Webtrees\Report\ReportBaseImage * @covers \Fisharebest\Webtrees\Report\ReportBaseLine - * @covers \Fisharebest\Webtrees\Report\ReportBasePageheader + * @covers \Fisharebest\Webtrees\Report\ReportBasePageHeader * @covers \Fisharebest\Webtrees\Report\ReportBaseText * @covers \Fisharebest\Webtrees\Report\ReportBaseTextbox * @covers \Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider - * @covers \Fisharebest\Webtrees\Report\ReportHtml + * @covers \Fisharebest\Webtrees\Report\HtmlRenderer * @covers \Fisharebest\Webtrees\Report\ReportHtmlCell * @covers \Fisharebest\Webtrees\Report\ReportHtmlFootnote * @covers \Fisharebest\Webtrees\Report\ReportHtmlHtml * @covers \Fisharebest\Webtrees\Report\ReportHtmlImage * @covers \Fisharebest\Webtrees\Report\ReportHtmlLine - * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageheader + * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageHeader * @covers \Fisharebest\Webtrees\Report\ReportHtmlText * @covers \Fisharebest\Webtrees\Report\ReportHtmlTextbox * @covers \Fisharebest\Webtrees\Report\ReportParserBase * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate * @covers \Fisharebest\Webtrees\Report\ReportParserSetup - * @covers \Fisharebest\Webtrees\Report\ReportPdf + * @covers \Fisharebest\Webtrees\Report\PdfRenderer * @covers \Fisharebest\Webtrees\Report\ReportPdfCell * @covers \Fisharebest\Webtrees\Report\ReportPdfFootnote * @covers \Fisharebest\Webtrees\Report\ReportPdfHtml * @covers \Fisharebest\Webtrees\Report\ReportPdfImage * @covers \Fisharebest\Webtrees\Report\ReportPdfLine - * @covers \Fisharebest\Webtrees\Report\ReportPdfPageheader + * @covers \Fisharebest\Webtrees\Report\ReportPdfPageHeader * @covers \Fisharebest\Webtrees\Report\ReportPdfText - * @covers \Fisharebest\Webtrees\Report\ReportPdfTextbox + * @covers \Fisharebest\Webtrees\Report\ReportPdfTextBox * @covers \Fisharebest\Webtrees\Report\ReportTcpdf */ class PedigreeReportModuleTest extends TestCase @@ -97,13 +97,13 @@ class PedigreeReportModuleTest extends TestCase $this->assertIsArray($report->reportProperties()); ob_start(); - new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree, $data_filesystem); $html = ob_get_clean(); $this->assertStringStartsWith('<', $html); $this->assertStringEndsWith('>', $html); ob_start(); - new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new PdfRenderer(), $vars, $tree, $data_filesystem); $pdf = ob_get_clean(); $this->assertStringStartsWith('%PDF', $pdf); $this->assertStringEndsWith("%%EOF\n", $pdf); diff --git a/tests/app/Module/RelatedIndividualsReportModuleTest.php b/tests/app/Module/RelatedIndividualsReportModuleTest.php index 744dc27a22..0872968c28 100644 --- a/tests/app/Module/RelatedIndividualsReportModuleTest.php +++ b/tests/app/Module/RelatedIndividualsReportModuleTest.php @@ -20,10 +20,10 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Auth; -use Fisharebest\Webtrees\Report\ReportHtml; +use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Report\ReportPdf; +use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; use Fisharebest\Webtrees\User; @@ -36,38 +36,38 @@ use League\Flysystem\Filesystem; * * @covers \Fisharebest\Webtrees\Module\ModuleReportTrait * @covers \Fisharebest\Webtrees\Module\RelatedIndividualsReportModule - * @covers \Fisharebest\Webtrees\Report\AbstractReport + * @covers \Fisharebest\Webtrees\Report\AbstractRenderer * @covers \Fisharebest\Webtrees\Report\ReportBaseCell * @covers \Fisharebest\Webtrees\Report\ReportBaseElement * @covers \Fisharebest\Webtrees\Report\ReportBaseFootnote * @covers \Fisharebest\Webtrees\Report\ReportBaseHtml * @covers \Fisharebest\Webtrees\Report\ReportBaseImage * @covers \Fisharebest\Webtrees\Report\ReportBaseLine - * @covers \Fisharebest\Webtrees\Report\ReportBasePageheader + * @covers \Fisharebest\Webtrees\Report\ReportBasePageHeader * @covers \Fisharebest\Webtrees\Report\ReportBaseText * @covers \Fisharebest\Webtrees\Report\ReportBaseTextbox * @covers \Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider - * @covers \Fisharebest\Webtrees\Report\ReportHtml + * @covers \Fisharebest\Webtrees\Report\HtmlRenderer * @covers \Fisharebest\Webtrees\Report\ReportHtmlCell * @covers \Fisharebest\Webtrees\Report\ReportHtmlFootnote * @covers \Fisharebest\Webtrees\Report\ReportHtmlHtml * @covers \Fisharebest\Webtrees\Report\ReportHtmlImage * @covers \Fisharebest\Webtrees\Report\ReportHtmlLine - * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageheader + * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageHeader * @covers \Fisharebest\Webtrees\Report\ReportHtmlText * @covers \Fisharebest\Webtrees\Report\ReportHtmlTextbox * @covers \Fisharebest\Webtrees\Report\ReportParserBase * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate * @covers \Fisharebest\Webtrees\Report\ReportParserSetup - * @covers \Fisharebest\Webtrees\Report\ReportPdf + * @covers \Fisharebest\Webtrees\Report\PdfRenderer * @covers \Fisharebest\Webtrees\Report\ReportPdfCell * @covers \Fisharebest\Webtrees\Report\ReportPdfFootnote * @covers \Fisharebest\Webtrees\Report\ReportPdfHtml * @covers \Fisharebest\Webtrees\Report\ReportPdfImage * @covers \Fisharebest\Webtrees\Report\ReportPdfLine - * @covers \Fisharebest\Webtrees\Report\ReportPdfPageheader + * @covers \Fisharebest\Webtrees\Report\ReportPdfPageHeader * @covers \Fisharebest\Webtrees\Report\ReportPdfText - * @covers \Fisharebest\Webtrees\Report\ReportPdfTextbox + * @covers \Fisharebest\Webtrees\Report\ReportPdfTextBox * @covers \Fisharebest\Webtrees\Report\ReportTcpdf */ class RelatedIndividualsReportModuleTest extends TestCase @@ -103,13 +103,13 @@ class RelatedIndividualsReportModuleTest extends TestCase $this->assertIsArray($report->reportProperties()); ob_start(); - new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree, $data_filesystem); $html = ob_get_clean(); $this->assertStringStartsWith('<', $html); $this->assertStringEndsWith('>', $html); ob_start(); - new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree, $data_filesystem); + new ReportParserGenerate($xml, new PdfRenderer(), $vars, $tree, $data_filesystem); $pdf = ob_get_clean(); $this->assertStringStartsWith('%PDF', $pdf); $this->assertStringEndsWith("%%EOF\n", $pdf); diff --git a/tests/app/Report/ReportBaseTest.php b/tests/app/Report/ReportBaseTest.php index e430bf6343..314fa06e67 100644 --- a/tests/app/Report/ReportBaseTest.php +++ b/tests/app/Report/ReportBaseTest.php @@ -33,6 +33,6 @@ class ReportBaseTest extends TestCase */ public function testClassExists(): void { - $this->assertTrue(class_exists(AbstractReport::class)); + $this->assertTrue(class_exists(AbstractRenderer::class)); } } diff --git a/tests/app/Report/ReportHTMLTest.php b/tests/app/Report/ReportHTMLTest.php index 13d932a43e..fd1ed35a82 100644 --- a/tests/app/Report/ReportHTMLTest.php +++ b/tests/app/Report/ReportHTMLTest.php @@ -33,6 +33,6 @@ class ReportHTMLTest extends TestCase */ public function testClassExists(): void { - $this->assertTrue(class_exists(ReportHtml::class)); + $this->assertTrue(class_exists(HtmlRenderer::class)); } } diff --git a/tests/app/Report/ReportPDFTest.php b/tests/app/Report/ReportPDFTest.php index a5b9e88179..9ee9c401d1 100644 --- a/tests/app/Report/ReportPDFTest.php +++ b/tests/app/Report/ReportPDFTest.php @@ -33,6 +33,6 @@ class ReportPDFTest extends TestCase */ public function testClassExists(): void { - $this->assertTrue(class_exists(ReportPdf::class)); + $this->assertTrue(class_exists(PdfRenderer::class)); } } |
