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';
- Read upRead up
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;
}
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) {
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) {
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;
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) {
- Read upRead up
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;
}
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()) {
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();
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) {
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');
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
*/
- Read upRead up
- Exclude checks
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' => [
- Read upRead up
- Exclude checks
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
*/
- Read upRead up
- Exclude checks
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
*/
- Read upRead up
- Exclude checks
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).
*
- Read upRead up
- Exclude checks
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.
*
- Read upRead up
- Exclude checks
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) {
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;
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);
- Read upRead up
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"