diff --git a/composer.lock b/composer.lock index b53c4538..0f0e280f 100644 --- a/composer.lock +++ b/composer.lock @@ -1135,16 +1135,16 @@ }, { "name": "doctrine/orm", - "version": "3.3.1", + "version": "3.3.2", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "b1f8253105aa5382c495e5f9f8ef34e297775428" + "reference": "c9557c588b3a70ed93caff069d0aa75737f25609" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/b1f8253105aa5382c495e5f9f8ef34e297775428", - "reference": "b1f8253105aa5382c495e5f9f8ef34e297775428", + "url": "https://api.github.com/repos/doctrine/orm/zipball/c9557c588b3a70ed93caff069d0aa75737f25609", + "reference": "c9557c588b3a70ed93caff069d0aa75737f25609", "shasum": "" }, "require": { @@ -1219,9 +1219,9 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/3.3.1" + "source": "https://github.com/doctrine/orm/tree/3.3.2" }, - "time": "2024-12-19T07:08:14+00:00" + "time": "2025-02-04T19:43:15+00:00" }, { "name": "doctrine/persistence", @@ -1895,16 +1895,16 @@ }, { "name": "laurentmuller/fpdf2", - "version": "3.0.4", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/laurentmuller/fpdf2.git", - "reference": "5ac2b3928a8f0cde428c353b05c48787f3b3de16" + "reference": "0eb2a99a1b754a4887aa6a86546254a833a76297" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laurentmuller/fpdf2/zipball/5ac2b3928a8f0cde428c353b05c48787f3b3de16", - "reference": "5ac2b3928a8f0cde428c353b05c48787f3b3de16", + "url": "https://api.github.com/repos/laurentmuller/fpdf2/zipball/0eb2a99a1b754a4887aa6a86546254a833a76297", + "reference": "0eb2a99a1b754a4887aa6a86546254a833a76297", "shasum": "" }, "require": { @@ -1954,7 +1954,7 @@ "issues": "https://github.com/laurentmuller/fpdf2/issues", "source": "https://github.com/laurentmuller/fpdf2" }, - "time": "2025-02-04T18:47:37+00:00" + "time": "2025-02-06T10:43:43+00:00" }, { "name": "laurentmuller/highcharts-bundle", diff --git a/src/Report/ReportFooter.php b/src/Report/ReportFooter.php index a77cd520..d3d8e6d6 100644 --- a/src/Report/ReportFooter.php +++ b/src/Report/ReportFooter.php @@ -13,11 +13,11 @@ namespace App\Report; -use App\Pdf\PdfFont; use App\Pdf\PdfStyle; use App\Utils\FormatUtils; use fpdf\Enums\PdfTextAlignment; use fpdf\PdfBorder; +use fpdf\PdfDocument; /** * Class to output footer in PDF documents. @@ -71,35 +71,41 @@ public function setContent(string $content, ?string $url = null): self return $this; } - /** - * Gets the formatted current date. - */ - private function getDate(): string + private function outputContent(float $width): self { - return $this->date ??= FormatUtils::formatDateTime(new \DateTime()); + return $this->outputText($this->content, $width, PdfTextAlignment::CENTER, $this->url); } - /** - * Gets the formatted pages. - */ - private function getPages(): string + private function outputDate(float $width): void + { + $text = $this->date ??= FormatUtils::formatDateTime(new \DateTime()); + + $this->outputText($text, $width, PdfTextAlignment::RIGHT); + } + + private function outputPages(float $width): self { $parent = $this->parent; + $text = $parent->trans('report.page', [ + '{0}' => $parent->getPage(), + '{1}' => $parent->getAliasNumberPages(), + ]); - return $parent->trans('report.page', ['{0}' => $parent->getPage(), '{1}' => '{nb}']); + return $this->outputText($text, $width, PdfTextAlignment::LEFT); } /** * Output the given text. */ - private function outputText(string $text, float $width, PdfTextAlignment $align, ?string $link = null): self + private function outputText(?string $text, float $width, PdfTextAlignment $align, ?string $link = null): self { + $text ??= ''; $this->parent->cell( width: $width, text: $text, border: PdfBorder::top(), align: $align, - link: $link + link: '' !== $text ? $link : null ); return $this; @@ -110,10 +116,10 @@ private function outputTexts(): void $parent = $this->parent; $parent->setY(-self::FOOTER_OFFSET); $width = $parent->getPrintableWidth() / 3.0; - PdfStyle::default()->setFontSize(PdfFont::DEFAULT_SIZE - 1.0)->apply($parent); - $this->outputText($this->getPages(), $width, PdfTextAlignment::LEFT) - ->outputText($this->content ?? '', $width, PdfTextAlignment::CENTER, $this->url) - ->outputText($this->getDate(), $width, PdfTextAlignment::RIGHT); + PdfStyle::default()->setFontSize(PdfDocument::LINE_HEIGHT - 1.0)->apply($parent); + $this->outputPages($width) + ->outputContent($width) + ->outputDate($width); $parent->resetStyle(); } } diff --git a/src/Report/ReportHeader.php b/src/Report/ReportHeader.php index 6fd3ac3e..89730a98 100644 --- a/src/Report/ReportHeader.php +++ b/src/Report/ReportHeader.php @@ -180,6 +180,7 @@ private function outputDescription(): void if (null === $description) { return; } + $this->applySmallStyle(); $this->parent->multiCell( height: self::SMALL_HEIGHT, @@ -253,14 +254,15 @@ private function outputText( PdfMove $move = PdfMove::RIGHT, string|int|null $link = null ): void { + $text ??= ''; $this->parent->cell( width: $width, height: $height, - text: $text ?? '', + text: $text, border: $border, move: $move, align: $align, - link: $link + link: '' !== $text ? $link : null ); } diff --git a/vendor-bin/psalm/composer.lock b/vendor-bin/psalm/composer.lock index 06d365b5..3197cc73 100644 --- a/vendor-bin/psalm/composer.lock +++ b/vendor-bin/psalm/composer.lock @@ -4286,16 +4286,16 @@ }, { "name": "vimeo/psalm", - "version": "6.2.0", + "version": "6.4.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "814dfde37b43a1fe6d9b0996e08b19661af53bc5" + "reference": "04f312ac6ea48ba1c3e5db4d815bf6d74641c0ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/814dfde37b43a1fe6d9b0996e08b19661af53bc5", - "reference": "814dfde37b43a1fe6d9b0996e08b19661af53bc5", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/04f312ac6ea48ba1c3e5db4d815bf6d74641c0ee", + "reference": "04f312ac6ea48ba1c3e5db4d815bf6d74641c0ee", "shasum": "" }, "require": { @@ -4353,6 +4353,7 @@ "psalm-language-server", "psalm-plugin", "psalm-refactor", + "psalm-review", "psalter" ], "type": "project", @@ -4397,7 +4398,7 @@ "issues": "https://github.com/vimeo/psalm/issues", "source": "https://github.com/vimeo/psalm" }, - "time": "2025-02-01T16:30:21+00:00" + "time": "2025-02-05T12:31:01+00:00" }, { "name": "webmozart/assert",