diff --git a/example/FpdfOutput/fpdf-example.php b/example/FpdfOutput/fpdf-example.php index ba80a1b8..280b6a7f 100644 --- a/example/FpdfOutput/fpdf-example.php +++ b/example/FpdfOutput/fpdf-example.php @@ -1,7 +1,7 @@ setPrintable(false) // true to remove lines for printing on a perforated stationery ->setDisplayTextDownArrows(false) // true to show arrows next to separation text, if shown diff --git a/example/HtmlOutput/html-example.php b/example/HtmlOutput/html-example.php index 393fa868..8fc5ae3a 100644 --- a/example/HtmlOutput/html-example.php +++ b/example/HtmlOutput/html-example.php @@ -1,7 +1,7 @@ setPrintable(false) // true to remove lines for printing on a perforated stationery ->setDisplayTextDownArrows(false) // true to show arrows next to separation text, if shown diff --git a/example/TcPdfOutput/tcpdf-example.php b/example/TcPdfOutput/tcpdf-example.php index 1fdc03de..b2819d24 100644 --- a/example/TcPdfOutput/tcpdf-example.php +++ b/example/TcPdfOutput/tcpdf-example.php @@ -1,7 +1,7 @@ setPrintable(false) // true to remove lines for printing on a perforated stationery ->setDisplayTextDownArrows(false) // true to show arrows next to separation text, if shown diff --git a/src/PaymentPart/Output/AbstractOutput.php b/src/PaymentPart/Output/AbstractOutput.php index 21e5c188..778cd38c 100644 --- a/src/PaymentPart/Output/AbstractOutput.php +++ b/src/PaymentPart/Output/AbstractOutput.php @@ -14,14 +14,14 @@ abstract class AbstractOutput implements OutputInterface { protected QrBill $qrBill; protected string $language; - protected PrintOptions $printOptions; + protected DisplayOptions $displayOptions; protected string $qrCodeImageFormat; public function __construct(QrBill $qrBill, string $language) { $this->qrBill = $qrBill; $this->language = $language; - $this->printOptions = new PrintOptions(); + $this->displayOptions = new DisplayOptions(); $this->qrCodeImageFormat = QrCode::FILE_FORMAT_SVG; } @@ -36,35 +36,35 @@ public function getLanguage(): ?string } /** - * @deprecated Will be removed in next major release. Use setPrintOptions() instead. + * @deprecated Will be removed in next major release. Use setDisplayOptions() instead. */ public function setPrintable(bool $printable): static { - $this->printOptions->setPrintable($printable); + $this->displayOptions->setPrintable($printable); return $this; } /** - * @deprecated Will be removed in next major release. Use getPrintOptions() instead. + * @deprecated Will be removed in next major release. Use getDisplayOptions() instead. */ public function isPrintable(): bool { - return $this->printOptions->isPrintable(); + return $this->displayOptions->isPrintable(); } - public function setPrintOptions(PrintOptions $printOptions): static + public function setDisplayOptions(DisplayOptions $displayOptions): static { - $this->printOptions = $printOptions; + $this->displayOptions = $displayOptions; return $this; } - public function getPrintOptions(): PrintOptions + public function getDisplayOptions(): DisplayOptions { - $this->printOptions->consolidate(); + $this->displayOptions->consolidate(); - return $this->printOptions; + return $this->displayOptions; } public function setQrCodeImageFormat(string $fileExtension): static diff --git a/src/PaymentPart/Output/PrintOptions.php b/src/PaymentPart/Output/DisplayOptions.php similarity index 98% rename from src/PaymentPart/Output/PrintOptions.php rename to src/PaymentPart/Output/DisplayOptions.php index a02fff22..a295a33b 100644 --- a/src/PaymentPart/Output/PrintOptions.php +++ b/src/PaymentPart/Output/DisplayOptions.php @@ -12,7 +12,7 @@ final class LineStyle public const NONE = 'NONE'; } -final class PrintOptions +final class DisplayOptions { private bool $isPrintable = false; private bool $displayScissors = false; diff --git a/src/PaymentPart/Output/FpdfOutput/FpdfOutput.php b/src/PaymentPart/Output/FpdfOutput/FpdfOutput.php index f6869bc3..5779f553 100644 --- a/src/PaymentPart/Output/FpdfOutput/FpdfOutput.php +++ b/src/PaymentPart/Output/FpdfOutput/FpdfOutput.php @@ -230,7 +230,7 @@ private function addFurtherInformationContent(): void private function addSeparatorContentIfNotPrintable(): void { - $layout = $this->getPrintOptions(); + $layout = $this->getDisplayOptions(); if ($layout->isPrintable()) { return; } diff --git a/src/PaymentPart/Output/HtmlOutput/HtmlOutput.php b/src/PaymentPart/Output/HtmlOutput/HtmlOutput.php index 3d865884..23d6e27b 100644 --- a/src/PaymentPart/Output/HtmlOutput/HtmlOutput.php +++ b/src/PaymentPart/Output/HtmlOutput/HtmlOutput.php @@ -125,7 +125,7 @@ private function addFurtherInformationContent(string $paymentPart): string private function hideSeparatorContentIfPrintable(string $paymentPart): string { - $layout = $this->getPrintOptions(); + $layout = $this->getDisplayOptions(); $printableStyles = ''; if ($layout->isPrintable()) { // draw nothing diff --git a/src/PaymentPart/Output/OutputInterface.php b/src/PaymentPart/Output/OutputInterface.php index e80e7ed3..135b8124 100644 --- a/src/PaymentPart/Output/OutputInterface.php +++ b/src/PaymentPart/Output/OutputInterface.php @@ -12,9 +12,9 @@ public function getLanguage(): ?string; public function getPaymentPart(): ?string; - public function setPrintOptions(PrintOptions $printOptions): static; + public function setDisplayOptions(DisplayOptions $displayOptions): static; - public function getPrintOptions(): PrintOptions; + public function getDisplayOptions(): DisplayOptions; public function setQrCodeImageFormat(string $imageFormat): static; diff --git a/src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php b/src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php index c786f71b..f24284ea 100644 --- a/src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php +++ b/src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php @@ -223,7 +223,7 @@ private function addFurtherInformationContent(): void private function addSeparatorContentIfNotPrintable(): void { - $layout = $this->getPrintOptions(); + $layout = $this->getDisplayOptions(); if ($layout->isPrintable()) { return; } diff --git a/tests/PaymentPart/Output/FpdfOutput/FpdfOutputTest.php b/tests/PaymentPart/Output/FpdfOutput/FpdfOutputTest.php index 78a133a3..b08235a5 100644 --- a/tests/PaymentPart/Output/FpdfOutput/FpdfOutputTest.php +++ b/tests/PaymentPart/Output/FpdfOutput/FpdfOutputTest.php @@ -8,7 +8,7 @@ use Sprain\SwissQrBill\Exception\InvalidFpdfImageFormat; use Sprain\SwissQrBill\PaymentPart\Output\FpdfOutput\FpdfOutput; use Sprain\SwissQrBill\PaymentPart\Output\FpdfOutput\UnsupportedEnvironmentException; -use Sprain\SwissQrBill\PaymentPart\Output\PrintOptions; +use Sprain\SwissQrBill\PaymentPart\Output\DisplayOptions; use Sprain\SwissQrBill\PaymentPart\Output\VerticalSeparatorSymbolPosition; use Sprain\SwissQrBill\QrBill; use Sprain\SwissQrBill\QrCode\QrCode; @@ -27,27 +27,27 @@ public function testValidQrBills(string $name, QrBill $qrBill): void { $variations = [ [ - 'layout' => (new PrintOptions())->setPrintable(false), + 'layout' => (new DisplayOptions())->setPrintable(false), 'format' => QrCode::FILE_FORMAT_PNG, 'file' => dirname(dirname(dirname(__DIR__))) . '/TestData/FpdfOutput/' . $name . '.pdf' ], [ - 'layout' => (new PrintOptions())->setPrintable(true), + 'layout' => (new DisplayOptions())->setPrintable(true), 'format' => QrCode::FILE_FORMAT_PNG, 'file' => dirname(dirname(dirname(__DIR__))) . '/TestData/FpdfOutput/' . $name . '.print.pdf' ], [ - 'layout' => (new PrintOptions())->setPrintable(false)->setDisplayScissors(true), + 'layout' => (new DisplayOptions())->setPrintable(false)->setDisplayScissors(true), 'format' => QrCode::FILE_FORMAT_PNG, 'file' => dirname(dirname(dirname(__DIR__))) . '/TestData/FpdfOutput/' . $name . '.scissors.pdf' ], [ - 'layout' => (new PrintOptions())->setPrintable(false)->setDisplayScissors(true)->setPositionScissorsAtBottom(true), + 'layout' => (new DisplayOptions())->setPrintable(false)->setDisplayScissors(true)->setPositionScissorsAtBottom(true), 'format' => QrCode::FILE_FORMAT_PNG, 'file' => __DIR__ . '/../../../TestData/FpdfOutput/' . $name . '.svg.scissorsdown.pdf' ], [ - 'layout' => (new PrintOptions())->setPrintable(false)->setDisplayTextDownArrows(true), + 'layout' => (new DisplayOptions())->setPrintable(false)->setDisplayTextDownArrows(true), 'format' => QrCode::FILE_FORMAT_PNG, 'file' => __DIR__ . '/../../../TestData/FpdfOutput/' . $name . '.svg.textarrows.pdf' ] @@ -61,7 +61,7 @@ public function testValidQrBills(string $name, QrBill $qrBill): void $output = new FpdfOutput($qrBill, 'en', $fpdf); $output - ->setPrintOptions($variation['layout']) + ->setDisplayOptions($variation['layout']) ->setQrCodeImageFormat($variation['format']) ->getPaymentPart(); @@ -93,7 +93,7 @@ public function testItThrowsMissingTraitException(): void $output = new FpdfOutput($qrBill, 'en', $fpdf); $output - ->setPrintOptions((new PrintOptions())->setPrintable(false)->setDisplayScissors(true)) + ->setDisplayOptions((new DisplayOptions())->setPrintable(false)->setDisplayScissors(true)) ->setQrCodeImageFormat(QrCode::FILE_FORMAT_PNG) ->getPaymentPart(); } @@ -116,7 +116,7 @@ public function testUtf8SpecialChars(): void $output = new FpdfOutput($qrBill, 'en', $fpdf); $output - ->setPrintOptions((new PrintOptions())->setPrintable(true)) + ->setDisplayOptions((new DisplayOptions())->setPrintable(true)) ->setQrCodeImageFormat(QrCode::FILE_FORMAT_PNG) ->getPaymentPart(); diff --git a/tests/PaymentPart/Output/FpdfOutput/FpdiOutputTest.php b/tests/PaymentPart/Output/FpdfOutput/FpdiOutputTest.php index bf1e8962..2ef123e1 100644 --- a/tests/PaymentPart/Output/FpdfOutput/FpdiOutputTest.php +++ b/tests/PaymentPart/Output/FpdfOutput/FpdiOutputTest.php @@ -7,7 +7,7 @@ use setasign\Fpdi\Fpdi; use Sprain\SwissQrBill\Exception\InvalidFpdfImageFormat; use Sprain\SwissQrBill\PaymentPart\Output\FpdfOutput\FpdfOutput; -use Sprain\SwissQrBill\PaymentPart\Output\PrintOptions; +use Sprain\SwissQrBill\PaymentPart\Output\DisplayOptions; use Sprain\SwissQrBill\PaymentPart\Output\VerticalSeparatorSymbolPosition; use Sprain\SwissQrBill\QrBill; use Sprain\SwissQrBill\QrCode\QrCode; @@ -26,27 +26,27 @@ public function testValidQrBills(string $name, QrBill $qrBill): void { $variations = [ [ - 'layout' => (new PrintOptions())->setPrintable(false), + 'layout' => (new DisplayOptions())->setPrintable(false), 'format' => QrCode::FILE_FORMAT_PNG, 'file' => dirname(dirname(dirname(__DIR__))) . '/TestData/FpdfOutput/' . $name . '.pdf' ], [ - 'layout' => (new PrintOptions())->setPrintable(true), + 'layout' => (new DisplayOptions())->setPrintable(true), 'format' => QrCode::FILE_FORMAT_PNG, 'file' => dirname(dirname(dirname(__DIR__))) . '/TestData/FpdfOutput/' . $name . '.print.pdf' ], [ - 'layout' => (new PrintOptions())->setPrintable(false)->setDisplayScissors(true), + 'layout' => (new DisplayOptions())->setPrintable(false)->setDisplayScissors(true), 'format' => QrCode::FILE_FORMAT_PNG, 'file' => dirname(dirname(dirname(__DIR__))) . '/TestData/FpdfOutput/' . $name . '.scissors.pdf' ], [ - 'layout' => (new PrintOptions())->setPrintable(false)->setDisplayScissors(true)->setPositionScissorsAtBottom(true), + 'layout' => (new DisplayOptions())->setPrintable(false)->setDisplayScissors(true)->setPositionScissorsAtBottom(true), 'format' => QrCode::FILE_FORMAT_PNG, 'file' => __DIR__ . '/../../../TestData/FpdfOutput/' . $name . '.svg.scissorsdown.pdf' ], [ - 'layout' => (new PrintOptions())->setPrintable(false)->setDisplayTextDownArrows(true), + 'layout' => (new DisplayOptions())->setPrintable(false)->setDisplayTextDownArrows(true), 'format' => QrCode::FILE_FORMAT_PNG, 'file' => __DIR__ . '/../../../TestData/FpdfOutput/' . $name . '.svg.textarrows.pdf' ] @@ -60,7 +60,7 @@ public function testValidQrBills(string $name, QrBill $qrBill): void $output = new FpdfOutput($qrBill, 'en', $fpdf); $output - ->setPrintOptions($variation['layout']) + ->setDisplayOptions($variation['layout']) ->setQrCodeImageFormat($variation['format']) ->getPaymentPart(); @@ -92,7 +92,7 @@ public function testItThrowsMissingTraitException(): void $output = new FpdfOutput($qrBill, 'en', $fpdf); $output - ->setPrintOptions((new PrintOptions())->setPrintable(false)->setDisplayScissors(true)) + ->setDisplayOptions((new DisplayOptions())->setPrintable(false)->setDisplayScissors(true)) ->setQrCodeImageFormat(QrCode::FILE_FORMAT_PNG) ->getPaymentPart(); } diff --git a/tests/PaymentPart/Output/HtmlOutput/HtmlOutputTest.php b/tests/PaymentPart/Output/HtmlOutput/HtmlOutputTest.php index cb9bc8b9..86b5adc7 100644 --- a/tests/PaymentPart/Output/HtmlOutput/HtmlOutputTest.php +++ b/tests/PaymentPart/Output/HtmlOutput/HtmlOutputTest.php @@ -4,7 +4,7 @@ use PHPUnit\Framework\TestCase; use Sprain\SwissQrBill\PaymentPart\Output\HtmlOutput\HtmlOutput; -use Sprain\SwissQrBill\PaymentPart\Output\PrintOptions; +use Sprain\SwissQrBill\PaymentPart\Output\DisplayOptions; use Sprain\SwissQrBill\PaymentPart\Output\VerticalSeparatorSymbolPosition; use Sprain\SwissQrBill\QrBill; use Sprain\SwissQrBill\QrCode\QrCode; @@ -23,27 +23,27 @@ public function testValidQrBills(string $name, QrBill $qrBill) { $variations = [ [ - 'layout' => (new PrintOptions())->setPrintable(false), + 'layout' => (new DisplayOptions())->setPrintable(false), 'format' => QrCode::FILE_FORMAT_SVG, 'file' => __DIR__ . '/../../../TestData/HtmlOutput/' . $name . $this->getCompact() . '.svg.html' ], [ - 'layout' => (new PrintOptions())->setPrintable(true), + 'layout' => (new DisplayOptions())->setPrintable(true), 'format' => QrCode::FILE_FORMAT_SVG, 'file' => __DIR__ . '/../../../TestData/HtmlOutput/' . $name . $this->getCompact() . '.svg.print.html' ], [ - 'layout' => (new PrintOptions())->setPrintable(false)->setDisplayScissors(true), + 'layout' => (new DisplayOptions())->setPrintable(false)->setDisplayScissors(true), 'format' => QrCode::FILE_FORMAT_SVG, 'file' => __DIR__ . '/../../../TestData/HtmlOutput/' . $name . $this->getCompact() . '.svg.scissors.html' ], [ - 'layout' => (new PrintOptions())->setPrintable(false)->setDisplayScissors(true)->setPositionScissorsAtBottom(true), + 'layout' => (new DisplayOptions())->setPrintable(false)->setDisplayScissors(true)->setPositionScissorsAtBottom(true), 'format' => QrCode::FILE_FORMAT_SVG, 'file' => __DIR__ . '/../../../TestData/HtmlOutput/' . $name . '.svg.scissorsdown.html' ], [ - 'layout' => (new PrintOptions())->setPrintable(false)->setDisplayTextDownArrows(true), + 'layout' => (new DisplayOptions())->setPrintable(false)->setDisplayTextDownArrows(true), 'format' => QrCode::FILE_FORMAT_SVG, 'file' => __DIR__ . '/../../../TestData/HtmlOutput/' . $name . '.svg.textarrows.html' ], @@ -66,7 +66,7 @@ public function testValidQrBills(string $name, QrBill $qrBill) $htmlOutput = (new HtmlOutput($qrBill, 'en')); $output = $htmlOutput - ->setPrintOptions($variation['layout']) + ->setDisplayOptions($variation['layout']) ->setQrCodeImageFormat($variation['format']) ->getPaymentPart(); diff --git a/tests/PaymentPart/Output/TcPdfOutput/FpdiOutputTest.php b/tests/PaymentPart/Output/TcPdfOutput/FpdiOutputTest.php index 9527e885..a15aec67 100644 --- a/tests/PaymentPart/Output/TcPdfOutput/FpdiOutputTest.php +++ b/tests/PaymentPart/Output/TcPdfOutput/FpdiOutputTest.php @@ -4,7 +4,7 @@ use PHPUnit\Framework\TestCase; use setasign\Fpdi\Tcpdf\Fpdi; -use Sprain\SwissQrBill\PaymentPart\Output\PrintOptions; +use Sprain\SwissQrBill\PaymentPart\Output\DisplayOptions; use Sprain\SwissQrBill\PaymentPart\Output\VerticalSeparatorSymbolPosition; use Sprain\SwissQrBill\PaymentPart\Output\TcPdfOutput\TcPdfOutput; use Sprain\SwissQrBill\QrBill; @@ -22,27 +22,27 @@ public function testValidQrBills(string $name, QrBill $qrBill): void { $variations = [ [ - 'layout' => (new PrintOptions())->setPrintable(false), + 'layout' => (new DisplayOptions())->setPrintable(false), 'format' => QrCode::FILE_FORMAT_SVG, 'file' => __DIR__ . '/../../../TestData/TcPdfOutput/' . $name . '.svg.pdf' ], [ - 'layout' => (new PrintOptions())->setPrintable(true), + 'layout' => (new DisplayOptions())->setPrintable(true), 'format' => QrCode::FILE_FORMAT_SVG, 'file' => __DIR__ . '/../../../TestData/TcPdfOutput/' . $name . '.svg.print.pdf' ], [ - 'layout' => (new PrintOptions())->setPrintable(false)->setDisplayScissors(true), + 'layout' => (new DisplayOptions())->setPrintable(false)->setDisplayScissors(true), 'format' => QrCode::FILE_FORMAT_SVG, 'file' => __DIR__ . '/../../../TestData/TcPdfOutput/' . $name . '.svg.scissors.pdf' ], [ - 'layout' => (new PrintOptions())->setPrintable(false)->setDisplayScissors(true)->setPositionScissorsAtBottom(true), + 'layout' => (new DisplayOptions())->setPrintable(false)->setDisplayScissors(true)->setPositionScissorsAtBottom(true), 'format' => QrCode::FILE_FORMAT_SVG, 'file' => __DIR__ . '/../../../TestData/TcPdfOutput/' . $name . '.svg.scissorsdown.pdf' ], [ - 'layout' => (new PrintOptions())->setPrintable(false)->setDisplayTextDownArrows(true), + 'layout' => (new DisplayOptions())->setPrintable(false)->setDisplayTextDownArrows(true), 'format' => QrCode::FILE_FORMAT_SVG, 'file' => __DIR__ . '/../../../TestData/TcPdfOutput/' . $name . '.svg.textarrows.pdf' ], @@ -70,7 +70,7 @@ public function testValidQrBills(string $name, QrBill $qrBill): void $output = (new TcPdfOutput($qrBill, 'en', $tcPdf)); $output - ->setPrintOptions($variation['layout']) + ->setDisplayOptions($variation['layout']) ->setQrCodeImageFormat($variation['format']) ->getPaymentPart(); diff --git a/tests/PaymentPart/Output/TcPdfOutput/TcPdfOutputTest.php b/tests/PaymentPart/Output/TcPdfOutput/TcPdfOutputTest.php index 96bbbcc7..34079bd5 100644 --- a/tests/PaymentPart/Output/TcPdfOutput/TcPdfOutputTest.php +++ b/tests/PaymentPart/Output/TcPdfOutput/TcPdfOutputTest.php @@ -3,7 +3,7 @@ namespace Sprain\Tests\SwissQrBill\PaymentPart\Output\TcPdfOutput; use PHPUnit\Framework\TestCase; -use Sprain\SwissQrBill\PaymentPart\Output\PrintOptions; +use Sprain\SwissQrBill\PaymentPart\Output\DisplayOptions; use Sprain\SwissQrBill\PaymentPart\Output\VerticalSeparatorSymbolPosition; use Sprain\SwissQrBill\PaymentPart\Output\TcPdfOutput\TcPdfOutput; use Sprain\SwissQrBill\QrBill; @@ -21,27 +21,27 @@ public function testValidQrBills(string $name, QrBill $qrBill): void { $variations = [ [ - 'layout' => (new PrintOptions())->setPrintable(false), + 'layout' => (new DisplayOptions())->setPrintable(false), 'format' => QrCode::FILE_FORMAT_SVG, 'file' => __DIR__ . '/../../../TestData/TcPdfOutput/' . $name . '.svg.pdf' ], [ - 'layout' => (new PrintOptions())->setPrintable(true), + 'layout' => (new DisplayOptions())->setPrintable(true), 'format' => QrCode::FILE_FORMAT_SVG, 'file' => __DIR__ . '/../../../TestData/TcPdfOutput/' . $name . '.svg.print.pdf' ], [ - 'layout' => (new PrintOptions())->setPrintable(false)->setDisplayScissors(true), + 'layout' => (new DisplayOptions())->setPrintable(false)->setDisplayScissors(true), 'format' => QrCode::FILE_FORMAT_SVG, 'file' => __DIR__ . '/../../../TestData/TcPdfOutput/' . $name . '.svg.scissors.pdf' ], [ - 'layout' => (new PrintOptions())->setPrintable(false)->setDisplayScissors(true)->setPositionScissorsAtBottom(true), + 'layout' => (new DisplayOptions())->setPrintable(false)->setDisplayScissors(true)->setPositionScissorsAtBottom(true), 'format' => QrCode::FILE_FORMAT_SVG, 'file' => __DIR__ . '/../../../TestData/TcPdfOutput/' . $name . '.svg.scissorsdown.pdf' ], [ - 'layout' => (new PrintOptions())->setPrintable(false)->setDisplayTextDownArrows(true), + 'layout' => (new DisplayOptions())->setPrintable(false)->setDisplayTextDownArrows(true), 'format' => QrCode::FILE_FORMAT_SVG, 'file' => __DIR__ . '/../../../TestData/TcPdfOutput/' . $name . '.svg.textarrows.pdf' ], @@ -69,7 +69,7 @@ public function testValidQrBills(string $name, QrBill $qrBill): void $output = (new TcPdfOutput($qrBill, 'en', $tcPdf)); $output - ->setPrintOptions($variation['layout']) + ->setDisplayOptions($variation['layout']) ->setQrCodeImageFormat($variation['format']) ->getPaymentPart(); @@ -104,7 +104,7 @@ public function testUtf8SpecialChars(): void $output = (new TcPdfOutput($qrBill, 'en', $tcPdf)); $output - ->setPrintOptions((new PrintOptions())->setPrintable(true)) + ->setDisplayOptions((new DisplayOptions())->setPrintable(true)) ->setQrCodeImageFormat(QrCode::FILE_FORMAT_SVG) ->getPaymentPart();