YetiForceCompany/YetiForcePDF

View on GitHub

Showing 15,735 of 15,735 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    public function measureWidth(bool $afterPageDividing = false)
    {
        if (!$this->isDisplayable()) {
            return $this;
        }
Severity: Major
Found in lib/Layout/HeaderBox.php and 2 other locations - About 1 hr to fix
lib/Layout/FooterBox.php on lines 31..46
lib/Layout/WatermarkBox.php on lines 31..46

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 119.

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

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    public function measureWidth(bool $afterPageDividing = false)
    {
        if (!$this->isRenderable()) {
            return $this;
        }
Severity: Major
Found in lib/Layout/WatermarkBox.php and 2 other locations - About 1 hr to fix
lib/Layout/FooterBox.php on lines 31..46
lib/Layout/HeaderBox.php on lines 31..46

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 119.

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

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    public function measureWidth(bool $afterPageDividing = false)
    {
        if (!$this->isDisplayable()) {
            return $this;
        }
Severity: Major
Found in lib/Layout/FooterBox.php and 2 other locations - About 1 hr to fix
lib/Layout/HeaderBox.php on lines 31..46
lib/Layout/WatermarkBox.php on lines 31..46

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 119.

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

Further Reading

Method getNumberValues has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getNumberValues($ruleValue, bool $isFont = false)
    {
        if ($ruleValue instanceof NumericValue) {
            return $ruleValue;
        }
Severity: Minor
Found in lib/Style/Normalizer/Normalizer.php - About 1 hr to fix

    Method spanColumns has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function spanColumns()
        {
            $colSpans = [];
            foreach ($this->getChildren() as $column) {
                if ($column->getColSpan() > 1) {
    Severity: Minor
    Found in lib/Layout/TableRowBox.php - About 1 hr to fix

      Method measureWidth has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function measureWidth(bool $afterPageDividing = false)
          {
              $dimensions = $this->getDimensions();
              $parent = $this->getParent();
              if ($parent) {
      Severity: Minor
      Found in lib/Layout/BlockBox.php - About 1 hr to fix

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            public function appendBlockBox($childDomElement, $element, $style, $parentBlock)
            {
                $box = (new BlockBox())
                    ->setDocument($this->document)
                    ->setParent($this)
        Severity: Major
        Found in lib/Layout/InlineBox.php and 2 other locations - About 1 hr to fix
        lib/Layout/InlineBox.php on lines 117..135
        lib/Layout/InlineBox.php on lines 140..156

        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 116.

        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

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            public function appendWatermarkBox($childDomElement, $element, $style, $parentBlock)
            {
                if ($this->getCurrentLineBox()) {
                    $this->closeLine();
                }
        Severity: Major
        Found in lib/Layout/BlockBox.php and 2 other locations - About 1 hr to fix
        lib/Layout/BlockBox.php on lines 187..204
        lib/Layout/BlockBox.php on lines 218..235

        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 116.

        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

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            public function appendFooterBox($childDomElement, $element, $style, $parentBlock)
            {
                if ($this->getCurrentLineBox()) {
                    $this->closeLine();
                }
        Severity: Major
        Found in lib/Layout/BlockBox.php and 2 other locations - About 1 hr to fix
        lib/Layout/BlockBox.php on lines 187..204
        lib/Layout/BlockBox.php on lines 249..266

        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 116.

        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

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            public function appendInlineBlockBox($childDomElement, $element, $style, $parentBlock)
            {
                $box = (new InlineBlockBox())
                    ->setDocument($this->document)
                    ->setParent($this)
        Severity: Major
        Found in lib/Layout/InlineBox.php and 2 other locations - About 1 hr to fix
        lib/Layout/InlineBox.php on lines 71..89
        lib/Layout/InlineBox.php on lines 140..156

        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 116.

        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

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            public function appendHeaderBox($childDomElement, $element, $style, $parentBlock)
            {
                if ($this->getCurrentLineBox()) {
                    $this->closeLine();
                }
        Severity: Major
        Found in lib/Layout/BlockBox.php and 2 other locations - About 1 hr to fix
        lib/Layout/BlockBox.php on lines 218..235
        lib/Layout/BlockBox.php on lines 249..266

        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 116.

        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

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            public function appendInlineBox($childDomElement, $element, $style, $parentBlock)
            {
                $box = (new self())
                    ->setDocument($this->document)
                    ->setParent($this)
        Severity: Major
        Found in lib/Layout/InlineBox.php and 2 other locations - About 1 hr to fix
        lib/Layout/InlineBox.php on lines 71..89
        lib/Layout/InlineBox.php on lines 117..135

        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 116.

        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

        Further Reading

        Avoid excessively long variable names like $reflectShortClassName. Keep variable name length under 20.
        Open

                    $reflectShortClassName = (new \ReflectionClass($child))->getShortName();
        Severity: Minor
        Found in lib/Layout/Box.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#longvariable

        Avoid excessively long variable names like $othersShouldHaveWidth. Keep variable name length under 20.
        Open

                $othersShouldHaveWidth = Math::mul($otherPercent, $onePercent);
        Severity: Minor
        Found in lib/Layout/TableBox.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#longvariable

        Avoid excessively long variable names like $totalPercentagesWidth. Keep variable name length under 20.
        Open

                $totalPercentagesWidth = '0';
        Severity: Minor
        Found in lib/Layout/TableBox.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#longvariable

        Avoid excessively long variable names like $totalPercentageSpecified. Keep variable name length under 20.
        Open

                $totalPercentageSpecified = '0';
        Severity: Minor
        Found in lib/Layout/TableBox.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#longvariable

        Avoid excessively long variable names like $totalPercentageColumnsWidth. Keep variable name length under 20.
        Open

                $totalPercentageColumnsWidth = '0';
        Severity: Minor
        Found in lib/Layout/TableBox.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#longvariable

        Avoid excessively long variable names like $totalPercentageSpecified. Keep variable name length under 20.
        Open

                $totalPercentageSpecified = $this->getTotalPercentage();
        Severity: Minor
        Found in lib/Layout/TableBox.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#longvariable

        Method breakAfter has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function breakAfter(Box $box)
            {
                $box = $box->getFirstRootChild();
                if ($box->getParent()->getLastChild() === $box) {
                    return $this;
        Severity: Minor
        Found in lib/Page.php - About 1 hr to fix

          Function alignText has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              public function alignText()
              {
                  if ($this instanceof LineBox) {
                      $textAlign = $this->getParent()->getStyle()->getRules('text-align');
                      if ('right' === $textAlign) {
          Severity: Minor
          Found in lib/Layout/Box.php - About 1 hr to fix

          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

          Severity
          Category
          Status
          Source
          Language