The method measureOffset has a boolean flag argument $afterPageDividing, which is a certain sign of a Single Responsibility Principle violation. Open
public function measureOffset(bool $afterPageDividing = false)
- Read upRead up
- Exclude checks
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 measureWidth has a boolean flag argument $afterPageDividing, which is a certain sign of a Single Responsibility Principle violation. Open
public function measureWidth(bool $afterPageDividing = false)
- Read upRead up
- Exclude checks
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 measurePosition has a boolean flag argument $afterPageDividing, which is a certain sign of a Single Responsibility Principle violation. Open
public function measurePosition(bool $afterPageDividing = false)
- Read upRead up
- Exclude checks
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 measureHeight has a boolean flag argument $afterPageDividing, which is a certain sign of a Single Responsibility Principle violation. Open
public function measureHeight(bool $afterPageDividing = false)
- Read upRead up
- Exclude checks
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
Avoid using static access to class '\YetiForcePDF\Math' in method 'measureOffset'. Open
$left = Math::add($left, $previous->getOffset()->getLeft(), $previous->getDimensions()->getWidth(), $previous->getStyle()->getRules('margin-right'));
- 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 '\YetiForcePDF\Math' in method 'measurePosition'. Open
$this->getCoordinates()->setX(Math::add($parent->getCoordinates()->getX(), $this->getOffset()->getLeft()));
- 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 '\YetiForcePDF\Math' in method 'measurePosition'. Open
$this->getCoordinates()->setY(Math::add($parent->getCoordinates()->getY(), $this->getOffset()->getTop()));
- 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 '\YetiForcePDF\Math' in method 'measureWidth'. Open
$maxWidth = Math::max($maxWidth, $outerWidth);
- 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 '\YetiForcePDF\Math' in method 'measureHeight'. Open
$height = Math::add($height, $child->getDimensions()->getOuterHeight());
- 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 '\YetiForcePDF\Math' in method 'measureWidth'. Open
$maxWidth = Math::add($maxWidth, $style->getHorizontalBordersWidth(), $style->getHorizontalPaddingsWidth());
- 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 '\YetiForcePDF\Math' in method 'measureHeight'. Open
$height = Math::add($height, $style->getVerticalBordersWidth(), $style->getVerticalPaddingsWidth());
- 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 assigning values to variables in if clauses and the like (line '85', column '7'). Open
public function measureOffset(bool $afterPageDividing = false)
{
$rules = $this->getStyle()->getRules();
$parent = $this->getParent();
$top = $parent->getStyle()->getOffsetTop();
- 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
The method measureOffset uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$left = Math::add($left, $parent->getStyle()->getOffsetLeft());
}
- 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 '\YetiForcePDF\Math' in method 'measureOffset'. Open
$left = Math::add($left, $parent->getStyle()->getOffsetLeft());
- 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 measurePosition uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->getCoordinates()->setY($this->getClosestLineBox()->getCoordinates()->getY());
}
- 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 unused parameters such as '$afterPageDividing'. Open
public function measureHeight(bool $afterPageDividing = false)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$style = $this->getStyle();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function measureHeight(bool $afterPageDividing = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->getChildren() as $child) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$child->measureWidth($afterPageDividing);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$outerWidth = $child->getDimensions()->getOuterWidth();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->getChildren() as $child) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$child->measureWidth($afterPageDividing);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$maxWidth = Math::add($maxWidth, $style->getHorizontalBordersWidth(), $style->getHorizontalPaddingsWidth());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->applyStyleWidth();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function measureWidth(bool $afterPageDividing = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$maxWidth = Math::max($maxWidth, $outerWidth);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Measure width.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->getDimensions()->setWidth($maxWidth);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return $this
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return $this
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$maxWidth = '0';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $afterPageDividing
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Measure height.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->divideLines();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $afterPageDividing
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$height = '0';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$height = Math::add($height, $style->getVerticalBordersWidth(), $style->getVerticalPaddingsWidth());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $afterPageDividing
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parent = $this->getParent();
- Exclude checks
Line exceeds 120 characters; contains 161 characters Open
$left = Math::add($left, $previous->getOffset()->getLeft(), $previous->getDimensions()->getWidth(), $previous->getStyle()->getRules('margin-right'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->coordinates = clone $this->coordinates;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// margin top inside inline and inline block doesn't affect relative to line top position
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$parent instanceof InlineBox) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->getCoordinates()->setY($this->getClosestLineBox()->getCoordinates()->getY());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$left = (string) $rules['margin-left'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$left = Math::add($left, $previous->getOffset()->getLeft(), $previous->getDimensions()->getWidth(), $previous->getStyle()->getRules('margin-right'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$left = Math::add($left, $parent->getStyle()->getOffsetLeft());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->style = clone $this->style;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Position.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function measureOffset(bool $afterPageDividing = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->getCoordinates()->setY(Math::add($parent->getCoordinates()->getY(), $this->getOffset()->getTop()));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __clone()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->children = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Position.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $afterPageDividing
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->getChildren() as $child) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$child->measurePosition($afterPageDividing);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->applyStyleHeight();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$top = $parent->getStyle()->getOffsetTop();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->getOffset()->setLeft($left);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->getChildren() as $child) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->getDimensions()->setHeight($height);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// it only affects line margins
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$child->measureOffset($afterPageDividing);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parent = $this->getParent();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return $this
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->dimensions = clone $this->dimensions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$child->measureHeight();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->getCoordinates()->setX(Math::add($parent->getCoordinates()->getX(), $this->getOffset()->getLeft()));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->offset = clone $this->offset;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($previous = $this->getPrevious()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->element) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->getOffset()->setTop($top);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->element = clone $this->element;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$height = Math::add($height, $child->getDimensions()->getOuterHeight());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return $this
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function measurePosition(bool $afterPageDividing = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rules = $this->getStyle()->getRules();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$style = $this->getStyle();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->getChildren() as $child) {
- Exclude checks