@@ -68,9 +67,9 @@
$pdf->ln(10);
-$multicell->multiCell(0, 10, "Table of Content:");
+$multicell->multiCell(0, 10, 'Table of Content:');
-$s = <<
- Paragraph 1
- Paragraph 2
- Paragraph 2.1
@@ -80,9 +79,9 @@
$multicell->multiCell(0, 5, $s);
$pdf->ln(10);
-$multicell->multiCell(0, 10, "Tag width and alignment:");
+$multicell->multiCell(0, 10, 'Tag width and alignment:');
-$s = << Align Left
Align Center
Align Right
@@ -90,7 +89,7 @@
$multicell->multiCell(100, 5, $s, 1, '', 1);
$pdf->AddPage();
-$multicell->multiCell(0, 10, "No wrap: text will not break on normal separators");
+$multicell->multiCell(0, 10, 'No wrap: text will not break on normal separators');
$s = "The price is USD 5.344,23";
foreach ([40, 45, 50] as $width) {
diff --git a/dev/dev-multicell-shrinking.php b/dev/dev-multicell-shrinking.php
index 5d679f6..3dce0e0 100644
--- a/dev/dev-multicell-shrinking.php
+++ b/dev/dev-multicell-shrinking.php
@@ -3,14 +3,13 @@
/**
* Pdf Advanced Multicell - Example
*/
-
$factory = new DevFactory();
// Create the Advanced Multicell Object and inject the PDF object
$multicell = $factory->multicell();
$pdf = $multicell->getPdfObject();
-$txt = <<TCPDF addon allows creation of an Advanced Multicell which uses as input a TAG based formatted string instead of a simple string. The use of tags allows to change the font, the style (bold, italic, underline), the size, and the color of characters and many other features.
Features:
@@ -50,7 +49,7 @@
//
//$pdf->AddPage();
-$txt = <<maxHeight(100)->shrinkToFit();
$multicell->multiCell(0, 5, $txt, 1, 'J', 1, 3, 3, 3, 3);
//$multicell->maxLines(3)->shrinkToFit();
-$txt = <<TCPDF addon allows creation of an Advanced Multicell which uses as input a TAG based formatted string instead of a simple string. The use of tags allows to change the font, the style (bold, italic, underline), the size, and the color of characters and many other features.
EOL;
diff --git a/dev/dev-multicell-shrinking4.php b/dev/dev-multicell-shrinking4.php
index 90d13aa..cd37377 100644
--- a/dev/dev-multicell-shrinking4.php
+++ b/dev/dev-multicell-shrinking4.php
@@ -21,7 +21,7 @@
//$multicell->maxLines(3)->shrinkToFit();
-$txt = <<TCPDF addon allows creation of an Advanced Multicell which uses as input a TAG based formatted string instead of a simple string. The use of tags allows to change the font, the style (bold, italic, underline), the size, and the color of characters and many other features.
Features:
diff --git a/dev/dev-multicell-style-inheritance.php b/dev/dev-multicell-style-inheritance.php
index 54a8913..274d4fa 100644
--- a/dev/dev-multicell-style-inheritance.php
+++ b/dev/dev-multicell-style-inheritance.php
@@ -3,7 +3,6 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/../autoload.php';
use EvoSys21\PdfLib\Fpdf\Pdf;
@@ -24,7 +23,6 @@
// add a page
$pdf->AddPage();
-
// Create the Advanced Multicell Object and inject the PDF object
$multicell = new Multicell($pdf);
diff --git a/dev/dev-multicell-style-inheritance1.php b/dev/dev-multicell-style-inheritance1.php
index 21fbab3..a744fe8 100644
--- a/dev/dev-multicell-style-inheritance1.php
+++ b/dev/dev-multicell-style-inheritance1.php
@@ -3,7 +3,6 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/../autoload.php';
use EvoSys21\PdfLib\Fpdf\Pdf;
@@ -24,7 +23,6 @@
// add a page
$pdf->AddPage();
-
// Create the Advanced Multicell Object and inject the PDF object
$multicell = new Multicell($pdf);
diff --git a/dev/dev-multicell-style.php b/dev/dev-multicell-style.php
index ab7086b..903ce83 100644
--- a/dev/dev-multicell-style.php
+++ b/dev/dev-multicell-style.php
@@ -12,7 +12,7 @@
$multicell = $factory->multicell();
$pdf = $multicell->getPdfObject();
-$txt = <<<?php /** * Pdf Advanced Multicell - Example
diff --git a/dev/dev-multicell-style1.php b/dev/dev-multicell-style1.php
index 3cefc56..17a6228 100644
--- a/dev/dev-multicell-style1.php
+++ b/dev/dev-multicell-style1.php
@@ -12,7 +12,7 @@
$multicell = $factory->multicell();
$pdf = $multicell->getPdfObject();
-$txt = <<<?php /** * Pdf Advanced Multicell - Example
diff --git a/dev/example-multicell-dev.php b/dev/example-multicell-dev.php
index 4be84be..e852174 100644
--- a/dev/example-multicell-dev.php
+++ b/dev/example-multicell-dev.php
@@ -3,7 +3,6 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/../autoload.php';
use EvoSys21\PdfLib\Fpdf\Pdf;
@@ -24,7 +23,6 @@
// add a page
$pdf->AddPage();
-
// Create the Advanced Multicell Object and inject the PDF object
$multicell = new Multicell($pdf);
@@ -67,7 +65,7 @@
//$pdf->ln(10);
$s = "The price is USD 5.344,23";
-$s1 = "The price is USD 5.344,23";
+$s1 = 'The price is USD 5.344,23';
foreach ([40, 45, 50] as $width) {
$multicell->multiCell($width, 5, $s, 0, 'L');
$multicell->multiCell($width, 5, $s1, 0, 'L');
@@ -91,6 +89,5 @@
//
xxx
- Paragraph 2";
//$multicell->multiCell(0, 5, $s);
-
// output the pdf
$pdf->Output();
diff --git a/dev/example-table-dev.php b/dev/example-table-dev.php
index 389c65b..fbbc8ba 100644
--- a/dev/example-table-dev.php
+++ b/dev/example-table-dev.php
@@ -3,7 +3,6 @@
/**
* Pdf Advanced Table - Example
*/
-
require_once __DIR__ . '/../autoload.php';
use EvoSys21\PdfLib\Fpdf\Pdf;
@@ -52,7 +51,7 @@
'I am cell 2',
[
'TEXT' => 'I am cell 3',
- 'TEXT_ALIGN' => 'R'
+ 'TEXT_ALIGN' => 'R',
],
];
@@ -64,7 +63,7 @@
'I am cell 2',
[
'TEXT' => 'I am cell 3',
- 'TEXT_ALIGN' => 'R'
+ 'TEXT_ALIGN' => 'R',
],
];
@@ -74,7 +73,7 @@
$row = [
new Image($pdf, CONTENT_PATH . '/images/blog.jpg', 10),
"
\nSome text";
-$sDefaultLongText = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";
-$sDefaultLongText2 = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur";
+$sDefaultLongText = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
+$sDefaultLongText2 = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur';
$aDefaultRow = [];
for ($i = 0; $i < $columns; $i++) {
diff --git a/dev/table/draw-table-model1.php b/dev/table/draw-table-model1.php
index 5f73cdb..e4392e2 100644
--- a/dev/table/draw-table-model1.php
+++ b/dev/table/draw-table-model1.php
@@ -4,7 +4,7 @@
global $pdf;
-if (!isset($splitMode)) {
+if (! isset($splitMode)) {
$splitMode = true;
}
@@ -35,7 +35,7 @@
//Table Header
for ($i = 0; $i < $columns; $i++) {
- $header[$i]['TEXT'] = "Header #" . ($i + 1);
+ $header[$i]['TEXT'] = 'Header #' . ($i + 1);
}
$header1 = $header;
@@ -49,10 +49,10 @@
$table->addHeader($header);
$table->addHeader($header1);
-$sDefaultText = "Lorem ipsum;, dolor sit amet";
+$sDefaultText = 'Lorem ipsum;, dolor sit amet';
$sDefaultText2 = "
Some Line
\nSome text";
-$sDefaultLongText = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";
-$sDefaultLongText2 = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur";
+$sDefaultLongText = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
+$sDefaultLongText2 = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur';
$aDefaultRow = [];
for ($i = 0; $i < $columns; $i++) {
diff --git a/dev/table/draw-table-model2.php b/dev/table/draw-table-model2.php
index 35044d8..e904a2b 100644
--- a/dev/table/draw-table-model2.php
+++ b/dev/table/draw-table-model2.php
@@ -2,7 +2,7 @@
use EvoSys21\PdfLib\Table;
-if (!isset($splitMode)) {
+if (! isset($splitMode)) {
$splitMode = true;
}
@@ -33,7 +33,7 @@
//Table Header
for ($i = 0; $i < $columns; $i++) {
- $header[$i]['TEXT'] = "Header #" . ($i + 1);
+ $header[$i]['TEXT'] = 'Header #' . ($i + 1);
}
$header1 = $header;
@@ -47,10 +47,10 @@
$table->addHeader($header);
$table->addHeader($header1);
-$sDefaultText = "Lorem ipsum;, dolor sit amet";
+$sDefaultText = 'Lorem ipsum;, dolor sit amet';
$sDefaultText2 = "
Some Line
\nSome text";
-$sDefaultLongText = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";
-$sDefaultLongText2 = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur";
+$sDefaultLongText = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
+$sDefaultLongText2 = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur';
$aDefaultRow = [];
for ($i = 0; $i < $columns; $i++) {
diff --git a/dev/test-multicell-align.php b/dev/test-multicell-align.php
index 4f4e7e2..118d8b7 100644
--- a/dev/test-multicell-align.php
+++ b/dev/test-multicell-align.php
@@ -9,9 +9,9 @@
$multicell = $factory->multicell();
$pdf = $multicell->getPdfObject();
-$short = "Lorem ipsum dolor sit amet";
+$short = 'Lorem ipsum dolor sit amet';
-$txt = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";
+$txt = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
foreach (range(5, 0) as $key => $padding) {
if ($key) {
diff --git a/dev/test-multicell-disable-pagebreak.php b/dev/test-multicell-disable-pagebreak.php
index 1038d5e..85cd86b 100644
--- a/dev/test-multicell-disable-pagebreak.php
+++ b/dev/test-multicell-disable-pagebreak.php
@@ -9,7 +9,7 @@
$multicell = $factory->multicell();
$pdf = $multicell->getPdfObject();
-$txt = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";
+$txt = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
$pdf->AutoPageBreak = false;
$multicell->disablePageBreak();
diff --git a/dev/test-multicell-min-height.php b/dev/test-multicell-min-height.php
index 82451fa..e9b9c88 100644
--- a/dev/test-multicell-min-height.php
+++ b/dev/test-multicell-min-height.php
@@ -9,7 +9,7 @@
$multicell = $factory->multicell();
$pdf = $multicell->getPdfObject();
-$txt = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";
+$txt = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
$multicell->multiCell(100, 5, $txt, 1, 'J', 1, 3, 3, 3, 3, 50);
diff --git a/dev/test-multicell-shrinking.php b/dev/test-multicell-shrinking.php
index 28bcf6b..8dc3324 100644
--- a/dev/test-multicell-shrinking.php
+++ b/dev/test-multicell-shrinking.php
@@ -9,8 +9,7 @@
$multicell = $factory->multicell();
$pdf = $multicell->getPdfObject();
-
-$txt = <<TCPDF addon allows creation of an Advanced Multicell which uses as input a TAG based formatted string instead of a simple string. The use of tags allows to change the font, the style (bold, italic, underline), the size, and the color of characters and many other features.
Features:
@@ -50,7 +49,7 @@
$pdf->AddPage();
-$txt = <<multicell();
$pdf = $multicell->getPdfObject();
-
-$txt = <<TCPDF addon allows creation of an Advanced Multicell which uses as input a TAG based formatted string instead of a simple string. The use of tags allows to change the font, the style (bold, italic, underline), the size, and the color of characters and many other features.
Features:
diff --git a/dev/test-multicell-style.php b/dev/test-multicell-style.php
index 4b4a94d..a55757a 100644
--- a/dev/test-multicell-style.php
+++ b/dev/test-multicell-style.php
@@ -10,8 +10,7 @@
$multicell = $factory->multicell();
$pdf = $multicell->getPdfObject();
-
-$txt = <<More text Initial textMore text
EOL;
diff --git a/examples/Fpdf/MyPdf.php b/examples/Fpdf/MyPdf.php
index 2a62803..71b9be5 100644
--- a/examples/Fpdf/MyPdf.php
+++ b/examples/Fpdf/MyPdf.php
@@ -26,7 +26,7 @@ class MyPdf extends Pdf
*/
public function Header()
{
- if (!$this->showHeader) {
+ if (! $this->showHeader) {
return;
}
@@ -58,7 +58,6 @@ public function Header()
$this->SetY($this->tMargin);
}
-
/**
* Custom Footer
*
@@ -68,7 +67,7 @@ public function Footer()
{
$this->drawMargins && $this->drawMarginLines();
- if (!$this->showFooter) {
+ if (! $this->showFooter) {
return;
}
@@ -80,8 +79,6 @@ public function Footer()
/**
* Returns the default Font to be used
- *
- * @return string
*/
public function getDefaultFont(): string
{
@@ -106,7 +103,6 @@ public function drawMarginLines(): void
$this->Line($this->w - $this->rMargin, 0, $this->w - $this->rMargin, $this->h);
}
-
/**
* Disable the Producer and CreationDate. It breaks the functional unit-testing(date always changes)
* phpcs:disable PSR2.Methods.MethodDeclaration.Underscore
@@ -126,16 +122,16 @@ public function _putinfo()
protected static function isTesting(): bool
{
- return (getenv('APP_ENV') === 'testing');
+ return getenv('APP_ENV') === 'testing';
}
/**
- * @param string $headerSource
* @return $this
*/
public function setHeaderSource(string $headerSource): self
{
$this->headerSource = $headerSource;
+
return $this;
}
}
diff --git a/examples/Fpdf/PdfFactory.php b/examples/Fpdf/PdfFactory.php
index cf9200c..0cb62e4 100644
--- a/examples/Fpdf/PdfFactory.php
+++ b/examples/Fpdf/PdfFactory.php
@@ -15,10 +15,8 @@ class PdfFactory
/**
* Creates a new PDF Object and Initializes it
*
- * @param string $type
* @param bool $header Show the header
* @param bool $footer Show the footer
- * @return MyPdf
*/
public static function newPdf(string $type, bool $header = true, bool $footer = true): MyPdf
{
@@ -43,9 +41,6 @@ public static function newPdf(string $type, bool $header = true, bool $footer =
* Initializes the pdf object.
* Set the margins, adds a page, adds default fonts etc...
*
- * @param Pdf $pdf
- * @param bool $header
- * @param bool $footer
* @return Pdf $pdf
*/
public static function initPdf(Pdf $pdf, bool $header = true, bool $footer = true): Pdf
diff --git a/examples/Fpdf/PdfSettings.php b/examples/Fpdf/PdfSettings.php
index a7750aa..f449995 100644
--- a/examples/Fpdf/PdfSettings.php
+++ b/examples/Fpdf/PdfSettings.php
@@ -7,7 +7,7 @@
use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Table;
-if (!defined('__DIR__')) {
+if (! defined('__DIR__')) {
define('__DIR__', __DIR__ . '/../../..');
}
@@ -20,10 +20,9 @@ class PdfSettings
[86, 155, 225],
[207, 247, 239],
[246, 211, 207],
- [216, 243, 228]
+ [216, 243, 228],
];
-
//top, right, bottom, left
public static $paddings = [
[0, 0, 0, 0],
@@ -43,28 +42,26 @@ class PdfSettings
[5, 5, 5, 0],
[0, 5, 5, 5],
[5, 0, 5, 5],
- [5, 5, 0, 5]
+ [5, 5, 0, 5],
];
-
public static $alignments = ['TL', 'TC', 'TR', 'ML', 'MC', 'MR', 'BL', 'BC', 'BR'];
-
- public static $textShort = "Hello world!";
- public static $text = "Lorem ipsum dolor sit amet...";
+ public static $textShort = 'Hello world!';
+ public static $text = 'Lorem ipsum dolor sit amet...';
public static $text2 = "
Simple text\nBold text
";
- public static $textLong = "
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
";
- public static $textExtraLong = "
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur
";
+ public static $textLong = '
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
';
+ public static $textExtraLong = '
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur
';
public static $textSubSuperscript = "Subscript or Superscript";
public static $columns = 5;
//prepare some default row settings
- public static array $imageCell = array(
+ public static array $imageCell = [
'TYPE' => 'IMAGE',
'FILE' => CONTENT_PATH . '/images/dice.jpg',
- 'WIDTH' => 10
- );
+ 'WIDTH' => 10,
+ ];
public static function headerRow(): array
{
@@ -72,6 +69,7 @@ public static function headerRow(): array
for ($i = 0; $i < static::$columns; $i++) {
$headerRow[$i]['TEXT'] = "Header #$i";
}
+
return $headerRow;
}
@@ -79,12 +77,12 @@ public static function dataRow(): array
{
$dataRow = [];
for ($i = 0; $i < static::$columns; $i++) {
- $dataRow[$i]['TEXT'] = "Cool cell";
+ $dataRow[$i]['TEXT'] = 'Cool cell';
}
+
return $dataRow;
}
-
/**
* Set the styles for the advanced multicell
*
@@ -111,11 +109,8 @@ public static function setMulticellStyles(Multicell $multicell)
$multicell->setStyle('code', 9, '', null, 'courier');
}
-
/**
* Set the styles for the advanced table
- *
- * @param Table $table
*/
public static function setTableStyles(Table $table)
{
diff --git a/examples/Fpdf/example-multicell-1-overview.php b/examples/Fpdf/example-multicell-1-overview.php
index c6ce62c..259bca1 100644
--- a/examples/Fpdf/example-multicell-1-overview.php
+++ b/examples/Fpdf/example-multicell-1-overview.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Fpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Fpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('multicell');
diff --git a/examples/Fpdf/example-multicell-2-overview-page-break.php b/examples/Fpdf/example-multicell-2-overview-page-break.php
index 0e4258f..a98bae9 100644
--- a/examples/Fpdf/example-multicell-2-overview-page-break.php
+++ b/examples/Fpdf/example-multicell-2-overview-page-break.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Fpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Fpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('multicell');
@@ -27,7 +26,6 @@
$pdf->Ln(10); //line break
-
//read TAG formatted text from file
$txt = file_get_contents(CONTENT_PATH . '/multicell.txt');
$s = $txt . "\n\n\n\nRepeat the text to trigger a page break \n\n\n" . $txt;
diff --git a/examples/Fpdf/example-multicell-3-line-breaking.php b/examples/Fpdf/example-multicell-3-line-breaking.php
index 8b9ee23..8befb31 100644
--- a/examples/Fpdf/example-multicell-3-line-breaking.php
+++ b/examples/Fpdf/example-multicell-3-line-breaking.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Fpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Fpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('multicell');
@@ -26,20 +25,17 @@
$multicell->multiCell(100, 5, $txt, 1, 'R', 0, 0, 1);
$pdf->Ln(10); //new line
-
//create an advanced multicell
$multicell->multiCell(0, 5, 'Setting > as line breaking character');
$multicell->setLineBreakingCharacters('>');
$multicell->multiCell(100, 5, $txt, 1);
$pdf->Ln(10); //new line
-
//create an advanced multicell
$multicell->multiCell(0, 5, 'Reseting the line breaking characters');
$multicell->resetLineBreakingCharacters();
$multicell->multiCell(100, 5, $txt, 1);
$pdf->Ln(10); //new line
-
//send the pdf to the browser
$pdf->Output();
diff --git a/examples/Fpdf/example-multicell-4-page-break.php b/examples/Fpdf/example-multicell-4-page-break.php
index 29b4629..e035dae 100644
--- a/examples/Fpdf/example-multicell-4-page-break.php
+++ b/examples/Fpdf/example-multicell-4-page-break.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Fpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Fpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('multicell');
diff --git a/examples/Fpdf/example-multicell-5-max-lines.php b/examples/Fpdf/example-multicell-5-max-lines.php
index e3afdc5..6c1313c 100644
--- a/examples/Fpdf/example-multicell-5-max-lines.php
+++ b/examples/Fpdf/example-multicell-5-max-lines.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Fpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Fpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('multicell');
diff --git a/examples/Fpdf/example-multicell-6-shrinking.php b/examples/Fpdf/example-multicell-6-shrinking.php
index ded65b3..87065d1 100644
--- a/examples/Fpdf/example-multicell-6-shrinking.php
+++ b/examples/Fpdf/example-multicell-6-shrinking.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Fpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Fpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('multicell');
@@ -20,10 +19,10 @@
PdfSettings::setMulticellStyles($multicell);
$pdf->Ln(5); //line break
-$multicell->multiCell(120, 5, "
Multicell text shrinking feature
");
+$multicell->multiCell(120, 5, '
Multicell text shrinking feature
');
$pdf->Ln(10); //line break
-$txt = <<TCPDF addon allows creation of an Advanced Multicell which uses as input a TAG based formatted string instead of a simple string. The use of tags allows to change the font, the style (bold, italic, underline), the size, and the color of characters and many other features.
Features:
@@ -52,7 +51,7 @@
$pdf->AddPage();
-$txt = <<setStyle('h4', 11, null, null, null, 'h');
$multicell->setStyle('super', 8, null, [255, 102, 153]);
-$s = <<This line is a paragraph line
@@ -68,7 +67,7 @@
$pdf->ln(10);
-$s = <<Typography:
Heading 1
@@ -81,9 +80,9 @@
$pdf->ln(10);
-$multicell->multiCell(0, 10, "Table of Content:");
+$multicell->multiCell(0, 10, 'Table of Content:');
-$s = <<
- Paragraph 1
- Paragraph 2
- Paragraph 2.1
@@ -93,9 +92,9 @@
$multicell->multiCell(0, 5, $s);
$pdf->ln(10);
-$multicell->multiCell(0, 10, "Tag width and alignment:");
+$multicell->multiCell(0, 10, 'Tag width and alignment:');
-$s = << Align Left
Align Center
Align Right
@@ -103,7 +102,7 @@
$multicell->multiCell(100, 5, $s, 1, '', 1);
$pdf->AddPage();
-$multicell->multiCell(0, 10, "No wrap: text will not break on normal separators");
+$multicell->multiCell(0, 10, 'No wrap: text will not break on normal separators');
$s = "The price is USD 5.344,23";
foreach ([40, 45, 50] as $width) {
diff --git a/examples/Fpdf/example-table-1-overview.php b/examples/Fpdf/example-table-1-overview.php
index d319f58..0d7c734 100644
--- a/examples/Fpdf/example-table-1-overview.php
+++ b/examples/Fpdf/example-table-1-overview.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Table - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Fpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Fpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('table');
@@ -21,28 +20,27 @@
//simple table
$multicell->multiCell(0, 5, "
~~~Simple table:
");
-require(__DIR__ . '/table/code-example1.php');
+require __DIR__ . '/table/code-example1.php';
//cells can be multicells and images
$pdf->Ln(10);
$multicell->multiCell(0, 5, "
',
+ 'BACKGROUND_COLOR' => PdfSettings::$colors[0],
+];
$row[2] = new Image($pdf, CONTENT_PATH . '/images/pencil.jpg', 10);
-$row[2]->setAlign("R");
+$row[2]->setAlign('R');
//add the data row
$table->addRow($row);
diff --git a/examples/Fpdf/table/code-example3.php b/examples/Fpdf/table/code-example3.php
index 2def850..2c8620e 100644
--- a/examples/Fpdf/table/code-example3.php
+++ b/examples/Fpdf/table/code-example3.php
@@ -1,10 +1,10 @@
initialize([20, 30, 40, 50]);
$header1 = PdfSettings::headerRow();
@@ -31,7 +30,7 @@
$header2 = PdfSettings::headerRow();
$header3 = PdfSettings::headerRow();
-$header2[1]['TEXT'] = "Colspan/Rowspan in Header";
+$header2[1]['TEXT'] = 'Colspan/Rowspan in Header';
$header2[1]['COLSPAN'] = 2;
$header2[1]['ROWSPAN'] = 2;
@@ -39,7 +38,6 @@
$table->addHeader($header2);
$table->addHeader($header3);
-
for ($i = 0; $i < 8; $i++) {
$row = PdfSettings::dataRow();
@@ -68,7 +66,6 @@
$row[1]['ROWSPAN'] = 2;
}
-
$table->addRow($row);
}
diff --git a/examples/Fpdf/table_example1.php b/examples/Fpdf/table_example1.php
index 4ab6ea3..64b9cd8 100644
--- a/examples/Fpdf/table_example1.php
+++ b/examples/Fpdf/table_example1.php
@@ -9,7 +9,7 @@
//Table Header
for ($i = 0; $i < $columns; $i++) {
- $header[$i]['TEXT'] = "Header #" . ($i + 1);
+ $header[$i]['TEXT'] = 'Header #' . ($i + 1);
}
//add the header
@@ -24,7 +24,6 @@
$row[2]['TEXT'] = "Line $j Text 3"; //text for column 2
$row[2]['TEXT_ALIGN'] = 'R'; //text align
-
//add the row
$table->addRow($row);
//break;
diff --git a/examples/Fpdf/table_example2.php b/examples/Fpdf/table_example2.php
index 78fbae4..db84276 100644
--- a/examples/Fpdf/table_example2.php
+++ b/examples/Fpdf/table_example2.php
@@ -9,7 +9,7 @@
//Table Header
for ($i = 0; $i < $columns; $i++) {
- $header[$i]['TEXT'] = "Header #" . ($i + 1);
+ $header[$i]['TEXT'] = 'Header #' . ($i + 1);
}
$table->addHeader($header);
@@ -56,21 +56,21 @@
}
if ($j == 7) {
- $row[1]['TEXT'] = "Top Left Align";
+ $row[1]['TEXT'] = 'Top Left Align';
$row[1]['VERTICAL_ALIGN'] = 'T';
$row[1]['TEXT_ALIGN'] = 'L';
- $row[2]['TEXT'] = "Bottom Right Align";
+ $row[2]['TEXT'] = 'Bottom Right Align';
$row[2]['VERTICAL_ALIGN'] = 'B';
$row[2]['TEXT_ALIGN'] = 'R';
}
if ($j == 8) {
- $row[1]['TEXT'] = "Top Center Align";
+ $row[1]['TEXT'] = 'Top Center Align';
$row[1]['VERTICAL_ALIGN'] = 'T';
$row[1]['TEXT_ALIGN'] = 'C';
- $row[2]['TEXT'] = "Bottom Center Align";
+ $row[2]['TEXT'] = 'Bottom Center Align';
$row[2]['VERTICAL_ALIGN'] = 'B';
$row[2]['TEXT_ALIGN'] = 'C';
}
@@ -94,7 +94,7 @@
}
if ($j == 14) {
- $row[1]['TEXT'] = "Cell Properties Overwriting Example";
+ $row[1]['TEXT'] = 'Cell Properties Overwriting Example';
$row[1]['TEXT_FONT'] = 'Times';
$row[1]['TEXT_SIZE'] = 7;
$row[1]['TEXT_TYPE'] = 'B';
diff --git a/examples/Tcpdf/MyPdf.php b/examples/Tcpdf/MyPdf.php
index 78b38a5..0449604 100644
--- a/examples/Tcpdf/MyPdf.php
+++ b/examples/Tcpdf/MyPdf.php
@@ -4,11 +4,12 @@
namespace EvoSys21\PdfLib\Examples\Tcpdf;
-use EvoSys21\PdfLib\Tcpdf\Pdf;
use EvoSys21\PdfLib\Multicell;
+use EvoSys21\PdfLib\Tcpdf\Pdf;
/**
* Custom PDF class extension for Header and Footer Definitions
+ *
* @SuppressWarnings(PHPMD.CamelCaseMethodName)
* @SuppressWarnings(PHPMD.Superglobals)
* phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
@@ -25,7 +26,7 @@ class MyPdf extends Pdf
*/
public function Header()
{
- if (!$this->showHeader) {
+ if (! $this->showHeader) {
return;
}
@@ -57,7 +58,6 @@ public function Header()
$this->SetY($this->tMargin);
}
-
/**
* Custom Footer
*
@@ -67,7 +67,7 @@ public function Footer()
{
$this->drawMargins && $this->drawMarginLines();
- if (!$this->showFooter) {
+ if (! $this->showFooter) {
return;
}
@@ -79,8 +79,6 @@ public function Footer()
/**
* Returns the default Font to be used
- *
- * @return string
*/
public function getDefaultFont(): string
{
@@ -105,7 +103,6 @@ public function drawMarginLines(): void
$this->Line($this->w - $this->rMargin, 0, $this->w - $this->rMargin, $this->h);
}
-
/**
* Disable the Producer and CreationDate. It breaks the functional unit-testing(date always changes)
* phpcs:disable PSR2.Methods.MethodDeclaration.Underscore
@@ -116,35 +113,36 @@ public function _putinfo()
$this->file_id = '1234567890';
$this->tcpdf_version = 'x.x.x';
- if (!empty($this->title)) {
+ if (! empty($this->title)) {
$this->_out('/Title ' . $this->_textstring($this->title));
}
- if (!empty($this->subject)) {
+ if (! empty($this->subject)) {
$this->_out('/Subject ' . $this->_textstring($this->subject));
}
- if (!empty($this->author)) {
+ if (! empty($this->author)) {
$this->_out('/Author ' . $this->_textstring($this->author));
}
- if (!empty($this->keywords)) {
+ if (! empty($this->keywords)) {
$this->_out('/Keywords ' . $this->_textstring($this->keywords));
}
- if (!empty($this->creator)) {
+ if (! empty($this->creator)) {
$this->_out('/Creator ' . $this->_textstring($this->creator));
}
}
+
return parent::_putinfo();
}
protected function _textstring($s, $n = 0)
{
$s = static::_testReplace($s);
+
return parent::_textstring($s, $n);
}
/**
* Static function to replace the TCPDF version in the unit-testing.
*
- * @param $s
* @return string|string[]|null
*/
protected static function _testReplace($s)
@@ -152,11 +150,11 @@ protected static function _testReplace($s)
if (static::isTesting()) {
$s = preg_replace("/TCPDF \d+\.\d+\.\d+ /", 'TCPDF x.x.x ', $s);
}
+
return $s;
}
/**
- * @param $s
* @return void
*/
public function _out($s)
@@ -169,16 +167,16 @@ public function _out($s)
protected static function isTesting(): bool
{
- return (getenv('APP_ENV') === 'testing');
+ return getenv('APP_ENV') === 'testing';
}
/**
- * @param string $headerSource
* @return $this
*/
public function setHeaderSource(string $headerSource): self
{
$this->headerSource = $headerSource;
+
return $this;
}
}
diff --git a/examples/Tcpdf/PdfFactory.php b/examples/Tcpdf/PdfFactory.php
index 5cb3ee5..66a2caa 100644
--- a/examples/Tcpdf/PdfFactory.php
+++ b/examples/Tcpdf/PdfFactory.php
@@ -15,10 +15,8 @@ class PdfFactory
/**
* Creates a new PDF Object and Initializes it
*
- * @param string $type
* @param bool $header Show the header
* @param bool $footer Show the footer
- * @return MyPdf
*/
public static function newPdf(string $type, bool $header = true, bool $footer = true): MyPdf
{
@@ -43,9 +41,6 @@ public static function newPdf(string $type, bool $header = true, bool $footer =
* Initializes the pdf object.
* Set the margins, adds a page, adds default fonts etc...
*
- * @param Pdf $pdf
- * @param bool $header
- * @param bool $footer
* @return Pdf $pdf
*/
public static function initPdf(Pdf $pdf, bool $header = true, bool $footer = true): Pdf
diff --git a/examples/Tcpdf/PdfSettings.php b/examples/Tcpdf/PdfSettings.php
index 42f07c9..265b655 100644
--- a/examples/Tcpdf/PdfSettings.php
+++ b/examples/Tcpdf/PdfSettings.php
@@ -7,7 +7,7 @@
use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Table;
-if (!defined('__DIR__')) {
+if (! defined('__DIR__')) {
define('__DIR__', __DIR__ . '/../../..');
}
@@ -20,10 +20,9 @@ class PdfSettings
[86, 155, 225],
[207, 247, 239],
[246, 211, 207],
- [216, 243, 228]
+ [216, 243, 228],
];
-
//top, right, bottom, left
public static $paddings = [
[0, 0, 0, 0],
@@ -43,28 +42,26 @@ class PdfSettings
[5, 5, 5, 0],
[0, 5, 5, 5],
[5, 0, 5, 5],
- [5, 5, 0, 5]
+ [5, 5, 0, 5],
];
-
public static $alignments = ['TL', 'TC', 'TR', 'ML', 'MC', 'MR', 'BL', 'BC', 'BR'];
-
- public static $textShort = "Hello world!";
- public static $text = "Lorem ipsum dolor sit amet...";
+ public static $textShort = 'Hello world!';
+ public static $text = 'Lorem ipsum dolor sit amet...';
public static $text2 = "
Simple text\nBold text
";
- public static $textLong = "
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
";
- public static $textExtraLong = "
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur
";
+ public static $textLong = '
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
';
+ public static $textExtraLong = '
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur
';
public static $textSubSuperscript = "Subscript or Superscript";
public static $columns = 5;
//prepare some default row settings
- public static array $imageCell = array(
+ public static array $imageCell = [
'TYPE' => 'IMAGE',
'FILE' => CONTENT_PATH . '/images/dice.jpg',
- 'WIDTH' => 10
- );
+ 'WIDTH' => 10,
+ ];
public static function headerRow(): array
{
@@ -72,6 +69,7 @@ public static function headerRow(): array
for ($i = 0; $i < static::$columns; $i++) {
$headerRow[$i]['TEXT'] = "Header #$i";
}
+
return $headerRow;
}
@@ -79,12 +77,12 @@ public static function dataRow(): array
{
$dataRow = [];
for ($i = 0; $i < static::$columns; $i++) {
- $dataRow[$i]['TEXT'] = "Cool cell";
+ $dataRow[$i]['TEXT'] = 'Cool cell';
}
+
return $dataRow;
}
-
/**
* Set the styles for the advanced multicell
*
@@ -115,11 +113,8 @@ public static function setMulticellStyles(Multicell $multicell)
$multicell->setStyle('u8b', null, 'B', null, null, 'u8');
}
-
/**
* Set the styles for the advanced table
- *
- * @param Table $table
*/
public static function setTableStyles(Table $table)
{
diff --git a/examples/Tcpdf/example-multicell-1-overview.php b/examples/Tcpdf/example-multicell-1-overview.php
index 624e86d..8ce9c94 100644
--- a/examples/Tcpdf/example-multicell-1-overview.php
+++ b/examples/Tcpdf/example-multicell-1-overview.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Tcpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Tcpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('multicell');
diff --git a/examples/Tcpdf/example-multicell-2-overview-page-break.php b/examples/Tcpdf/example-multicell-2-overview-page-break.php
index f811f52..aea3052 100644
--- a/examples/Tcpdf/example-multicell-2-overview-page-break.php
+++ b/examples/Tcpdf/example-multicell-2-overview-page-break.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Tcpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Tcpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('multicell');
@@ -27,7 +26,6 @@
$pdf->Ln(10); //line break
-
//read TAG formatted text from file
$txt = file_get_contents(CONTENT_PATH . '/multicell.txt');
$s = $txt . "\n\n\n\nRepeat the text to trigger a page break \n\n\n" . $txt;
diff --git a/examples/Tcpdf/example-multicell-3-line-breaking.php b/examples/Tcpdf/example-multicell-3-line-breaking.php
index 1996ddb..0051e3c 100644
--- a/examples/Tcpdf/example-multicell-3-line-breaking.php
+++ b/examples/Tcpdf/example-multicell-3-line-breaking.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Tcpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Tcpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('multicell');
@@ -26,20 +25,17 @@
$multicell->multiCell(100, 5, $txt, 1, 'R', 0, 0, 1);
$pdf->Ln(10); //new line
-
//create an advanced multicell
$multicell->multiCell(0, 5, 'Setting > as line breaking character');
$multicell->setLineBreakingCharacters('>');
$multicell->multiCell(100, 5, $txt, 1);
$pdf->Ln(10); //new line
-
//create an advanced multicell
$multicell->multiCell(0, 5, 'Reseting the line breaking characters');
$multicell->resetLineBreakingCharacters();
$multicell->multiCell(100, 5, $txt, 1);
$pdf->Ln(10); //new line
-
//send the pdf to the browser
$pdf->Output();
diff --git a/examples/Tcpdf/example-multicell-4-page-break.php b/examples/Tcpdf/example-multicell-4-page-break.php
index 5fda260..25ff28a 100644
--- a/examples/Tcpdf/example-multicell-4-page-break.php
+++ b/examples/Tcpdf/example-multicell-4-page-break.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Tcpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Tcpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('multicell');
diff --git a/examples/Tcpdf/example-multicell-5-max-lines.php b/examples/Tcpdf/example-multicell-5-max-lines.php
index 5288c89..5281be7 100644
--- a/examples/Tcpdf/example-multicell-5-max-lines.php
+++ b/examples/Tcpdf/example-multicell-5-max-lines.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Tcpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Tcpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('multicell');
diff --git a/examples/Tcpdf/example-multicell-6-shrinking.php b/examples/Tcpdf/example-multicell-6-shrinking.php
index faf6542..49c8d4e 100644
--- a/examples/Tcpdf/example-multicell-6-shrinking.php
+++ b/examples/Tcpdf/example-multicell-6-shrinking.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Tcpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Tcpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('multicell');
@@ -20,10 +19,10 @@
PdfSettings::setMulticellStyles($multicell);
$pdf->Ln(5); //line break
-$multicell->multiCell(120, 5, "
Multicell text shrinking feature
");
+$multicell->multiCell(120, 5, '
Multicell text shrinking feature
');
$pdf->Ln(10); //line break
-$txt = <<TCPDF addon allows creation of an Advanced Multicell which uses as input a TAG based formatted string instead of a simple string. The use of tags allows to change the font, the style (bold, italic, underline), the size, and the color of characters and many other features.
@@ -93,9 +92,9 @@
$pdf->ln(10);
-$multicell->multiCell(0, 10, "Table of Content:");
+$multicell->multiCell(0, 10, 'Table of Content:');
-$s = <<
- Paragraph 1
- Paragraph 2
- Paragraph 2.1
@@ -105,9 +104,9 @@
$multicell->multiCell(0, 5, $s);
$pdf->ln(10);
-$multicell->multiCell(0, 10, "Tag width and alignment:");
+$multicell->multiCell(0, 10, 'Tag width and alignment:');
-$s = << Align Left
Align Center
Align Right
@@ -115,7 +114,7 @@
$multicell->multiCell(100, 5, $s, 1, '', 1);
$pdf->AddPage();
-$multicell->multiCell(0, 10, "No wrap: text will not break on normal separators");
+$multicell->multiCell(0, 10, 'No wrap: text will not break on normal separators');
$s = "The price is USD 5.344,23";
foreach ([40, 45, 50] as $width) {
diff --git a/examples/Tcpdf/example-table-1-overview.php b/examples/Tcpdf/example-table-1-overview.php
index 79ba991..10f13ce 100644
--- a/examples/Tcpdf/example-table-1-overview.php
+++ b/examples/Tcpdf/example-table-1-overview.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Table - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Tcpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Tcpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('table');
@@ -21,28 +20,27 @@
//simple table
$multicell->multiCell(0, 5, "
~~~Simple table:
");
-require(__DIR__ . '/table/code-example1.php');
+require __DIR__ . '/table/code-example1.php';
//cells can be multicells and images
$pdf->Ln(10);
$multicell->multiCell(0, 5, "
";
//add the data row
diff --git a/examples/Tcpdf/table/code-example2.php b/examples/Tcpdf/table/code-example2.php
index c18d9b1..32391ce 100644
--- a/examples/Tcpdf/table/code-example2.php
+++ b/examples/Tcpdf/table/code-example2.php
@@ -4,7 +4,7 @@
use EvoSys21\PdfLib\Examples\Tcpdf\PdfSettings;
use EvoSys21\PdfLib\Table;
-if (!isset($pdf)) {
+if (! isset($pdf)) {
$pdf = new MyPdf();
}
@@ -19,13 +19,12 @@
/**
* Set the tag styles
*/
-
$table->initialize([20, 30, 80]);
$header = [
['TEXT' => 'Header #1'],
['TEXT' => 'Header #2'],
- ['TEXT' => 'Header #3']
+ ['TEXT' => 'Header #3'],
];
//add the header row
@@ -35,7 +34,7 @@
//row 1 - add data as Array
$row = [];
-$row[0]['TEXT'] = "Line 1";
+$row[0]['TEXT'] = 'Line 1';
$row[1] = PdfSettings::$imageCell;
@@ -50,10 +49,10 @@
//alternatively you can create directly the cell object
$row[0] = new Table\Cell\Image($pdf, CONTENT_PATH . '/images/blog.jpg', 10);
-$row[1] = array(
+$row[1] = [
'TEXT' => "
SVG Images are supported\n(see right image >>>)
",
- 'BACKGROUND_COLOR' => PdfSettings::$colors[0]
-);
+ 'BACKGROUND_COLOR' => PdfSettings::$colors[0],
+];
$row[2] = new Table\Cell\ImageSVG($pdf, CONTENT_PATH . '/images/Tiger.svg', 35, 35);
diff --git a/examples/Tcpdf/table/code-example3.php b/examples/Tcpdf/table/code-example3.php
index b4fa0b6..513c004 100644
--- a/examples/Tcpdf/table/code-example3.php
+++ b/examples/Tcpdf/table/code-example3.php
@@ -4,7 +4,7 @@
use EvoSys21\PdfLib\Examples\Tcpdf\PdfSettings;
use EvoSys21\PdfLib\Table;
-if (!isset($pdf)) {
+if (! isset($pdf)) {
$pdf = new MyPdf();
}
@@ -21,7 +21,6 @@
/**
* Set the tag styles
*/
-
$table->initialize([20, 30, 40, 50]);
$header1 = PdfSettings::headerRow();
@@ -31,7 +30,7 @@
$header2 = PdfSettings::headerRow();
$header3 = PdfSettings::headerRow();
-$header2[1]['TEXT'] = "Colspan/Rowspan in Header";
+$header2[1]['TEXT'] = 'Colspan/Rowspan in Header';
$header2[1]['COLSPAN'] = 2;
$header2[1]['ROWSPAN'] = 2;
@@ -39,7 +38,6 @@
$table->addHeader($header2);
$table->addHeader($header3);
-
for ($i = 0; $i < 8; $i++) {
$row = PdfSettings::dataRow();
@@ -68,7 +66,6 @@
$row[1]['ROWSPAN'] = 2;
}
-
$table->addRow($row);
}
diff --git a/examples/Tcpdf/table_example1.php b/examples/Tcpdf/table_example1.php
index 4ab6ea3..64b9cd8 100644
--- a/examples/Tcpdf/table_example1.php
+++ b/examples/Tcpdf/table_example1.php
@@ -9,7 +9,7 @@
//Table Header
for ($i = 0; $i < $columns; $i++) {
- $header[$i]['TEXT'] = "Header #" . ($i + 1);
+ $header[$i]['TEXT'] = 'Header #' . ($i + 1);
}
//add the header
@@ -24,7 +24,6 @@
$row[2]['TEXT'] = "Line $j Text 3"; //text for column 2
$row[2]['TEXT_ALIGN'] = 'R'; //text align
-
//add the row
$table->addRow($row);
//break;
diff --git a/examples/Tcpdf/table_example2.php b/examples/Tcpdf/table_example2.php
index 78fbae4..db84276 100644
--- a/examples/Tcpdf/table_example2.php
+++ b/examples/Tcpdf/table_example2.php
@@ -9,7 +9,7 @@
//Table Header
for ($i = 0; $i < $columns; $i++) {
- $header[$i]['TEXT'] = "Header #" . ($i + 1);
+ $header[$i]['TEXT'] = 'Header #' . ($i + 1);
}
$table->addHeader($header);
@@ -56,21 +56,21 @@
}
if ($j == 7) {
- $row[1]['TEXT'] = "Top Left Align";
+ $row[1]['TEXT'] = 'Top Left Align';
$row[1]['VERTICAL_ALIGN'] = 'T';
$row[1]['TEXT_ALIGN'] = 'L';
- $row[2]['TEXT'] = "Bottom Right Align";
+ $row[2]['TEXT'] = 'Bottom Right Align';
$row[2]['VERTICAL_ALIGN'] = 'B';
$row[2]['TEXT_ALIGN'] = 'R';
}
if ($j == 8) {
- $row[1]['TEXT'] = "Top Center Align";
+ $row[1]['TEXT'] = 'Top Center Align';
$row[1]['VERTICAL_ALIGN'] = 'T';
$row[1]['TEXT_ALIGN'] = 'C';
- $row[2]['TEXT'] = "Bottom Center Align";
+ $row[2]['TEXT'] = 'Bottom Center Align';
$row[2]['VERTICAL_ALIGN'] = 'B';
$row[2]['TEXT_ALIGN'] = 'C';
}
@@ -94,7 +94,7 @@
}
if ($j == 14) {
- $row[1]['TEXT'] = "Cell Properties Overwriting Example";
+ $row[1]['TEXT'] = 'Cell Properties Overwriting Example';
$row[1]['TEXT_FONT'] = 'Times';
$row[1]['TEXT_SIZE'] = 7;
$row[1]['TEXT_TYPE'] = 'B';
diff --git a/examples/Tfpdf/MyPdf.php b/examples/Tfpdf/MyPdf.php
index 0355cc1..b9aae3b 100644
--- a/examples/Tfpdf/MyPdf.php
+++ b/examples/Tfpdf/MyPdf.php
@@ -4,11 +4,12 @@
namespace EvoSys21\PdfLib\Examples\Tfpdf;
-use EvoSys21\PdfLib\Tfpdf\Pdf;
use EvoSys21\PdfLib\Multicell;
+use EvoSys21\PdfLib\Tfpdf\Pdf;
/**
* Custom PDF class extension for Header and Footer Definitions
+ *
* @SuppressWarnings(PHPMD.CamelCaseMethodName)
* @SuppressWarnings(PHPMD.Superglobals)
* phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
@@ -20,12 +21,14 @@ class MyPdf extends Pdf
/**
* Custom Header
+ *
* @SuppressWarnings(PHPMD.CamelCaseMethodName)
+ *
* @see Pdf::Header()
*/
public function Header()
{
- if (!$this->showHeader) {
+ if (! $this->showHeader) {
return;
}
@@ -57,7 +60,6 @@ public function Header()
$this->SetY($this->tMargin);
}
-
/**
* Custom Footer
*
@@ -67,7 +69,7 @@ public function Footer()
{
$this->drawMargins && $this->drawMarginLines();
- if (!$this->showFooter) {
+ if (! $this->showFooter) {
return;
}
@@ -79,8 +81,6 @@ public function Footer()
/**
* Returns the default Font to be used
- *
- * @return string
*/
public function getDefaultFont(): string
{
@@ -105,7 +105,6 @@ public function drawMarginLines(): void
$this->Line($this->w - $this->rMargin, 0, $this->w - $this->rMargin, $this->h);
}
-
/**
* Disable the Producer and CreationDate. It breaks the functional unit-testing(date always changes)
* phpcs:disable PSR2.Methods.MethodDeclaration.Underscore
@@ -125,16 +124,16 @@ public function _putinfo()
protected static function isTesting(): bool
{
- return (getenv('APP_ENV') === 'testing');
+ return getenv('APP_ENV') === 'testing';
}
/**
- * @param string $headerSource
* @return $this
*/
public function setHeaderSource(string $headerSource): self
{
$this->headerSource = $headerSource;
+
return $this;
}
}
diff --git a/examples/Tfpdf/PdfFactory.php b/examples/Tfpdf/PdfFactory.php
index f57e7fa..5edc182 100644
--- a/examples/Tfpdf/PdfFactory.php
+++ b/examples/Tfpdf/PdfFactory.php
@@ -15,10 +15,8 @@ class PdfFactory
/**
* Creates a new PDF Object and Initializes it
*
- * @param string $type
* @param bool $header Show the header
* @param bool $footer Show the footer
- * @return MyPdf
*/
public static function newPdf(string $type, bool $header = true, bool $footer = true): MyPdf
{
@@ -43,9 +41,6 @@ public static function newPdf(string $type, bool $header = true, bool $footer =
* Initializes the pdf object.
* Set the margins, adds a page, adds default fonts etc...
*
- * @param Pdf $pdf
- * @param bool $header
- * @param bool $footer
* @return Pdf $pdf
*/
public static function initPdf(Pdf $pdf, bool $header = true, bool $footer = true): Pdf
diff --git a/examples/Tfpdf/PdfSettings.php b/examples/Tfpdf/PdfSettings.php
index e14fa3c..017a0e7 100644
--- a/examples/Tfpdf/PdfSettings.php
+++ b/examples/Tfpdf/PdfSettings.php
@@ -7,7 +7,7 @@
use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Table;
-if (!defined('__DIR__')) {
+if (! defined('__DIR__')) {
define('__DIR__', __DIR__ . '/../../..');
}
@@ -20,10 +20,9 @@ class PdfSettings
[86, 155, 225],
[207, 247, 239],
[246, 211, 207],
- [216, 243, 228]
+ [216, 243, 228],
];
-
//top, right, bottom, left
public static $paddings = [
[0, 0, 0, 0],
@@ -43,28 +42,26 @@ class PdfSettings
[5, 5, 5, 0],
[0, 5, 5, 5],
[5, 0, 5, 5],
- [5, 5, 0, 5]
+ [5, 5, 0, 5],
];
-
public static $alignments = ['TL', 'TC', 'TR', 'ML', 'MC', 'MR', 'BL', 'BC', 'BR'];
-
- public static $textShort = "Hello world!";
- public static $text = "Lorem ipsum dolor sit amet...";
+ public static $textShort = 'Hello world!';
+ public static $text = 'Lorem ipsum dolor sit amet...';
public static $text2 = "
Simple text\nBold text
";
- public static $textLong = "
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
";
- public static $textExtraLong = "
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur
";
+ public static $textLong = '
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
';
+ public static $textExtraLong = '
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur
';
public static $textSubSuperscript = "Subscript or Superscript";
public static $columns = 5;
//prepare some default row settings
- public static array $imageCell = array(
+ public static array $imageCell = [
'TYPE' => 'IMAGE',
'FILE' => CONTENT_PATH . '/images/dice.jpg',
- 'WIDTH' => 10
- );
+ 'WIDTH' => 10,
+ ];
public static function headerRow(): array
{
@@ -72,6 +69,7 @@ public static function headerRow(): array
for ($i = 0; $i < static::$columns; $i++) {
$headerRow[$i]['TEXT'] = "Header #$i";
}
+
return $headerRow;
}
@@ -79,12 +77,12 @@ public static function dataRow(): array
{
$dataRow = [];
for ($i = 0; $i < static::$columns; $i++) {
- $dataRow[$i]['TEXT'] = "Cool cell";
+ $dataRow[$i]['TEXT'] = 'Cool cell';
}
+
return $dataRow;
}
-
/**
* Set the styles for the advanced multicell
*
@@ -115,11 +113,8 @@ public static function setMulticellStyles(Multicell $multicell)
$multicell->setStyle('u8b', null, 'B', null, null, 'u8');
}
-
/**
* Set the styles for the advanced table
- *
- * @param Table $table
*/
public static function setTableStyles(Table $table)
{
diff --git a/examples/Tfpdf/example-multicell-1-overview.php b/examples/Tfpdf/example-multicell-1-overview.php
index 0f76200..e232c60 100644
--- a/examples/Tfpdf/example-multicell-1-overview.php
+++ b/examples/Tfpdf/example-multicell-1-overview.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Tfpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Tfpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('multicell');
diff --git a/examples/Tfpdf/example-multicell-2-overview-page-break.php b/examples/Tfpdf/example-multicell-2-overview-page-break.php
index 1c58c1a..bef3188 100644
--- a/examples/Tfpdf/example-multicell-2-overview-page-break.php
+++ b/examples/Tfpdf/example-multicell-2-overview-page-break.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Tfpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Tfpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('multicell');
@@ -27,7 +26,6 @@
$pdf->Ln(10); //line break
-
//read TAG formatted text from file
$txt = file_get_contents(CONTENT_PATH . '/multicell.txt');
$s = $txt . "\n\n\n\nRepeat the text to trigger a page break \n\n\n" . $txt;
diff --git a/examples/Tfpdf/example-multicell-3-line-breaking.php b/examples/Tfpdf/example-multicell-3-line-breaking.php
index 8bffa60..1789812 100644
--- a/examples/Tfpdf/example-multicell-3-line-breaking.php
+++ b/examples/Tfpdf/example-multicell-3-line-breaking.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Tfpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Tfpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('multicell');
@@ -26,20 +25,17 @@
$multicell->multiCell(100, 5, $txt, 1, 'R', 0, 0, 1);
$pdf->Ln(10); //new line
-
//create an advanced multicell
$multicell->multiCell(0, 5, 'Setting > as line breaking character');
$multicell->setLineBreakingCharacters('>');
$multicell->multiCell(100, 5, $txt, 1);
$pdf->Ln(10); //new line
-
//create an advanced multicell
$multicell->multiCell(0, 5, 'Reseting the line breaking characters');
$multicell->resetLineBreakingCharacters();
$multicell->multiCell(100, 5, $txt, 1);
$pdf->Ln(10); //new line
-
//send the pdf to the browser
$pdf->Output();
diff --git a/examples/Tfpdf/example-multicell-4-page-break.php b/examples/Tfpdf/example-multicell-4-page-break.php
index e59a384..653cfcd 100644
--- a/examples/Tfpdf/example-multicell-4-page-break.php
+++ b/examples/Tfpdf/example-multicell-4-page-break.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Tfpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Tfpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('multicell');
diff --git a/examples/Tfpdf/example-multicell-5-max-lines.php b/examples/Tfpdf/example-multicell-5-max-lines.php
index 6029ec4..2781376 100644
--- a/examples/Tfpdf/example-multicell-5-max-lines.php
+++ b/examples/Tfpdf/example-multicell-5-max-lines.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Tfpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Tfpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('multicell');
diff --git a/examples/Tfpdf/example-multicell-6-shrinking.php b/examples/Tfpdf/example-multicell-6-shrinking.php
index 7f2b66c..22a0480 100644
--- a/examples/Tfpdf/example-multicell-6-shrinking.php
+++ b/examples/Tfpdf/example-multicell-6-shrinking.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Multicell - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Tfpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Tfpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('multicell');
@@ -20,10 +19,10 @@
PdfSettings::setMulticellStyles($multicell);
$pdf->Ln(5); //line break
-$multicell->multiCell(120, 5, "
Multicell text shrinking feature
");
+$multicell->multiCell(120, 5, '
Multicell text shrinking feature
');
$pdf->Ln(10); //line break
-$txt = <<TCPDF addon allows creation of an Advanced Multicell which uses as input a TAG based formatted string instead of a simple string. The use of tags allows to change the font, the style (bold, italic, underline), the size, and the color of characters and many other features.
@@ -93,9 +92,9 @@
$pdf->ln(10);
-$multicell->multiCell(0, 10, "Table of Content:");
+$multicell->multiCell(0, 10, 'Table of Content:');
-$s = <<
- Paragraph 1
- Paragraph 2
- Paragraph 2.1
@@ -105,9 +104,9 @@
$multicell->multiCell(0, 5, $s);
$pdf->ln(10);
-$multicell->multiCell(0, 10, "Tag width and alignment:");
+$multicell->multiCell(0, 10, 'Tag width and alignment:');
-$s = << Align Left
Align Center
Align Right
@@ -115,7 +114,7 @@
$multicell->multiCell(100, 5, $s, 1, '', 1);
$pdf->AddPage();
-$multicell->multiCell(0, 10, "No wrap: text will not break on normal separators");
+$multicell->multiCell(0, 10, 'No wrap: text will not break on normal separators');
$s = "The price is USD 5.344,23";
foreach ([40, 45, 50] as $width) {
diff --git a/examples/Tfpdf/example-table-1-overview.php b/examples/Tfpdf/example-table-1-overview.php
index c4224b1..2ec8235 100644
--- a/examples/Tfpdf/example-table-1-overview.php
+++ b/examples/Tfpdf/example-table-1-overview.php
@@ -3,12 +3,11 @@
/**
* Pdf Advanced Table - Example
*/
-
require_once __DIR__ . '/autoload.php';
-use EvoSys21\PdfLib\Multicell;
use EvoSys21\PdfLib\Examples\Tfpdf\PdfFactory;
use EvoSys21\PdfLib\Examples\Tfpdf\PdfSettings;
+use EvoSys21\PdfLib\Multicell;
//get the PDF object
$pdf = PdfFactory::newPdf('table');
@@ -21,28 +20,27 @@
//simple table
$multicell->multiCell(0, 5, "
~~~Simple table:
");
-require(__DIR__ . '/table/code-example1.php');
+require __DIR__ . '/table/code-example1.php';
//cells can be multicells and images
$pdf->Ln(10);
$multicell->multiCell(0, 5, "