YetiForceCompany/YetiForcePDF

View on GitHub

Showing 15,735 of 15,735 total issues

File Style.php has 1259 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);
/**
 * Style class.
Severity: Major
Found in lib/Style/Style.php - About 3 days to fix

    File TableBox.php has 979 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      File Page.php has 934 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      declare(strict_types=1);
      /**
       * Page class.
      Severity: Major
      Found in lib/Page.php - About 2 days to fix

        Function fixTables has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring.
        Open

            public function fixTables()
            {
                $box = $this->getBox();
                if ($box->wasCut()) {
                    return $this;
        Severity: Minor
        Found in lib/Style/Style.php - About 1 day 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 fixTables has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring.
        Open

            public function fixTables()
            {
                $tables = $this->getBoxesByType('TableWrapperBox');
                foreach ($tables as $tableWrapperBox) {
                    $tableBox = $tableWrapperBox->getFirstChild();
        Severity: Minor
        Found in lib/Layout/ElementBox.php - About 1 day 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 measureHeight has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
        Open

            public function measureHeight(bool $afterPageDividing = false)
            {
                if ($this->wasCut()) {
                    return $this;
                }
        Severity: Minor
        Found in lib/Layout/TableBox.php - About 1 day 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

        File Box.php has 679 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        declare(strict_types=1);
        /**
         * Box class.
        Severity: Major
        Found in lib/Layout/Box.php - About 1 day to fix

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

                  if ($style->getRules('border-right-width') && 'none' !== $style->getRules('border-right-style') && 'transparent' !== $style->getRules('border-right-color')) {
                      $path = implode(" l\n", [
                          implode(' ', [$x2, $y2]),
                          implode(' ', [Math::sub($x2, $style->getRules('border-right-width')), Math::add($y2, $style->getRules('border-bottom-width'))]),
                          implode(' ', [Math::sub($x2, $style->getRules('border-right-width')), Math::sub($y1, $style->getRules('border-top-width'))]),
          Severity: Major
          Found in lib/Layout/Box.php and 1 other location - About 1 day to fix
          lib/Layout/Box.php on lines 1132..1150

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

          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

                  if ($style->getRules('border-bottom-width') && 'none' !== $style->getRules('border-bottom-style') && 'transparent' !== $style->getRules('border-bottom-color')) {
                      $path = implode(" l\n", [
                          implode(' ', [$x2, $y2]),
                          implode(' ', [Math::sub($x2, $style->getRules('border-right-width')), Math::add($y2, $style->getRules('border-bottom-width'))]),
                          implode(' ', [Math::add($x1, $style->getRules('border-left-width')), Math::add($y2, $style->getRules('border-bottom-width'))]),
          Severity: Major
          Found in lib/Layout/Box.php and 1 other location - About 1 day to fix
          lib/Layout/Box.php on lines 1113..1131

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

          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

          Box has 62 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Box extends \YetiForcePDF\Base
          {
              /**
               * Id of this box (should be cloned to track inline wrapped elements).
               *
          Severity: Major
          Found in lib/Layout/Box.php - About 1 day to fix

            Function divideTable has a Cognitive Complexity of 56 (exceeds 5 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: Minor
            Found in lib/Page.php - About 1 day 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

            Style has 60 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Style extends \YetiForcePDF\Base
            {
                /**
                 * @var \YetiForcePDF\Document
                 */
            Severity: Major
            Found in lib/Style/Style.php - About 1 day to fix

              File BlockBox.php has 517 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              declare(strict_types=1);
              /**
               * BlockBox class.
              Severity: Major
              Found in lib/Layout/BlockBox.php - About 1 day to fix

                File Document.php has 457 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

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

                  Document has 48 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Document
                  {
                      /**
                       * Actual id auto incremented.
                       *
                  Severity: Minor
                  Found in lib/Document.php - About 6 hrs to fix

                    File Font.php has 436 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

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

                      Function buildTree has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function buildTree($parentBlock = null)
                          {
                              if ($this->getElement()) {
                                  $domElement = $this->getElement()->getDOMElement();
                              } else {
                      Severity: Minor
                      Found in lib/Layout/ElementBox.php - About 6 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 divide has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function divide()
                          {
                              $lines = [];
                              $line = (new self())
                                  ->setDocument($this->document)
                      Severity: Minor
                      Found in lib/Layout/LineBox.php - About 6 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

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

                          public function addBackgroundColorInstructions(array $element, $pdfX, $pdfY, $width, $height)
                          {
                              if ('none' === $this->getStyle()->getRules('display')) {
                                  return $element;
                              }
                      Severity: Major
                      Found in lib/Layout/InlineBox.php and 1 other location - About 5 hrs to fix
                      lib/Layout/BlockBox.php on lines 724..746

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

                      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

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

                          public function addBackgroundColorInstructions(array $element, $pdfX, $pdfY, $width, $height)
                          {
                              if ('none' === $this->getStyle()->getRules('display')) {
                                  return $element;
                              }
                      Severity: Major
                      Found in lib/Layout/BlockBox.php and 1 other location - About 5 hrs to fix
                      lib/Layout/InlineBox.php on lines 369..390

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language