Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Mid-level PDF engine contract for phpMyFAQ PDF export. |
| 5 | * |
| 6 | * Confines the underlying PDF library (currently TCPDF) behind a single seam so |
| 7 | * the engine can be swapped (e.g. for tc-lib-pdf) without touching the export |
| 8 | * layer. Method semantics mirror the TCPDF operations phpMyFAQ relies on. |
| 9 | * |
| 10 | * This Source Code Form is subject to the terms of the Mozilla Public License, |
| 11 | * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
| 12 | * obtain one at https://mozilla.org/MPL/2.0/. |
| 13 | * |
| 14 | * @package phpMyFAQ |
| 15 | * @author Thorsten Rinne <thorsten@phpmyfaq.de> |
| 16 | * @copyright 2026 phpMyFAQ Team |
| 17 | * @license https://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
| 18 | * @link https://www.phpmyfaq.de |
| 19 | * @since 2026-06-27 |
| 20 | */ |
| 21 | |
| 22 | declare(strict_types=1); |
| 23 | |
| 24 | namespace phpMyFAQ\Export\Pdf\Engine; |
| 25 | |
| 26 | /* @mago-expect lint:too-many-methods - mirrors the TCPDF surface the export needs */ |
| 27 | interface PdfEngineInterface |
| 28 | { |
| 29 | // Lifecycle |
| 30 | public function open(): void; |
| 31 | |
| 32 | public function output(string $name, string $dest): string; |
| 33 | |
| 34 | public function addPage(): void; |
| 35 | |
| 36 | public function setPrintHeader(bool $val): void; |
| 37 | |
| 38 | public function setDisplayMode(mixed $zoom): void; |
| 39 | |
| 40 | // Document metadata |
| 41 | public function setTitle(string $title): void; |
| 42 | |
| 43 | public function setAuthor(string $author): void; |
| 44 | |
| 45 | public function setCreator(string $creator): void; |
| 46 | |
| 47 | public function bookmark(string $txt, int $level = 0, float $y = -1): void; |
| 48 | |
| 49 | // Layout / fonts |
| 50 | public function setMargins(float $left, float $top, float $right = -1): void; |
| 51 | |
| 52 | public function setHeaderMargin(float $margin): void; |
| 53 | |
| 54 | public function setFooterMargin(float $margin): void; |
| 55 | |
| 56 | public function setFont(string $family, string $style = '', float $size = 0): void; |
| 57 | |
| 58 | public function setFontSubsetting(bool $enable): void; |
| 59 | |
| 60 | public function setImageScale(float $scale): void; |
| 61 | |
| 62 | public function setDefaultMonospacedFont(string $font): void; |
| 63 | |
| 64 | public function setRtl(bool $enable): void; |
| 65 | |
| 66 | // Content |
| 67 | public function write(float $h, string $txt): void; |
| 68 | |
| 69 | public function ln(?float $h = null): void; |
| 70 | |
| 71 | public function writeHtml( |
| 72 | string $html, |
| 73 | bool $ln = true, |
| 74 | bool $fill = false, |
| 75 | bool $reseth = false, |
| 76 | bool $cell = false, |
| 77 | string $align = '', |
| 78 | ): void; |
| 79 | |
| 80 | /* @mago-expect lint:excessive-parameter-list - mirrors the TCPDF method signature */ |
| 81 | public function writeHtmlCell( |
| 82 | float $w, |
| 83 | float $h, |
| 84 | ?float $x, |
| 85 | ?float $y, |
| 86 | string $html, |
| 87 | mixed $border = 0, |
| 88 | int $ln = 0, |
| 89 | bool $fill = false, |
| 90 | bool $reseth = true, |
| 91 | string $align = '', |
| 92 | ): void; |
| 93 | |
| 94 | public function multiCell(float $w, float $h, string $txt, mixed $border = 0, string $align = 'J'): void; |
| 95 | |
| 96 | /* @mago-expect lint:excessive-parameter-list - mirrors the TCPDF method signature */ |
| 97 | public function cell( |
| 98 | float $w, |
| 99 | float $h, |
| 100 | string $txt, |
| 101 | mixed $border = 0, |
| 102 | int $ln = 0, |
| 103 | string $align = '', |
| 104 | bool $fill = false, |
| 105 | string $link = '', |
| 106 | ): void; |
| 107 | |
| 108 | public function setY(float $y): void; |
| 109 | |
| 110 | public function setTextColor(int $col1, int $col2 = -1, int $col3 = -1): void; |
| 111 | |
| 112 | public function getLastH(): float; |
| 113 | |
| 114 | // Table of contents |
| 115 | public function addTocPage(): void; |
| 116 | |
| 117 | public function addToc( |
| 118 | int $page, |
| 119 | string $numbersfont, |
| 120 | string $filler, |
| 121 | string $tocName, |
| 122 | string $style, |
| 123 | array $color, |
| 124 | ): void; |
| 125 | |
| 126 | public function endTocPage(): void; |
| 127 | |
| 128 | public function getAliasNumPage(): string; |
| 129 | |
| 130 | public function getAliasNbPages(): string; |
| 131 | |
| 132 | // Render-time callbacks (invoked when the underlying library fires its hooks) |
| 133 | public function onHeader(callable $renderer): void; |
| 134 | |
| 135 | public function onFooter(callable $renderer): void; |
| 136 | } |