YetiForceCompany/YetiForcePDF

View on GitHub

Showing 15,735 of 15,735 total issues

The class ElementBox has an overall complexity of 59 which is very high. The configured complexity threshold is 50.
Open

class ElementBox extends Box
{
    /**
     * @var Element
     */
Severity: Minor
Found in lib/Layout/ElementBox.php by phpmd

The class Page has an overall complexity of 124 which is very high. The configured complexity threshold is 50.
Open

class Page extends \YetiForcePDF\Objects\Basic\DictionaryObject
{
    /**
     * @var int
     */
Severity: Minor
Found in lib/Page.php by phpmd

The class BoxDimensions has an overall complexity of 86 which is very high. The configured complexity threshold is 50.
Open

class BoxDimensions extends Dimensions
{
    /**
     * @var Box
     */

The class TableBox has an overall complexity of 219 which is very high. The configured complexity threshold is 50.
Open

class TableBox extends BlockBox
{
    /**
     * @var array minimal widths
     */
Severity: Minor
Found in lib/Layout/TableBox.php by phpmd

The class BlockBox has an overall complexity of 94 which is very high. The configured complexity threshold is 50.
Open

class BlockBox extends ElementBox implements BoxInterface, AppendChildInterface, BuildTreeInterface
{
    /**
     * @var \YetiForcePDF\Layout\LineBox
     */
Severity: Minor
Found in lib/Layout/BlockBox.php by phpmd

File LineBox.php has 303 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);
/**
 * LineBox class.
Severity: Minor
Found in lib/Layout/LineBox.php - About 3 hrs to fix

    Function parse has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function parse()
        {
            if ($this->parsed) {
                return $this;
            }
    Severity: Minor
    Found in lib/Style/Style.php - About 3 hrs 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

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

        public function measureOffset(bool $afterPageDividing = false)
        {
            if (!$this->isDisplayable()) {
                return $this;
            }
    Severity: Major
    Found in lib/Layout/HeaderBox.php and 1 other location - About 3 hrs to fix
    lib/Layout/WatermarkBox.php on lines 62..78

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

    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 2 locations. Consider refactoring.
    Open

        public function measureOffset(bool $afterPageDividing = false)
        {
            if (!$this->isRenderable()) {
                return $this;
            }
    Severity: Major
    Found in lib/Layout/WatermarkBox.php and 1 other location - About 3 hrs to fix
    lib/Layout/HeaderBox.php on lines 62..78

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

    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 parse has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function parse()
        {
            if ($this->parsed) {
                return $this;
            }
    Severity: Major
    Found in lib/Style/Style.php - About 3 hrs to fix

      Method buildTree has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function buildTree($parentBlock = null)
          {
              if ($this->getElement()) {
                  $domElement = $this->getElement()->getDOMElement();
              } else {
      Severity: Major
      Found in lib/Layout/ElementBox.php - About 3 hrs to fix

        Method divideTable has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function divideTable(Box $tableChild, string $yPos, Box $cloned)
            {
                $tableWrapperBox = $tableChild->getClosestByType('TableWrapperBox');
                if ($this->treatTableLikeDiv($tableWrapperBox, $yPos)) {
                    return $this->cutBox($tableWrapperBox, $yPos, $cloned);
        Severity: Major
        Found in lib/Page.php - About 2 hrs to fix

          File InlineBox.php has 282 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          declare(strict_types=1);
          /**
           * InlineBox class.
          Severity: Minor
          Found in lib/Layout/InlineBox.php - About 2 hrs to fix

            Function clearStyles has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                public function clearStyles()
                {
                    $allNestedChildren = [];
                    $maxLevel = '0';
                    foreach ($this->getChildren() as $child) {
            Severity: Minor
            Found in lib/Layout/LineBox.php - About 2 hrs 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

            Function addToOthers has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function addToOthers(string $leftSpace, bool $withPreferred = false)
                {
                    // first of all try to redistribute space to columns that need it most (width is under preferred)
                    // left space is the space that we can add to other column types that needs extra space to preferred width
                    if ($withPreferred) {
            Severity: Minor
            Found in lib/Layout/TableBox.php - About 2 hrs 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

            Function measureWidth has a Cognitive Complexity of 19 (exceeds 5 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 2 hrs 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

            Method parse has 63 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function parse()
                {
                    if ('' === $this->html) {
                        return null;
                    }
            Severity: Major
            Found in lib/Html/Parser.php - About 2 hrs to fix

              Function parse has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function parse()
                  {
                      if ('' === $this->html) {
                          return null;
                      }
              Severity: Minor
              Found in lib/Html/Parser.php - About 2 hrs 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

              Function addToPreferredOthers has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function addToPreferredOthers(string $leftSpace)
                  {
                      $autoNeededTotal = '0';
                      $pixelNeededTotal = '0';
                      $autoNeeded = [];
              Severity: Minor
              Found in lib/Layout/TableBox.php - About 2 hrs 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

              Function matchFont has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function matchFont(bool $custom = false)
                  {
                      if (!$custom) {
                          return static::$fontFiles[$this->family][$this->weight][$this->style];
                      }
              Severity: Minor
              Found in lib/Objects/Font.php - About 2 hrs 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