YetiForceCompany/YetiForcePDF

View on GitHub
lib/Layout/InlineBlockBox.php

Summary

Maintainability
A
0 mins
Test Coverage

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)
Severity: Minor
Found in lib/Layout/InlineBlockBox.php by phpmd

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)
Severity: Minor
Found in lib/Layout/InlineBlockBox.php by phpmd

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)
Severity: Minor
Found in lib/Layout/InlineBlockBox.php by phpmd

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)
Severity: Minor
Found in lib/Layout/InlineBlockBox.php by phpmd

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'));
Severity: Minor
Found in lib/Layout/InlineBlockBox.php by phpmd

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()));
Severity: Minor
Found in lib/Layout/InlineBlockBox.php by phpmd

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()));
Severity: Minor
Found in lib/Layout/InlineBlockBox.php by phpmd

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);
Severity: Minor
Found in lib/Layout/InlineBlockBox.php by phpmd

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());
Severity: Minor
Found in lib/Layout/InlineBlockBox.php by phpmd

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());
Severity: Minor
Found in lib/Layout/InlineBlockBox.php by phpmd

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());
Severity: Minor
Found in lib/Layout/InlineBlockBox.php by phpmd

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();
Severity: Minor
Found in lib/Layout/InlineBlockBox.php by phpmd

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());
        }
Severity: Minor
Found in lib/Layout/InlineBlockBox.php by phpmd

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());
Severity: Minor
Found in lib/Layout/InlineBlockBox.php by phpmd

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());
        }
Severity: Minor
Found in lib/Layout/InlineBlockBox.php by phpmd

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)
Severity: Minor
Found in lib/Layout/InlineBlockBox.php by phpmd

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

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

        $style = $this->getStyle();

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

    public function measureHeight(bool $afterPageDividing = false)

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

        foreach ($this->getChildren() as $child) {

Spaces must be used to indent lines; tabs are not allowed
Open

            $child->measureWidth($afterPageDividing);

Spaces must be used to indent lines; tabs are not allowed
Open

            $outerWidth = $child->getDimensions()->getOuterWidth();

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

        foreach ($this->getChildren() as $child) {

Spaces must be used to indent lines; tabs are not allowed
Open

            $child->measureWidth($afterPageDividing);

Spaces must be used to indent lines; tabs are not allowed
Open

        $maxWidth = Math::add($maxWidth, $style->getHorizontalBordersWidth(), $style->getHorizontalPaddingsWidth());

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->applyStyleWidth();

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    public function measureWidth(bool $afterPageDividing = false)

Spaces must be used to indent lines; tabs are not allowed
Open

            $maxWidth = Math::max($maxWidth, $outerWidth);

Spaces must be used to indent lines; tabs are not allowed
Open

        return $this;

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     * Measure width.

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->getDimensions()->setWidth($maxWidth);

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return $this

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return $this

Spaces must be used to indent lines; tabs are not allowed
Open

        $maxWidth = '0';

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param bool $afterPageDividing

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

     * Measure height.

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->divideLines();

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param bool $afterPageDividing

Spaces must be used to indent lines; tabs are not allowed
Open

        $height = '0';

Spaces must be used to indent lines; tabs are not allowed
Open

        $height = Math::add($height, $style->getVerticalBordersWidth(), $style->getVerticalPaddingsWidth());

Spaces must be used to indent lines; tabs are not allowed
Open

        return $this;

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param bool $afterPageDividing

Spaces must be used to indent lines; tabs are not allowed
Open

        $parent = $this->getParent();

Line exceeds 120 characters; contains 161 characters
Open

            $left = Math::add($left, $previous->getOffset()->getLeft(), $previous->getDimensions()->getWidth(), $previous->getStyle()->getRules('margin-right'));

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->coordinates = clone $this->coordinates;

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     */

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

Spaces must be used to indent lines; tabs are not allowed
Open

        if (!$parent instanceof InlineBox) {

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->getCoordinates()->setY($this->getClosestLineBox()->getCoordinates()->getY());

Spaces must be used to indent lines; tabs are not allowed
Open

        return $this;

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

        $left = (string) $rules['margin-left'];

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'));

Spaces must be used to indent lines; tabs are not allowed
Open

            $left = Math::add($left, $parent->getStyle()->getOffsetLeft());

Spaces must be used to indent lines; tabs are not allowed
Open

        return $this;

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->style = clone $this->style;

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

     * Position.

Spaces must be used to indent lines; tabs are not allowed
Open

    public function measureOffset(bool $afterPageDividing = false)

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->getCoordinates()->setY(Math::add($parent->getCoordinates()->getY(), $this->getOffset()->getTop()));

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    public function __clone()

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->children = [];

Spaces must be used to indent lines; tabs are not allowed
Open

     * Position.

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param bool $afterPageDividing

Spaces must be used to indent lines; tabs are not allowed
Open

        foreach ($this->getChildren() as $child) {

Spaces must be used to indent lines; tabs are not allowed
Open

            $child->measurePosition($afterPageDividing);

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->applyStyleHeight();

Spaces must be used to indent lines; tabs are not allowed
Open

        $top = $parent->getStyle()->getOffsetTop();

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->getOffset()->setLeft($left);

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

        foreach ($this->getChildren() as $child) {

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->getDimensions()->setHeight($height);

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

        // it only affects line margins

Spaces must be used to indent lines; tabs are not allowed
Open

            $child->measureOffset($afterPageDividing);

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

        $parent = $this->getParent();

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return $this

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->dimensions = clone $this->dimensions;

Spaces must be used to indent lines; tabs are not allowed
Open

            $child->measureHeight();

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

        } else {

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->getCoordinates()->setX(Math::add($parent->getCoordinates()->getX(), $this->getOffset()->getLeft()));

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->offset = clone $this->offset;

Spaces must be used to indent lines; tabs are not allowed
Open

        if ($previous = $this->getPrevious()) {

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

        if ($this->element) {

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->getOffset()->setTop($top);

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->element = clone $this->element;

Spaces must be used to indent lines; tabs are not allowed
Open

            $height = Math::add($height, $child->getDimensions()->getOuterHeight());

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return $this

Spaces must be used to indent lines; tabs are not allowed
Open

    public function measurePosition(bool $afterPageDividing = false)

Spaces must be used to indent lines; tabs are not allowed
Open

        } else {

Spaces must be used to indent lines; tabs are not allowed
Open

        $rules = $this->getStyle()->getRules();

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

        $style = $this->getStyle();

Spaces must be used to indent lines; tabs are not allowed
Open

        foreach ($this->getChildren() as $child) {

There are no issues that match your filters.

Category
Status