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()) {
- 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
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);
- 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
BlockBox
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
class BlockBox extends ElementBox implements BoxInterface, AppendChildInterface, BuildTreeInterface
{
/**
* @var \YetiForcePDF\Layout\LineBox
*/
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) {
- 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
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) {
- 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 fixTables
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fixTables()
{
$box = $this->getBox();
if ($box->wasCut()) {
return $this;
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);
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) {
- 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
Font
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
class Font extends \YetiForcePDF\Objects\Resource
{
protected static $fontFiles = [
'DejaVu Sans' => [
'100' => [
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);
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();
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;
- 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
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';
- 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 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;
}
File BoxDimensions.php
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
/**
* BoxDimensions class.
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';
- 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
File LineBox.php
has 303 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
/**
* LineBox class.
Function parse
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
protected function parse()
{
if ($this->parsed) {
return $this;
}
- 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 parse
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function parse()
{
if ($this->parsed) {
return $this;
}
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 {