spiritix/php-chrome-html2pdf

View on GitHub
src/Spiritix/Html2Pdf/Output/EmbedOutput.php

Summary

Maintainability
A
0 mins
Test Coverage
B
80%

The method embed has a boolean flag argument $exit, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function embed(string $fileName, bool $exit = true)

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

The method embed() contains an exit expression.
Open

            exit;

ExitExpression

Since: 0.2

An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

Example

class Foo {
    public function bar($param)  {
        if ($param === 42) {
            exit(23);
        }
    }
}

Source https://phpmd.org/rules/design.html#exitexpression

Expected 1 newline at end of file; 0 found
Open

}

There are no issues that match your filters.

Category
Status