YetiForceCompany/YetiForcePDF

View on GitHub

Showing 15,735 of 15,735 total issues

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

    protected function setUpSizingTypes()
    {
        $columnSizingTypes = [];
        // rowGroup -> row -> columns
        $columns = $this->getFirstChild()->getFirstChild()->getChildren();
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

Method divide has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function divide()
    {
        $lines = [];
        $line = (new self())
            ->setDocument($this->document)
Severity: Major
Found in lib/Layout/LineBox.php - About 2 hrs to fix

    Function tryPreferred has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function tryPreferred(string $leftSpace, bool $outerWidthSet)
        {
            // left space is 100% width that we can use
            $totalPercentages = '0';
            $totalPercentagesWidth = '0';
    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 breakAfter has a Cognitive Complexity of 17 (exceeds 5 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 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 addToPreferredOthers has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function addToPreferredOthers(string $leftSpace)
        {
            $autoNeededTotal = '0';
            $pixelNeededTotal = '0';
            $autoNeeded = [];
    Severity: Major
    Found in lib/Layout/TableBox.php - About 2 hrs to fix

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

                      foreach ($nonMinWidthColumns as $columnIndex => $columns) {
                          Math::setAccurate(true);
                          $ratio = Math::div($this->contentWidths[$columnIndex], $autoColumnsMaxWidth);
                          $columnWidth = Math::mul($toAutoDisposition, $ratio);
                          Math::setAccurate(false);
      Severity: Major
      Found in lib/Layout/TableBox.php and 1 other location - About 2 hrs to fix
      lib/Layout/TableBox.php on lines 986..996

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

      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

                      foreach ($this->pixelColumns as $columnIndex => $columns) {
                          Math::setAccurate(true);
                          $ratio = Math::div($this->preferredWidths[$columnIndex], $totalPixelWidth);
                          $columnWidth = Math::mul($toPixelDisposition, $ratio);
                          Math::setAccurate(false);
      Severity: Major
      Found in lib/Layout/TableBox.php and 1 other location - About 2 hrs to fix
      lib/Layout/TableBox.php on lines 1028..1038

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

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

          public function appendTableCellBox($childDomElement, $element, $style, $parentBlock)
          {
              $colSpan = 1;
              $style->setRule('display', 'block');
              $attributeColSpan = $childDomElement->getAttribute('colspan');
      Severity: Major
      Found in lib/Layout/TableRowBox.php - About 2 hrs to fix

        Method spanRows has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function spanRows()
            {
                $toRemove = [];
                foreach ($this->getChildren() as $rowGroup) {
                    foreach ($rowGroup->getChildren() as $rowIndex => $row) {
        Severity: Major
        Found in lib/Layout/TableBox.php - About 2 hrs to fix

          Method setGroupOptions has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function setGroupOptions(PageGroupBox $root, \DOMDocument $domDocument)
              {
                  $childDomElement = $domDocument->documentElement->firstChild;
                  if (!$childDomElement instanceof \DOMElement) {
                      return $this;
          Severity: Major
          Found in lib/Html/Parser.php - About 2 hrs to fix

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

            <?php
            
            $loader = require '../vendor/autoload.php';
            $files = ['LongTable'];
            foreach ($files as $file) {
            Severity: Major
            Found in examples/LongTable.php and 5 other locations - About 2 hrs to fix
            examples/H123456.php on lines 1..12
            examples/LongCellText.php on lines 1..12
            examples/LoremIpsum.php on lines 1..12
            examples/NotExported.php on lines 1..12
            examples/PagesTables.php on lines 1..12

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

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

            <?php
            
            $loader = require '../vendor/autoload.php';
            $files = ['LoremIpsum'];
            foreach ($files as $file) {
            Severity: Major
            Found in examples/LoremIpsum.php and 5 other locations - About 2 hrs to fix
            examples/H123456.php on lines 1..12
            examples/LongCellText.php on lines 1..12
            examples/LongTable.php on lines 1..12
            examples/NotExported.php on lines 1..12
            examples/PagesTables.php on lines 1..12

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

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

            <?php
            
            $loader = require '../vendor/autoload.php';
            $files = ['NotExported'];
            foreach ($files as $file) {
            Severity: Major
            Found in examples/NotExported.php and 5 other locations - About 2 hrs to fix
            examples/H123456.php on lines 1..12
            examples/LongCellText.php on lines 1..12
            examples/LongTable.php on lines 1..12
            examples/LoremIpsum.php on lines 1..12
            examples/PagesTables.php on lines 1..12

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

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

            <?php
            
            $loader = require '../vendor/autoload.php';
            $files = ['LongCellText'];
            foreach ($files as $file) {
            Severity: Major
            Found in examples/LongCellText.php and 5 other locations - About 2 hrs to fix
            examples/H123456.php on lines 1..12
            examples/LongTable.php on lines 1..12
            examples/LoremIpsum.php on lines 1..12
            examples/NotExported.php on lines 1..12
            examples/PagesTables.php on lines 1..12

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

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

            <?php
            
            $loader = require '../vendor/autoload.php';
            $files = ['PagesTables'];
            foreach ($files as $file) {
            Severity: Major
            Found in examples/PagesTables.php and 5 other locations - About 2 hrs to fix
            examples/H123456.php on lines 1..12
            examples/LongCellText.php on lines 1..12
            examples/LongTable.php on lines 1..12
            examples/LoremIpsum.php on lines 1..12
            examples/NotExported.php on lines 1..12

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

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

            <?php
            
            $loader = require '../vendor/autoload.php';
            $files = ['H123456'];
            foreach ($files as $file) {
            Severity: Major
            Found in examples/H123456.php and 5 other locations - About 2 hrs to fix
            examples/LongCellText.php on lines 1..12
            examples/LongTable.php on lines 1..12
            examples/LoremIpsum.php on lines 1..12
            examples/NotExported.php on lines 1..12
            examples/PagesTables.php on lines 1..12

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

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

                protected function tryPreferred(string $leftSpace, bool $outerWidthSet)
                {
                    // left space is 100% width that we can use
                    $totalPercentages = '0';
                    $totalPercentagesWidth = '0';
            Severity: Minor
            Found in lib/Layout/TableBox.php - About 2 hrs to fix

              Method applyPercentage has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function applyPercentage(string $availableSpace)
                  {
                      $currentRowsWidth = '0';
                      if ('auto' === $this->getParent()->getStyle()->getRules('width')) {
                          foreach ($this->getRows()[0]->getChildren() as $columnIndex => $column) {
              Severity: Minor
              Found in lib/Layout/TableBox.php - About 1 hr to fix

                Function cutBox has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function cutBox(Box $box, string $yPos, Box $cloned)
                    {
                        foreach ($box->getChildren() as $child) {
                            if (!$child->isForMeasurement() || !$child->isRenderable()) {
                                continue;
                Severity: Minor
                Found in lib/Page.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

                Function getOuterHeight has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getOuterHeight()
                    {
                        $box = $this->getBox();
                        if (!$box->isForMeasurement() && !$this->getBox()->getStyle()->haveSpacing()) {
                            return '0';
                Severity: Minor
                Found in lib/Layout/Dimensions/BoxDimensions.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