YetiForceCompany/YetiForcePDF

View on GitHub

Showing 15,735 of 15,735 total issues

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

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

    Method setUpWidths has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function setUpWidths(string $availableSpace)
        {
            foreach ($this->getChildren() as $rowGroup) {
                foreach ($rowGroup->getChildren() as $row) {
                    if ($columns = $row->getChildren()) {
    Severity: Minor
    Found in lib/Layout/TableBox.php - About 1 hr to fix

      Method getInstructions has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getInstructions(): string
          {
              $style = $this->getStyle();
              $rules = $style->getRules();
              $graphicState = $this->style->getGraphicState();
      Severity: Minor
      Found in lib/Layout/TextBox.php - About 1 hr to fix

        Method addToOthers has 38 lines of code (exceeds 25 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 1 hr to fix

          Method setUpAbsoluteBoxes has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function setUpAbsoluteBoxes()
              {
                  $this->document->setCurrentPage($this);
                  $this->getBox()->getOffset()->setLeft('0');
                  $this->getBox()->getOffset()->setTop('0');
          Severity: Minor
          Found in lib/Page.php - About 1 hr to fix

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

            <?php
            
            declare(strict_types=1);
            /**
             * BorderRightStyle class.
            Severity: Major
            Found in lib/Style/Normalizer/BorderRightStyle.php and 3 other locations - About 1 hr to fix
            lib/Style/Normalizer/BorderBottomStyle.php on lines 1..33
            lib/Style/Normalizer/BorderLeftStyle.php on lines 1..33
            lib/Style/Normalizer/BorderTopStyle.php on lines 1..33

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

            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

            <?php
            
            declare(strict_types=1);
            /**
             * BackgroundColor class.
            Severity: Major
            Found in lib/Style/Normalizer/BackgroundColor.php and 1 other location - About 1 hr to fix
            lib/Style/Normalizer/Color.php on lines 1..31

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

            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

            <?php
            
            declare(strict_types=1);
            /**
             * Color class.
            Severity: Major
            Found in lib/Style/Normalizer/Color.php and 1 other location - About 1 hr to fix
            lib/Style/Normalizer/BackgroundColor.php on lines 1..31

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

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

            <?php
            
            declare(strict_types=1);
            /**
             * BorderLeftStyle class.
            Severity: Major
            Found in lib/Style/Normalizer/BorderLeftStyle.php and 3 other locations - About 1 hr to fix
            lib/Style/Normalizer/BorderBottomStyle.php on lines 1..33
            lib/Style/Normalizer/BorderRightStyle.php on lines 1..33
            lib/Style/Normalizer/BorderTopStyle.php on lines 1..33

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

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

            <?php
            
            declare(strict_types=1);
            /**
             * BorderTopStyle class.
            Severity: Major
            Found in lib/Style/Normalizer/BorderTopStyle.php and 3 other locations - About 1 hr to fix
            lib/Style/Normalizer/BorderBottomStyle.php on lines 1..33
            lib/Style/Normalizer/BorderLeftStyle.php on lines 1..33
            lib/Style/Normalizer/BorderRightStyle.php on lines 1..33

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

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

            <?php
            
            declare(strict_types=1);
            /**
             * BorderBottomStyle class.
            Severity: Major
            Found in lib/Style/Normalizer/BorderBottomStyle.php and 3 other locations - About 1 hr to fix
            lib/Style/Normalizer/BorderLeftStyle.php on lines 1..33
            lib/Style/Normalizer/BorderRightStyle.php on lines 1..33
            lib/Style/Normalizer/BorderTopStyle.php on lines 1..33

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

            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

            The class Style has 16 fields. Consider redesigning Style to keep the number of fields under 15.
            Open

            class Style extends \YetiForcePDF\Base
            {
                /**
                 * @var \YetiForcePDF\Document
                 */
            Severity: Minor
            Found in lib/Style/Style.php by phpmd

            TooManyFields

            Since: 0.1

            Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

            Example

            class Person {
               protected $one;
               private $two;
               private $three;
               [... many more fields ...]
            }

            Source https://phpmd.org/rules/codesize.html#toomanyfields

            The class Font has 28 fields. Consider redesigning Font to keep the number of fields under 15.
            Open

            class Font extends \YetiForcePDF\Objects\Resource
            {
                protected static $fontFiles = [
                    'DejaVu Sans' => [
                        '100' => [
            Severity: Minor
            Found in lib/Objects/Font.php by phpmd

            TooManyFields

            Since: 0.1

            Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

            Example

            class Person {
               protected $one;
               private $two;
               private $three;
               [... many more fields ...]
            }

            Source https://phpmd.org/rules/codesize.html#toomanyfields

            The class TableBox has 16 fields. Consider redesigning TableBox to keep the number of fields under 15.
            Open

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

            TooManyFields

            Since: 0.1

            Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

            Example

            class Person {
               protected $one;
               private $two;
               private $three;
               [... many more fields ...]
            }

            Source https://phpmd.org/rules/codesize.html#toomanyfields

            The class Page has 17 fields. Consider redesigning Page to keep the number of fields under 15.
            Open

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

            TooManyFields

            Since: 0.1

            Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

            Example

            class Person {
               protected $one;
               private $two;
               private $three;
               [... many more fields ...]
            }

            Source https://phpmd.org/rules/codesize.html#toomanyfields

            The class Box has 19 fields. Consider redesigning Box to keep the number of fields under 15.
            Open

            class Box extends \YetiForcePDF\Base
            {
                /**
                 * Id of this box (should be cloned to track inline wrapped elements).
                 *
            Severity: Minor
            Found in lib/Layout/Box.php by phpmd

            TooManyFields

            Since: 0.1

            Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

            Example

            class Person {
               protected $one;
               private $two;
               private $three;
               [... many more fields ...]
            }

            Source https://phpmd.org/rules/codesize.html#toomanyfields

            The class Document has 23 fields. Consider redesigning Document to keep the number of fields under 15.
            Open

            class Document
            {
                /**
                 * Actual id auto incremented.
                 *
            Severity: Minor
            Found in lib/Document.php by phpmd

            TooManyFields

            Since: 0.1

            Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

            Example

            class Person {
               protected $one;
               private $two;
               private $three;
               [... many more fields ...]
            }

            Source https://phpmd.org/rules/codesize.html#toomanyfields

            Method appendText has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function appendText($childDomElement, $element = null, $style = null, $parentBlock = null)
                {
                    $text = $childDomElement->textContent;
                    $whiteSpace = $this->getStyle()->getRules('white-space');
                    switch ($whiteSpace) {
            Severity: Minor
            Found in lib/Layout/InlineBox.php - About 1 hr to fix

              Method expandPercentsToMin has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function expandPercentsToMin(string $availableSpace)
                  {
                      $totalPercentageSpecified = $this->getTotalPercentage();
                      $maxPercentRatio = '0';
                      $maxPercentRatioIndex = 0;
              Severity: Minor
              Found in lib/Layout/TableBox.php - About 1 hr to fix

                Function removeEmptyRows has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function removeEmptyRows()
                    {
                        foreach ($this->getChildren() as $rowGroup) {
                            if (!$rowGroup->containContent() || !$rowGroup->hasChildren()) {
                                $this->removeChild($rowGroup);
                Severity: Minor
                Found in lib/Layout/TableBox.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