YetiForceCompany/YetiForcePDF

View on GitHub

Showing 155 of 15,735 total issues

Function setUpWidths has a Cognitive Complexity of 30 (exceeds 5 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 4 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 shrinkToFit has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    protected function shrinkToFit(string $availableSpace, int $step)
    {
        $parentStyle = $this->getParent()->getStyle();
        $parentSpacing = Math::add($parentStyle->getHorizontalBordersWidth(), $parentStyle->getHorizontalPaddingsWidth());
        $availableSpace = Math::sub($availableSpace, $this->cellSpacingWidth, $parentSpacing);
Severity: Minor
Found in lib/Layout/TableBox.php - About 4 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

BlockBox has 33 functions (exceeds 20 allowed). Consider refactoring.
Open

class BlockBox extends ElementBox implements BoxInterface, AppendChildInterface, BuildTreeInterface
{
    /**
     * @var \YetiForcePDF\Layout\LineBox
     */
Severity: Minor
Found in lib/Layout/BlockBox.php - About 4 hrs to fix

    Function spanColumns has a Cognitive Complexity of 28 (exceeds 5 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 4 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 appendText has a Cognitive Complexity of 28 (exceeds 5 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 4 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 fixTables has 101 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function fixTables()
        {
            $box = $this->getBox();
            if ($box->wasCut()) {
                return $this;
    Severity: Major
    Found in lib/Style/Style.php - About 4 hrs to fix

      Method shrinkToFit has 100 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function shrinkToFit(string $availableSpace, int $step)
          {
              $parentStyle = $this->getParent()->getStyle();
              $parentSpacing = Math::add($parentStyle->getHorizontalBordersWidth(), $parentStyle->getHorizontalPaddingsWidth());
              $availableSpace = Math::sub($availableSpace, $this->cellSpacingWidth, $parentSpacing);
      Severity: Major
      Found in lib/Layout/TableBox.php - About 4 hrs to fix

        Function applyPercentage has a Cognitive Complexity of 27 (exceeds 5 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 3 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

        Font has 31 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Font extends \YetiForcePDF\Objects\Resource
        {
            protected static $fontFiles = [
                'DejaVu Sans' => [
                    '100' => [
        Severity: Minor
        Found in lib/Objects/Font.php - About 3 hrs to fix

          Method loadFontData has 91 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function loadFontData()
              {
                  $fileName = $this->getFontFileName();
                  $fileContent = file_get_contents($fileName);
                  $font = \FontLib\Font::load($fileName);
          Severity: Major
          Found in lib/Objects/Font.php - About 3 hrs to fix

            Method fixTables has 90 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function fixTables()
                {
                    $tables = $this->getBoxesByType('TableWrapperBox');
                    foreach ($tables as $tableWrapperBox) {
                        $tableBox = $tableWrapperBox->getFirstChild();
            Severity: Major
            Found in lib/Layout/ElementBox.php - About 3 hrs to fix

              Function setGroupOptions has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function setGroupOptions(PageGroupBox $root, \DOMDocument $domDocument)
                  {
                      $childDomElement = $domDocument->documentElement->firstChild;
                      if (!$childDomElement instanceof \DOMElement) {
                          return $this;
              Severity: Minor
              Found in lib/Html/Parser.php - About 3 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 getOuterWidth has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getOuterWidth()
                  {
                      $box = $this->getBox();
                      if (!$box->isForMeasurement() && !$this->getBox()->getStyle()->haveSpacing()) {
                          return '0';
              Severity: Minor
              Found in lib/Layout/Dimensions/BoxDimensions.php - About 3 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 addBorderInstructions has 89 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function addBorderInstructions(array $element, string $pdfX, string $pdfY, string $width, string $height)
                  {
                      if ('none' === $this->getStyle()->getRules('display')) {
                          return $element;
                      }
              Severity: Major
              Found in lib/Layout/Box.php - About 3 hrs to fix

                File BoxDimensions.php has 311 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                declare(strict_types=1);
                /**
                 * BoxDimensions class.
                Severity: Minor
                Found in lib/Layout/Dimensions/BoxDimensions.php - About 3 hrs to fix

                  Function getMaxWidth has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                  Open

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

                  File LineBox.php has 303 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  declare(strict_types=1);
                  /**
                   * LineBox class.
                  Severity: Minor
                  Found in lib/Layout/LineBox.php - About 3 hrs to fix

                    Function parse has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function parse()
                        {
                            if ($this->parsed) {
                                return $this;
                            }
                    Severity: Minor
                    Found in lib/Style/Style.php - About 3 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 77 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function parse()
                        {
                            if ($this->parsed) {
                                return $this;
                            }
                    Severity: Major
                    Found in lib/Style/Style.php - About 3 hrs to fix

                      Method buildTree has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function buildTree($parentBlock = null)
                          {
                              if ($this->getElement()) {
                                  $domElement = $this->getElement()->getDOMElement();
                              } else {
                      Severity: Major
                      Found in lib/Layout/ElementBox.php - About 3 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language