YetiForceCompany/YetiForcePDF

View on GitHub

Showing 155 of 15,735 total issues

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

        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

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

        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

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

                  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

                      Severity
                      Category
                      Status
                      Source
                      Language