YetiForceCompany/YetiForcePDF

View on GitHub

Showing 287 of 15,735 total issues

Class "BlockBox" has 33 methods, which is greater than 20 authorized. Split it into smaller classes.
Open

class BlockBox extends ElementBox implements BoxInterface, AppendChildInterface, BuildTreeInterface
Severity: Major
Found in lib/Layout/BlockBox.php by sonar-php

A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

Refactor this function to reduce its Cognitive Complexity from 89 to the 15 allowed.
Open

    public function measureHeight(bool $afterPageDividing = false)
Severity: Critical
Found in lib/Layout/TableBox.php by sonar-php

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Reduce the number of returns of this function 4, down to the maximum allowed 3.
Open

    public function getInnerWidth(): string

Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

Noncompliant Code Example

With the default threshold of 3:

function myFunction(){ // Noncompliant as there are 4 return statements
  if (condition1) {
    return true;
  } else {
    if (condition2) {
      return false;
    } else {
      return true;
    }
  }
  return false;
}

Reduce the number of returns of this function 4, down to the maximum allowed 3.
Open

    public function getMinWidth()

Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

Noncompliant Code Example

With the default threshold of 3:

function myFunction(){ // Noncompliant as there are 4 return statements
  if (condition1) {
    return true;
  } else {
    if (condition2) {
      return false;
    } else {
      return true;
    }
  }
  return false;
}

Refactor this function to reduce its Cognitive Complexity from 24 to the 15 allowed.
Open

    public function getMaxWidth()

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Reduce the number of returns of this function 4, down to the maximum allowed 3.
Open

    public function getClosestByType(string $className)
Severity: Major
Found in lib/Layout/Box.php by sonar-php

Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

Noncompliant Code Example

With the default threshold of 3:

function myFunction(){ // Noncompliant as there are 4 return statements
  if (condition1) {
    return true;
  } else {
    if (condition2) {
      return false;
    } else {
      return true;
    }
  }
  return false;
}

Refactor this function to reduce its Cognitive Complexity from 19 to the 15 allowed.
Open

    public function measureWidth(bool $afterPageDividing = false)
Severity: Critical
Found in lib/Layout/BlockBox.php by sonar-php

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Reduce the number of returns of this function 5, down to the maximum allowed 3.
Open

    public function measureWidth(bool $afterPageDividing = false)
Severity: Major
Found in lib/Layout/TableBox.php by sonar-php

Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

Noncompliant Code Example

With the default threshold of 3:

function myFunction(){ // Noncompliant as there are 4 return statements
  if (condition1) {
    return true;
  } else {
    if (condition2) {
      return false;
    } else {
      return true;
    }
  }
  return false;
}

Reduce the number of returns of this function 4, down to the maximum allowed 3.
Open

    public function measureWidth(bool $afterPageDividing = false)
Severity: Major
Found in lib/Layout/BlockBox.php by sonar-php

Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

Noncompliant Code Example

With the default threshold of 3:

function myFunction(){ // Noncompliant as there are 4 return statements
  if (condition1) {
    return true;
  } else {
    if (condition2) {
      return false;
    } else {
      return true;
    }
  }
  return false;
}

Class "Page" has 40 methods, which is greater than 20 authorized. Split it into smaller classes.
Open

class Page extends \YetiForcePDF\Objects\Basic\DictionaryObject
Severity: Major
Found in lib/Page.php by sonar-php

A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

Refactor this function to reduce its Cognitive Complexity from 25 to the 15 allowed.
Open

    public function setGroupOptions(PageGroupBox $root, \DOMDocument $domDocument)
Severity: Critical
Found in lib/Html/Parser.php by sonar-php

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Reduce the number of returns of this function 4, down to the maximum allowed 3.
Open

    public function containContent()
Severity: Major
Found in lib/Layout/Box.php by sonar-php

Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

Noncompliant Code Example

With the default threshold of 3:

function myFunction(){ // Noncompliant as there are 4 return statements
  if (condition1) {
    return true;
  } else {
    if (condition2) {
      return false;
    } else {
      return true;
    }
  }
  return false;
}

Reduce the number of returns of this function 4, down to the maximum allowed 3.
Open

    public function applyStyleHeight()
Severity: Major
Found in lib/Layout/Box.php by sonar-php

Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

Noncompliant Code Example

With the default threshold of 3:

function myFunction(){ // Noncompliant as there are 4 return statements
  if (condition1) {
    return true;
  } else {
    if (condition2) {
      return false;
    } else {
      return true;
    }
  }
  return false;
}

Refactor this function to reduce its Cognitive Complexity from 30 to the 15 allowed.
Open

    public function setUpWidths(string $availableSpace)
Severity: Critical
Found in lib/Layout/TableBox.php by sonar-php

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Refactor this function to reduce its Cognitive Complexity from 54 to the 15 allowed.
Open

    protected function divideTable(Box $tableChild, string $yPos, Box $cloned)
Severity: Critical
Found in lib/Page.php by sonar-php

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Class "Document" has 48 methods, which is greater than 20 authorized. Split it into smaller classes.
Open

class Document
Severity: Major
Found in lib/Document.php by sonar-php

A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

Refactor this function to reduce its Cognitive Complexity from 25 to the 15 allowed.
Open

    public function getOuterWidth()

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Refactor this function to reduce its Cognitive Complexity from 19 to the 15 allowed.
Open

    protected function setUpSizingTypes()
Severity: Critical
Found in lib/Layout/TableBox.php by sonar-php

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Refactor this function to reduce its Cognitive Complexity from 26 to the 15 allowed.
Open

    protected function applyPercentage(string $availableSpace)
Severity: Critical
Found in lib/Layout/TableBox.php by sonar-php

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Class "Style" has 60 methods, which is greater than 20 authorized. Split it into smaller classes.
Open

class Style extends \YetiForcePDF\Base
Severity: Major
Found in lib/Style/Style.php by sonar-php

A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

Severity
Category
Status
Source
Language