YetiForceCompany/YetiForcePDF

View on GitHub

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

                    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