The class Chromium has an overall complexity of 57 which is very high. The configured complexity threshold is 50. Open
class Chromium extends Base
{
/** {@inheritdoc} */
const DRIVER_NAME = 'LBL_CHROMIUM_PDF';
- Exclude checks
Chromium
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class Chromium extends Base
{
/** {@inheritdoc} */
const DRIVER_NAME = 'LBL_CHROMIUM_PDF';
File Chromium.php
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Chromium driver file for PDF generation.
*
* @see https://github.com/chrome-php/chrome
Function writeHTML
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function writeHTML()
{
if ($this->header) {
$this->pdfOptions['headerTemplate'] = $this->wrapHeaderContent($this->header);
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function isActive
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function isActive(): bool
{
$status = false;
if (\App\YetiForce\Register::isRegistered() && class_exists('HeadlessChromium\BrowserFactory') && \App\YetiForce\Shop::check('YetiForcePdfPremium')) {
try {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Class "Chromium" has 26 methods, which is greater than 20 authorized. Split it into smaller classes. Open
class Chromium extends Base
- Read upRead up
- Exclude checks
A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.
The class Chromium has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13. Open
class Chromium extends Base
{
/** {@inheritdoc} */
const DRIVER_NAME = 'LBL_CHROMIUM_PDF';
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Missing class import via use statement (line '116', column '25'). Open
$browserFactory = new \HeadlessChromium\BrowserFactory(\Config\Components\Pdf::$chromiumBinaryPath ?? '');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '136', column '28'). Open
$browserFactory = new \HeadlessChromium\BrowserFactory(\Config\Components\Pdf::$chromiumBinaryPath ?? '');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid assigning values to variables in if clauses and the like (line '349', column '148'). Open
public function loadWatermark()
{
$this->watermark = '';
if (self::WATERMARK_TYPE_IMAGE === $this->template->get('watermark_type') && '' !== trim($this->template->get('watermark_image'))) {
if ($this->template->get('watermark_image') && file_exists(ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . $this->template->get('watermark_image')) && ($base64 = \App\Fields\File::getImageBaseData(ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . $this->template->get('watermark_image')))) {
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\Fields\File' in method 'output'. Open
$tempFileName = \App\Fields\File::getTmpPath() . \App\Encryption::generatePassword(15) . '.html';
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method writeHTML uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// Modification of the following condition will violate the license!
if (!\App\YetiForce\Shop::check('YetiForceDisableBranding')) {
$this->pdfOptions['footerTemplate'] = '<div style="position: fixed; font-size:6px; margin-left: 20px; text-align: left; z-index: 9999999;color: black !important">Powered by YetiForce</div>';
$this->pdfOptions['marginBottom'] = 0.4;
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\YetiForce\Register' in method 'isActive'. Open
if (\App\YetiForce\Register::isRegistered() && class_exists('HeadlessChromium\BrowserFactory') && \App\YetiForce\Shop::check('YetiForcePdfPremium')) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Fields\File' in method 'loadWatermark'. Open
if ($this->template->get('watermark_image') && file_exists(ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . $this->template->get('watermark_image')) && ($base64 = \App\Fields\File::getImageBaseData(ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . $this->template->get('watermark_image')))) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Language' in method 'wrapContent'. Open
return '<!DOCTYPE html><html lang="' . ($this->template->get('language') ?: \App\Language::getShortLanguageName()) . '">
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\YetiForce\Shop' in method 'isActive'. Open
if (\App\YetiForce\Register::isRegistered() && class_exists('HeadlessChromium\BrowserFactory') && \App\YetiForce\Shop::check('YetiForcePdfPremium')) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\YetiForce\Shop' in method 'wrapFooterContent'. Open
if (!\App\YetiForce\Shop::check('YetiForceDisableBranding')) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Encryption' in method 'output'. Open
$tempFileName = \App\Fields\File::getTmpPath() . \App\Encryption::generatePassword(15) . '.html';
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'isActive'. Open
\App\Log::warning($th->__toString(), __CLASS__);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Fields\File' in method 'output'. Open
$basename = \App\Fields\File::sanitizeUploadFileName($fileName);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\YetiForce\Shop' in method 'writeHTML'. Open
if (!\App\YetiForce\Shop::check('YetiForceDisableBranding')) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method '__construct'. Open
$this->setInputCharset(\App\Config::main('default_charset', 'UTF-8'));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Define a constant instead of duplicating this literal "marginRight" 3 times. Open
$this->pdfOptions['marginRight'] = self::MM_TO_IN * $margin;
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "marginBottom" 4 times. Open
$this->pdfOptions['marginBottom'] = self::MM_TO_IN * $margin;
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "bottom" 3 times. Open
$this->setBottomMargin($this->defaultMargins['bottom']);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Rename "$pdf" which has the same name as the field declared at line 102. Open
$pdf = $page->pdf($this->getPdfOptions());
- Read upRead up
- Exclude checks
Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.
Noncompliant Code Example
class Foo { public $myField; public function doSomething() { $myField = 0; ... } }
See
- CERT, DCL51-J. - Do not shadow or obscure identifiers in subscopes
Define a constant instead of duplicating this literal "right" 3 times. Open
$this->setRightMargin($this->defaultMargins['right']);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "headerTemplate" 4 times. Open
'headerTemplate' => ' ',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "watermark_image" 4 times. Open
if (self::WATERMARK_TYPE_IMAGE === $this->template->get('watermark_type') && '' !== trim($this->template->get('watermark_image'))) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "marginLeft" 3 times. Open
$this->pdfOptions['marginLeft'] = self::MM_TO_IN * $margin;
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "footerTemplate" 4 times. Open
'footerTemplate' => ' ',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "" 4 times. Open
return $this->wrapContent('<div id="header" style="color-adjust: exact; -webkit-print-color-adjust: exact; print-color-adjust: exact; ' . $style . '">' . $content . '</div>');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Property \App\Pdf\Drivers\Chromium->pdf
has undeclared type \HeadlessChromium\Browser\ProcessAwareBrowser
Open
protected $pdf;
- Exclude checks
Call to method createBrowser
from undeclared class \HeadlessChromium\BrowserFactory
Open
$browser = $browserFactory->createBrowser(\Config\Components\Pdf::$chromiumBrowserOptions ?? []);
- Exclude checks
Call to method check
from undeclared class \App\YetiForce\Shop
Open
if (\App\YetiForce\Register::isRegistered() && class_exists('HeadlessChromium\BrowserFactory') && \App\YetiForce\Shop::check('YetiForcePdfPremium')) {
- Exclude checks
Call to method check
from undeclared class \App\YetiForce\Shop
Open
if (!\App\YetiForce\Shop::check('YetiForceDisableBranding')) {
- Exclude checks
Reference to static property chromiumBinaryPath
from undeclared class \Config\Components\Pdf
Open
$browserFactory = new \HeadlessChromium\BrowserFactory(\Config\Components\Pdf::$chromiumBinaryPath ?? '');
- Exclude checks
Reference to static property chromiumBrowserOptions
from undeclared class \Config\Components\Pdf
Open
$this->pdf = $browserFactory->createBrowser(\Config\Components\Pdf::$chromiumBrowserOptions ?? []);
- Exclude checks
Reference to static property chromiumBinaryPath
from undeclared class \Config\Components\Pdf
Open
if (!empty(\Config\Components\Pdf::$chromiumBinaryPath)) {
- Exclude checks
Assigning float
to property but \App\Pdf\Drivers\Chromium->footerMargin
is int
Open
$this->footerMargin = self::MM_TO_PX * $margin;
- Exclude checks
Assigning string
to property but \App\Pdf\Drivers\Chromium->fontSize
is int
Open
protected $fontSize = '16px';
- Exclude checks
Call to method generatePassword
from undeclared class \App\Encryption
(Did you mean class \Tests\App\Encryption) Open
$tempFileName = \App\Fields\File::getTmpPath() . \App\Encryption::generatePassword(15) . '.html';
- Exclude checks
Call to method __construct
from undeclared class \HeadlessChromium\BrowserFactory
Open
$browserFactory = new \HeadlessChromium\BrowserFactory(\Config\Components\Pdf::$chromiumBinaryPath ?? '');
- Exclude checks
Call to method __construct
from undeclared class \HeadlessChromium\BrowserFactory
Open
$browserFactory = new \HeadlessChromium\BrowserFactory(\Config\Components\Pdf::$chromiumBinaryPath ?? '');
- Exclude checks
Reference to constant LOAD
from undeclared class \HeadlessChromium\Page
(Did you mean class \App\Controller\View\Page) Open
$page->navigate('file://' . $tempFileName)->waitForNavigation(\HeadlessChromium\Page::LOAD, 60000);
- Exclude checks
Reference to static property chromiumBinaryPath
from undeclared class \Config\Components\Pdf
Open
$browserFactory = new \HeadlessChromium\BrowserFactory(\Config\Components\Pdf::$chromiumBinaryPath ?? '');
- Exclude checks
Call to method createBrowser
from undeclared class \HeadlessChromium\BrowserFactory
Open
$this->pdf = $browserFactory->createBrowser(\Config\Components\Pdf::$chromiumBrowserOptions ?? []);
- Exclude checks
Call to method warning
from undeclared class \App\Log
Open
\App\Log::warning($th->__toString(), __CLASS__);
- Exclude checks
Call to method isRegistered
from undeclared class \App\YetiForce\Register
Open
if (\App\YetiForce\Register::isRegistered() && class_exists('HeadlessChromium\BrowserFactory') && \App\YetiForce\Shop::check('YetiForcePdfPremium')) {
- Exclude checks
Checking instanceof against undeclared class \HeadlessChromium\Browser
Open
$status = $browser instanceof \HeadlessChromium\Browser;
- Exclude checks
Reference to static property chromiumBrowserOptions
from undeclared class \Config\Components\Pdf
Open
$browser = $browserFactory->createBrowser(\Config\Components\Pdf::$chromiumBrowserOptions ?? []);
- Exclude checks
Assigning float
to property but \App\Pdf\Drivers\Chromium->headerMargin
is int
Open
$this->headerMargin = self::MM_TO_PX * $margin;
- Exclude checks
Call to method check
from undeclared class \App\YetiForce\Shop
Open
if (!\App\YetiForce\Shop::check('YetiForceDisableBranding')) {
- Exclude checks
Call to method createPage
from undeclared class \HeadlessChromium\Browser\ProcessAwareBrowser
Open
$page = $this->pdf->createPage();
- Exclude checks
Identical blocks of code found in 2 locations. Consider refactoring. Open
public function setMargins(array $margins)
{
$this->setTopMargin($margins['top'] ?? $this->defaultMargins['top']);
$this->setBottomMargin($margins['bottom'] ?? $this->defaultMargins['bottom']);
$this->setLeftMargin($margins['left'] ?? $this->defaultMargins['left']);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 149.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Spaces must be used for alignment; tabs are not allowed Open
'A8' => [2.05, 2.91], // = ( 52 x 74 ) mm = ( 2.05 x 2.91 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'A9' => [1.46, 2.05], // = ( 37 x 52 ) mm = ( 1.46 x 2.05 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'4A0' => [66.22, 93.62], // = ( 1682 x 2378 ) mm = ( 66.22 x 93.62 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->setInputCharset(\App\Config::main('default_charset', 'UTF-8'));
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$status = false;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'A4' => [8.27, 11.69], // = ( 210 x 297 ) mm = ( 8.27 x 11.69 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'B1' => [27.83, 39.37], // = ( 707 x 1000 ) mm = ( 27.83 x 39.37 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'C3' => [12.76, 18.03], // = ( 324 x 458 ) mm = ( 12.76 x 18.03 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'SRA0' => [35.43, 50.39], // = ( 900 x 1280 ) mm = ( 35.43 x 50.39 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'EXECUTIVE' => [7.25, 10.50], // = ( 184 x 267 ) mm = ( 7.25 x 10.50 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @param float $margin
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
const MM_TO_IN = 0.0393701;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
const MM_TO_PX = 3.7795275591;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
// ISO 216 B Series + 2 SIS 014711 extensions
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
\App\Log::warning($th->__toString(), __CLASS__);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->pdfOptions['marginTop'] = self::MM_TO_IN * $margin;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->pdfOptions['marginBottom'] = self::MM_TO_IN * $margin;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'B2' => [19.69, 27.83], // = ( 500 x 707 ) mm = ( 19.69 x 27.83 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'B6' => [4.92, 6.93], // = ( 125 x 176 ) mm = ( 4.92 x 6.93 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'SRA2' => [17.72, 25.20], // = ( 450 x 640 ) mm = ( 17.72 x 25.20 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'printBackground' => true,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'footerTemplate' => ' ',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** @var float Millimeter to pixel converter */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'A2' => [16.54, 23.39], // = ( 420 x 594 ) mm = ( 16.54 x 23.39 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'B9' => [1.73, 2.44], // = ( 44 x 62 ) mm = ( 1.73 x 2.44 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
// ISO 216 C Series + 2 SIS 014711 extensions + 5 EXTENSION
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'C5' => [6.38, 9.02], // = ( 162 x 229 ) mm = ( 6.38 x 9.02 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'C8' => [2.24, 3.19], // = ( 57 x 81 ) mm = ( 2.24 x 3.19 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'RA1' => [24.02, 33.86], // = ( 610 x 860 ) mm = ( 24.02 x 33.86 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Constructor.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @author Mariusz Krzaczkowski <m.krzaczkowski@yetiforce.com>
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'A0' => [33.11, 46.81], // = ( 841 x 1189 ) mm = ( 33.11 x 46.81 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'C6' => [4.49, 6.38], // = ( 114 x 162 ) mm = ( 4.49 x 6.38 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'C9' => [1.57, 2.24], // = ( 40 x 57 ) mm = ( 1.57 x 2.24 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'C10' => [1.10, 1.57], // = ( 28 x 40 ) mm = ( 1.10 x 1.57 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'RA0' => [33.86, 48.03], // = ( 860 x 1220 ) mm = ( 33.86 x 48.03 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'2A0' => [46.81, 66.22], // = ( 1189 x 1682 ) mm = ( 46.81 x 66.22 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'A' => [4.37, 7.00], // = ( 111 x 178 ) mm = ( 4.37 x 7.00 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->pdf = $browserFactory->createBrowser(\Config\Components\Pdf::$chromiumBrowserOptions ?? []);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->pdfOptions = [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$browser = $browserFactory->createBrowser(\Config\Components\Pdf::$chromiumBrowserOptions ?? []);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function setAuthor(string $author)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function wrapFooterContent(string $content): string
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($this->pdfOptions['marginBottom'] < (float) 0.4) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'C7' => [3.19, 4.49], // = ( 81 x 114 ) mm = ( 3.19 x 4.49 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
// ISO Press
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'DEMY' => [8.50, 5.31], // = ( 135 x 216 ) mm = ( 8.50 x 5.31 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
protected $pdfHtml;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->setLeftMargin($this->defaultMargins['left']);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$status = $browser instanceof \HeadlessChromium\Browser;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->pdfOptions['marginLeft'] = self::MM_TO_IN * $margin;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function setRightMargin(float $margin)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->footer = trim($footerHtml);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this->wrapContent('<div id="header" style="color-adjust: exact; -webkit-print-color-adjust: exact; print-color-adjust: exact; ' . $style . '">' . $content . '</div>');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @param string $content
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$content .= '</div>';
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'A1' => [23.39, 33.11], // = ( 594 x 841 ) mm = ( 23.39 x 33.11 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'A3' => [11.69, 16.54], // = ( 297 x 420 ) mm = ( 11.69 x 16.54 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'B3' => [13.90, 19.69], // = ( 353 x 500 ) mm = ( 13.90 x 19.69 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'B7' => [3.46, 4.92], // = ( 88 x 125 ) mm = ( 3.46 x 4.92 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'C4' => [9.02, 12.76], // = ( 229 x 324 ) mm = ( 9.02 x 12.76 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
protected $font = '"Times New Roman", Times, serif';
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** @var \HeadlessChromium\Browser\ProcessAwareBrowser PDF generator instance. */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
} catch (\Throwable $th) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function setBottomMargin(float $margin)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->setTopMargin($margins['top'] ?? $this->defaultMargins['top']);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
// does not support this feature
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
const PAGE_FORMATS = [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'SRA1' => [25.20, 35.43], // = ( 640 x 900 ) mm = ( 25.20 x 35.43 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'SRA4' => [8.86, 12.60], // = ( 225 x 320 ) mm = ( 8.86 x 12.60 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'B' => [5.04, 7.80], // = ( 128 x 198 ) mm = ( 5.04 x 7.80 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public static function isActive(): bool
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->pdfOptions['marginRight'] = self::MM_TO_IN * $margin;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
// does not support this feature
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($this->header) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
// Modification of the following condition will violate the license!
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @param string $content
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'RA4' => [8.46, 12.01], // = ( 215 x 305 ) mm = ( 8.46 x 12.01 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** @var string Default font. */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function __construct()
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$browserFactory = new \HeadlessChromium\BrowserFactory(\Config\Components\Pdf::$chromiumBinaryPath ?? '');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (!empty(\Config\Components\Pdf::$chromiumBinaryPath)) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function setHeaderMargin(float $margin)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->footerMargin = self::MM_TO_PX * $margin;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function setMargins(array $margins)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->pdfOptions['paperWidth'] = self::PAGE_FORMATS[$format][0];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function wrapHeaderContent(string $content): string
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return str_replace(['{p}', '{a}'], ['<span class="pageNumber"></span>', '<span class="totalPages"></span>'], $content);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
const DRIVER_NAME = 'LBL_CHROMIUM_PDF';
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'B10' => [1.22, 1.73], // = ( 31 x 44 ) mm = ( 1.22 x 1.73 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'C1' => [25.51, 36.10], // = ( 648 x 917 ) mm = ( 25.51 x 36.10 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
// German DIN 476
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'LETTER' => [8.50, 11.00], // = ( 216 x 279 ) mm = ( 8.50 x 11.00 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'LEDGER' => [17.00, 11.00], // = ( 432 x 279 ) mm = ( 17.00 x 11.00 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** @var string Pdf HTML content. */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'headerTemplate' => ' ',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->setTopMargin($this->defaultMargins['top']);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function setLeftMargin(float $margin)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($orientation) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Write html.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (!\App\YetiForce\Shop::check('YetiForceDisableBranding')) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$content .= '<div style="position: fixed; font-size:6px; margin-left: 20px; text-align: left; z-index: 9999999;color: black !important">Powered by YetiForce</div>';
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'RA2' => [16.93, 24.02], // = ( 430 x 610 ) mm = ( 16.93 x 24.02 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
protected $fontSize = '16px';
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (\App\YetiForce\Register::isRegistered() && class_exists('HeadlessChromium\BrowserFactory') && \App\YetiForce\Shop::check('YetiForcePdfPremium')) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (!\App\YetiForce\Shop::check('YetiForceDisableBranding')) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->pdfOptions['marginBottom'] = 0.4;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (!empty($this->pdfOptions['headerTemplate']) || !empty($this->pdfOptions['footerTemplate'])) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$watermark = $this->watermark ? $this->wrapWatermark($this->template->parseVariables($this->watermark)) : '';
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (empty(trim($this->pdfOptions['headerTemplate']))) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'A10' => [1.02, 1.46], // = ( 26 x 37 ) mm = ( 1.02 x 1.46 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $status;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function setKeywords(array $keywords)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function setFooter(string $footerHtml)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @return $this
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function wrapWatermark(string $watermarkContent): string
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($this->template->get('watermark_image') && file_exists(ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . $this->template->get('watermark_image')) && ($base64 = \App\Fields\File::getImageBaseData(ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . $this->template->get('watermark_image')))) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
echo base64_decode($pdf->getBase64(60000));
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return '<!DOCTYPE html><html lang="' . ($this->template->get('language') ?: \App\Language::getShortLanguageName()) . '">
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** @var float Millimeter to inch converter */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
// ISO 216 A Series + 2 SIS 014711 extensions
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'A6' => [4.13, 5.83], // = ( 105 x 148 ) mm = ( 4.13 x 5.83 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'A7' => [2.91, 4.13], // = ( 74 x 105 ) mm = ( 2.91 x 4.13 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'B5' => [6.93, 9.84], // = ( 176 x 250 ) mm = ( 6.93 x 9.84 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'C2' => [18.03, 25.51], // = ( 458 x 648 ) mm = ( 18.03 x 25.51 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
// Traditional 'Loose' North American Paper Sizes
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'FOLIO' => [8.50, 13.00], // = ( 216 x 330 ) mm = ( 8.50 x 13.00 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** @var int Default font size (px). */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->setLeftMargin($margins['left'] ?? $this->defaultMargins['left']);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->pdfOptions['paperHeight'] = self::PAGE_FORMATS[$format][1];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->header = trim($headerHtml);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($this->footer) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->pdfOptions['displayHeaderFooter'] = true;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->watermark = '';
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
header("content-disposition: {$destination}; filename=\"{$basename}\"");
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function setPageSize(string $format, string $orientation = null)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
// does not support this feature
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Wrap header content.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$content = '<div id="footer" style="color-adjust: exact; -webkit-print-color-adjust: exact; print-color-adjust: exact; ' . $style . '">' . $content;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Wrap watermark.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$fileName = ($this->getFileName() ?: time()) . '.pdf';
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$page = $this->pdf->createPage();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'A5' => [5.83, 8.27], // = ( 148 x 210 ) mm = ( 5.83 x 8.27 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'RA3' => [12.01, 16.93], // = ( 305 x 430 ) mm = ( 12.01 x 16.93 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'LEGAL' => [8.50, 14.00], // = ( 216 x 356 ) mm = ( 8.50 x 14.00 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** @var array Pdf options. */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->setBottomMargin($this->defaultMargins['bottom']);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->setRightMargin($this->defaultMargins['right']);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->setFooterMargin($margins['footer'] ?? $this->defaultMargins['footer']);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->pdfOptions['landscape'] = 'L' === $orientation;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->writeHTML();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$tempFileName = \App\Fields\File::getTmpPath() . \App\Encryption::generatePassword(15) . '.html';
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'B0' => [39.37, 55.67], // = ( 1000 x 1414 ) mm = ( 39.37 x 55.67 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'B4' => [9.84, 13.90], // = ( 250 x 353 ) mm = ( 9.84 x 13.90 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'B8' => [2.44, 3.46], // = ( 62 x 88 ) mm = ( 2.44 x 3.46 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'C0' => [36.10, 51.06], // = ( 917 x 1297 ) mm = ( 36.10 x 51.06 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'SRA3' => [12.60, 17.72], // = ( 320 x 450 ) mm = ( 12.60 x 17.72 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'TABLOID' => [11.00, 17.00], // = ( 279 x 432 ) mm = ( 11.00 x 17.00 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'ROYAL' => [6.02, 9.21], // = ( 153 x 234 ) mm = ( 6.02 x 9.21 ) in
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
protected $pdf;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
protected $pdfOptions = [];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$browserFactory = new \HeadlessChromium\BrowserFactory(\Config\Components\Pdf::$chromiumBinaryPath ?? '');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function setTopMargin(float $margin)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Set left margin.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->headerMargin = self::MM_TO_PX * $margin;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function setTitle(string $title)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function setSubject(string $subject)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
// does not support this feature
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->pdfOptions['headerTemplate'] = $this->wrapHeaderContent($this->header);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->pdfOptions['footerTemplate'] = $this->wrapFooterContent($this->footer);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
// Modification of the following condition will violate the license!
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
// Modification of the following condition will violate the license!
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (self::WATERMARK_TYPE_IMAGE === $this->template->get('watermark_type') && '' !== trim($this->template->get('watermark_image'))) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->watermark = '<div id="watermark-text" style="position: relative; top: 50%; transform: rotate(-' . $this->template->get('watermark_angle') . 'deg);">' . $this->template->get('watermark_text') . '</div>';
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->setBottomMargin($margins['bottom'] ?? $this->defaultMargins['bottom']);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function setHeader(string $headerHtml)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$style = "padding-bottom: {$this->footerMargin}px; padding-left: {$this->pdfOptions['marginLeft']}mm; padding-right: {$this->pdfOptions['marginRight']}mm;";
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
file_put_contents($tempFileName, $this->getPdfHtml());
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$pdf->saveToFile($fileName);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Get PDF HTML.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
protected function getPdfHtml(): string
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this->pdfHtml;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($this->template->get('styles')) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function setCreator(string $creator)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function writeHTML()
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->pdfHtml = $this->wrapContent('<div id="body">' . $watermark . '<div id="content">' . $this->getBody() . '</div></div>');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function loadWatermark()
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
protected function getPdfOptions(): array
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function setFooterMargin(float $margin)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->setRightMargin($margins['right'] ?? $this->defaultMargins['right']);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->setHeaderMargin($margins['header'] ?? $this->defaultMargins['header']);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->pdfOptions['footerTemplate'] = '<div style="position: fixed; font-size:6px; margin-left: 20px; text-align: left; z-index: 9999999;color: black !important">Powered by YetiForce</div>';
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Wrap footer content.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->pdfOptions['marginBottom'] = 0.4;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return '<div id="watermark" style="position: fixed; z-index: -1; text-align:center; vertical-align: middle; width: 100%; height: 100%;">' . $watermarkContent . '</div>';
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
header('content-type: application/pdf; charset=utf-8');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$style .= PHP_EOL . str_replace(['<', '>'], '', $this->template->get('styles'));
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$content = str_replace(['{p}', '{a}'], ['<span class="pageNumber"></span>', '<span class="totalPages"></span>'], $content);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function output($fileName = '', $mode = 'D'): void
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$page->navigate('file://' . $tempFileName)->waitForNavigation(\HeadlessChromium\Page::LOAD, 60000);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Get PDF options.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this->pdfOptions;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->watermark = '<img id="watermark-image" src="' . $base64 . '" style="max-width: 100%; max-height: 100%;"/>';
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
// does not support this feature
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
// Modification of the following condition will violate the license!
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$style = ";padding-top: {$this->headerMargin}px; padding-left: {$this->pdfOptions['marginLeft']}mm; padding-right: {$this->pdfOptions['marginRight']}mm;";
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this->wrapContent($content);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Wrap body content.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ('I' !== $mode && 'D' !== $mode) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (empty($fileName)) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$destination = 'I' === $mode ? 'inline' : 'attachment';
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
} elseif (self::WATERMARK_TYPE_TEXT === $this->template->get('watermark_type') && '' !== trim($this->template->get('watermark_text'))) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
protected function wrapContent(string $content): string
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @param string $watermarkContent
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
unlink($tempFileName);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @param string $content
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$pdf = $page->pdf($this->getPdfOptions());
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
header('accept-charset: utf-8');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$basename = \App\Fields\File::sanitizeUploadFileName($fileName);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$style = 'body{' . ($this->font ? ('font-family: ' . $this->font . ';') : '') . ($this->fontSize ? ('font-size: ' . $this->fontSize . ';') : '') . ';}';
- Exclude checks
Line exceeds 120 characters; contains 158 characters Open
if (\App\YetiForce\Register::isRegistered() && class_exists('HeadlessChromium\BrowserFactory') && \App\YetiForce\Shop::check('YetiForcePdfPremium')) {
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
return str_replace(['{p}', '{a}'], ['<span class="pageNumber"></span>', '<span class="totalPages"></span>'], $content);
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
$this->pdfHtml = $this->wrapContent('<div id="body">' . $watermark . '<div id="content">' . $this->getBody() . '</div></div>');
- Exclude checks
Line exceeds 120 characters; contains 162 characters Open
$style = ";padding-top: {$this->headerMargin}px; padding-left: {$this->pdfOptions['marginLeft']}mm; padding-right: {$this->pdfOptions['marginRight']}mm;";
- Exclude checks
Line exceeds 120 characters; contains 183 characters Open
return $this->wrapContent('<div id="header" style="color-adjust: exact; -webkit-print-color-adjust: exact; print-color-adjust: exact; ' . $style . '">' . $content . '</div>');
- Exclude checks
Line exceeds 120 characters; contains 176 characters Open
$content .= '<div style="position: fixed; font-size:6px; margin-left: 20px; text-align: left; z-index: 9999999;color: black !important">Powered by YetiForce</div>';
- Exclude checks
Line exceeds 120 characters; contains 164 characters Open
$style = "padding-bottom: {$this->footerMargin}px; padding-left: {$this->pdfOptions['marginLeft']}mm; padding-right: {$this->pdfOptions['marginRight']}mm;";
- Exclude checks
Line exceeds 120 characters; contains 177 characters Open
return '<div id="watermark" style="position: fixed; z-index: -1; text-align:center; vertical-align: middle; width: 100%; height: 100%;">' . $watermarkContent . '</div>';
- Exclude checks
Line exceeds 120 characters; contains 206 characters Open
$this->pdfOptions['footerTemplate'] = '<div style="position: fixed; font-size:6px; margin-left: 20px; text-align: left; z-index: 9999999;color: black !important">Powered by YetiForce</div>';
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
return '<!DOCTYPE html><html lang="' . ($this->template->get('language') ?: \App\Language::getShortLanguageName()) . '">
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
$browserFactory = new \HeadlessChromium\BrowserFactory(\Config\Components\Pdf::$chromiumBinaryPath ?? '');
- Exclude checks
Line exceeds 120 characters; contains 156 characters Open
$content = '<div id="footer" style="color-adjust: exact; -webkit-print-color-adjust: exact; print-color-adjust: exact; ' . $style . '">' . $content;
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
$content = str_replace(['{p}', '{a}'], ['<span class="pageNumber"></span>', '<span class="totalPages"></span>'], $content);
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
$this->watermark = '<img id="watermark-image" src="' . $base64 . '" style="max-width: 100%; max-height: 100%;"/>';
- Exclude checks
Line exceeds 120 characters; contains 144 characters Open
} elseif (self::WATERMARK_TYPE_TEXT === $this->template->get('watermark_type') && '' !== trim($this->template->get('watermark_text'))) {
- Exclude checks
Line exceeds 120 characters; contains 221 characters Open
$this->watermark = '<div id="watermark-text" style="position: relative; top: 50%; transform: rotate(-' . $this->template->get('watermark_angle') . 'deg);">' . $this->template->get('watermark_text') . '</div>';
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
if (self::WATERMARK_TYPE_IMAGE === $this->template->get('watermark_type') && '' !== trim($this->template->get('watermark_image'))) {
- Exclude checks
Line exceeds 120 characters; contains 285 characters Open
if ($this->template->get('watermark_image') && file_exists(ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . $this->template->get('watermark_image')) && ($base64 = \App\Fields\File::getImageBaseData(ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . $this->template->get('watermark_image')))) {
- Exclude checks
Line exceeds 120 characters; contains 160 characters Open
$style = 'body{' . ($this->font ? ('font-family: ' . $this->font . ';') : '') . ($this->fontSize ? ('font-size: ' . $this->fontSize . ';') : '') . ';}';
- Exclude checks