YetiForceCompany/YetiForcePDF

View on GitHub

Showing 15,735 of 15,735 total issues

Page has 40 functions (exceeds 20 allowed). Consider refactoring.
Open

class Page extends \YetiForcePDF\Objects\Basic\DictionaryObject
{
    /**
     * @var int
     */
Severity: Minor
Found in lib/Page.php - About 5 hrs to fix

    TableBox has 39 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class TableBox extends BlockBox
    {
        /**
         * @var array minimal widths
         */
    Severity: Minor
    Found in lib/Layout/TableBox.php - About 5 hrs to fix

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

          protected function layoutFooter(FooterBox $footer)
          {
              $footer = $footer->cloneWithChildren();
              $box = $this->getBox();
              if (!$box->hasChildren()) {
      Severity: Major
      Found in lib/Page.php and 2 other locations - About 5 hrs to fix
      lib/Page.php on lines 813..832
      lib/Page.php on lines 869..888

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

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

          protected function layoutWatermark(WatermarkBox $watermark)
          {
              $watermark = $watermark->cloneWithChildren();
              $box = $this->getBox();
              if (!$box->hasChildren()) {
      Severity: Major
      Found in lib/Page.php and 2 other locations - About 5 hrs to fix
      lib/Page.php on lines 813..832
      lib/Page.php on lines 841..860

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

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

          protected function layoutHeader(HeaderBox $header)
          {
              $header = $header->cloneWithChildren();
              $box = $this->getBox();
              if (!$box->hasChildren()) {
      Severity: Major
      Found in lib/Page.php and 2 other locations - About 5 hrs to fix
      lib/Page.php on lines 841..860
      lib/Page.php on lines 869..888

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

      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

      Method measureHeight has 125 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function measureHeight(bool $afterPageDividing = false)
          {
              if ($this->wasCut()) {
                  return $this;
              }
      Severity: Major
      Found in lib/Layout/TableBox.php - About 5 hrs to fix

        Function spanRows has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            public function spanRows()
            {
                $toRemove = [];
                foreach ($this->getChildren() as $rowGroup) {
                    foreach ($rowGroup->getChildren() as $rowIndex => $row) {
        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 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

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

                        foreach ($this->autoColumns as $columnIndex => $columns) {
                            if (isset($autoNeeded[$columnIndex])) {
                                Math::setAccurate(true);
                                $neededRatio = Math::div($autoNeeded[$columnIndex], $autoNeededTotal);
                                $add = Math::mul($neededRatio, $addToAutoTotal);
                Severity: Major
                Found in lib/Layout/TableBox.php and 1 other location - About 3 hrs to fix
                lib/Layout/TableBox.php on lines 484..497

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

                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

                        foreach ($this->pixelColumns as $columnIndex => $columns) {
                            if (isset($pixelNeeded[$columnIndex])) {
                                Math::setAccurate(true);
                                $neededRatio = Math::div($pixelNeeded[$columnIndex], $pixelNeededTotal);
                                $add = Math::mul($neededRatio, $addToPixelTotal);
                Severity: Major
                Found in lib/Layout/TableBox.php and 1 other location - About 3 hrs to fix
                lib/Layout/TableBox.php on lines 470..483

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

                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

                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
                    Severity
                    Category
                    Status
                    Source
                    Language