YetiForceCompany/YetiForcePDF

View on GitHub

Showing 155 of 15,735 total issues

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

Method spanColumns has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function spanColumns()
    {
        $colSpans = [];
        foreach ($this->getChildren() as $column) {
            if ($column->getColSpan() > 1) {
Severity: Minor
Found in lib/Layout/TableRowBox.php - About 1 hr to fix

    Method getNumberValues has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getNumberValues($ruleValue, bool $isFont = false)
        {
            if ($ruleValue instanceof NumericValue) {
                return $ruleValue;
            }
    Severity: Minor
    Found in lib/Style/Normalizer/Normalizer.php - About 1 hr to fix

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

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

          Function alignText has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              public function alignText()
              {
                  if ($this instanceof LineBox) {
                      $textAlign = $this->getParent()->getStyle()->getRules('text-align');
                      if ('right' === $textAlign) {
          Severity: Minor
          Found in lib/Layout/Box.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

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

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

                      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

                        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

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

                            public function addPage(string $format = '', string $orientation = '', Page $page = null, Page $after = null): Page
                            {
                                if (null === $page) {
                                    $page = (new Page())->setDocument($this)->init();
                                }
                        Severity: Minor
                        Found in lib/Document.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 getBoxesByTagName has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getBoxesByTagName(string $tagName)
                            {
                                $boxes = [];
                                $allChildren = [];
                                $this->getAllChildren($allChildren);
                        Severity: Minor
                        Found in lib/Layout/ElementBox.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 getChildren has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getChildren(bool $onlyRenderable = false, bool $onlyForMeasurment = false): array
                            {
                                if (!$onlyRenderable && !$onlyForMeasurment) {
                                    return $this->children;
                                }
                        Severity: Minor
                        Found in lib/Layout/Box.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 addObject has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function addObject(PdfObject $object, $after = null): self
                            {
                                $afterIndex = \count($this->objects);
                                if ($after) {
                                    foreach ($this->objects as $afterIndex => $obj) {
                        Severity: Minor
                        Found in lib/Document.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 measureOffset has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function measureOffset(bool $afterPageDividing = false)
                            {
                                if (\YetiForcePDF\Page::CUT_BELOW === $this->wasCut()) {
                                    return $this;
                                }
                        Severity: Minor
                        Found in lib/Layout/BlockBox.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 cloneAndDivideChildrenAfterY has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function cloneAndDivideChildrenAfterY(string $yPos, array $boxes = null)
                            {
                                if (null === $boxes) {
                                    $boxes = [];
                                    foreach ($this->getBox()->getChildren() as $child) {
                        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