Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['8.1', '8.2', '8.3']
php-version: ['8.2', '8.3', '8.4']
dependencies: ['highest']
include:
- php-version: '8.4'
dependencies: 'highest'
composer-options: '--ignore-platform-req=php'
- php-version: '8.1'
dependencies: 'lowest'

Expand All @@ -37,12 +34,10 @@ jobs:
coverage: pcov

- name: Install packages
run: |
sudo apt install xfonts-base xfonts-75dpi
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
sudo dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb
sudo apt install -f
wkhtmltopdf --version
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: xfonts-base xfonts-75dpi wkhtmltopdf
version: ubuntu-24.04

- name: Composer install
uses: ramsey/composer-install@v3
Expand All @@ -56,14 +51,14 @@ jobs:
- name: Run PHPUnit
run: |
if [[ ${{ matrix.php-version }} == '8.3' ]]; then
vendor/bin/phpunit --display-warnings --display-deprecations --display-incomplete --display-skipped --coverage-clover=coverage.xml
vendor/bin/phpunit --display-warnings --display-deprecations --display-phpunit-deprecations --display-incomplete --display-skipped --coverage-clover=coverage.xml
else
vendor/bin/phpunit --display-warnings --display-deprecations
fi

- name: Code Coverage Report
if: matrix.php-version == '8.3'
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Plugin containing CakePdf lib which will use a PDF engine to convert HTML to PDF.

Engines included in the plugin:
* DomPdf (^2.0)
* DomPdf (^3.0)
* Mpdf (^8.0.4)
* Tcpdf (^6.3)
* WkHtmlToPdf **RECOMMENDED ENGINE**
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"cakephp/cakephp": "^5.0.1"
},
"require-dev": {
"phpunit/phpunit": "^10.3",
"dompdf/dompdf": "^2.0",
"phpunit/phpunit": "^10.5.5 || ^11.1.3",
"dompdf/dompdf": "^3.0",
"mpdf/mpdf": "^8.1.6",
"tecnickcom/tcpdf": "^6.3",
"cakephp/cakephp-codesniffer": "^5.0"
Expand Down
6 changes: 0 additions & 6 deletions config/routes.php

This file was deleted.

87 changes: 87 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="6.0.0@b8e96bb617bf59382113b1b56cef751f648a7dc9">
<file src="src/Pdf/CakePdf.php">
<InvalidDocblock>
<code><![CDATA[public function cache(bool|string|null $cache = null): static|string|false]]></code>
<code><![CDATA[public function delay(?int $delay = null): static|int|null]]></code>
<code><![CDATA[public function encoding(?string $encoding = null): static|string]]></code>
<code><![CDATA[public function footer(string|array|null $left = null, ?string $center = null, ?string $right = null): static|array]]></code>
<code><![CDATA[public function header(string|array|null $left = null, ?string $center = null, ?string $right = null): static|array]]></code>
<code><![CDATA[public function helpers(?array $helpers = null): static|array]]></code>
<code><![CDATA[public function html(?string $html = null): static|string]]></code>
<code><![CDATA[public function layoutPath(?string $layoutPath = null): static|string]]></code>
<code><![CDATA[public function margin(]]></code>
<code><![CDATA[public function marginBottom(string|int|null $margin = null): static|string|int|null]]></code>
<code><![CDATA[public function marginLeft(string|int|null $margin = null): static|string|int|null]]></code>
<code><![CDATA[public function marginRight(string|int|null $margin = null): static|string|int|null]]></code>
<code><![CDATA[public function marginTop(string|int|null $margin = null): static|string|int|null]]></code>
<code><![CDATA[public function orientation(?string $orientation = null): static|string]]></code>
<code><![CDATA[public function ownerPassword(?string $password = null): static|string|null]]></code>
<code><![CDATA[public function pageSize(?string $pageSize = null): static|string]]></code>
<code><![CDATA[public function permissions(bool|array|string|null $permissions = null): static|array|string|bool|null]]></code>
<code><![CDATA[public function protect(?bool $protect = null): static|bool]]></code>
<code><![CDATA[public function template(string|false|null $template = false, ?string $layout = null): static|array]]></code>
<code><![CDATA[public function templatePath(?string $templatePath = null): static|string]]></code>
<code><![CDATA[public function theme(?string $theme = null): static|string|null]]></code>
<code><![CDATA[public function title(?string $title = null): static|string|null]]></code>
<code><![CDATA[public function userPassword(?string $password = null): static|string|null]]></code>
<code><![CDATA[public function viewRender(?string $viewClass = null): static|string]]></code>
<code><![CDATA[public function viewVars(?array $viewVars = null): static|array]]></code>
<code><![CDATA[public function windowStatus(?string $status = null): static|string|null]]></code>
</InvalidDocblock>
<PossiblyInvalidArgument>
<code><![CDATA[$cache]]></code>
<code><![CDATA[$cache]]></code>
<code><![CDATA[$cache]]></code>
<code><![CDATA[$viewClass]]></code>
</PossiblyInvalidArgument>
<PossiblyInvalidPropertyAssignmentValue>
<code><![CDATA[$cache]]></code>
<code><![CDATA[$permissions]]></code>
</PossiblyInvalidPropertyAssignmentValue>
</file>
<file src="src/Pdf/Crypto/PdftkCrypto.php">
<PossiblyInvalidArgument>
<code><![CDATA[$ownerPassword]]></code>
<code><![CDATA[$userPassword]]></code>
</PossiblyInvalidArgument>
</file>
<file src="src/Pdf/Engine/DomPdfEngine.php">
<PossiblyInvalidArgument>
<code><![CDATA[$Pdf->html()]]></code>
<code><![CDATA[$this->_Pdf->orientation()]]></code>
<code><![CDATA[$this->_Pdf->pageSize()]]></code>
</PossiblyInvalidArgument>
</file>
<file src="src/Pdf/Engine/MpdfEngine.php">
<PossiblyInvalidArgument>
<code><![CDATA[$format]]></code>
<code><![CDATA[$this->_Pdf->html()]]></code>
</PossiblyInvalidArgument>
<PossiblyInvalidOperand>
<code><![CDATA[$format]]></code>
</PossiblyInvalidOperand>
</file>
<file src="src/Pdf/Engine/TcpdfEngine.php">
<PossiblyInvalidArgument>
<code><![CDATA[$this->_Pdf->html()]]></code>
<code><![CDATA[$this->_Pdf->orientation()]]></code>
</PossiblyInvalidArgument>
</file>
<file src="src/Pdf/Engine/TexToPdfEngine.php">
<PossiblyInvalidArgument>
<code><![CDATA[$output]]></code>
<code><![CDATA[$output]]></code>
<code><![CDATA[$this->_Pdf->encoding()]]></code>
</PossiblyInvalidArgument>
</file>
<file src="src/Pdf/Engine/WkHtmlToPdfEngine.php">
<PossibleRawObjectIteration>
<code><![CDATA[$margin]]></code>
</PossibleRawObjectIteration>
<PossiblyInvalidArgument>
<code><![CDATA[$this->_Pdf->html()]]></code>
<code><![CDATA[$value]]></code>
</PossiblyInvalidArgument>
</file>
</files>
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="false"
errorBaseline="psalm-baseline.xml"
>
<projectFiles>
<directory name="src" />
Expand Down
24 changes: 19 additions & 5 deletions src/CakePdfPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
class CakePdfPlugin extends BasePlugin
{
/**
* Do bootstrap or not
* Do bootstrapping or not
*
* @var bool
*/
protected bool $bootstrapEnabled = false;

/**
* Load routes or not
* Console middleware
*
* @var bool
*/
protected bool $routesEnabled = false;
protected bool $consoleEnabled = false;

/**
* Enable middleware
Expand All @@ -29,9 +29,23 @@ class CakePdfPlugin extends BasePlugin
protected bool $middlewareEnabled = false;

/**
* Console middleware
* Register container services
*
* @var bool
*/
protected bool $consoleEnabled = false;
protected bool $servicesEnabled = false;

/**
* Load routes or not
*
* @var bool
*/
protected bool $routesEnabled = false;

/**
* Load events or not
*
* @var bool
*/
protected bool $eventsEnabled = false;
}
Loading