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
*/
TableBox
has 39 functions (exceeds 20 allowed). Consider refactoring. Open
class TableBox extends BlockBox
{
/**
* @var array minimal widths
*/
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()) {
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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()) {
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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()) {
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method measureHeight
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function measureHeight(bool $afterPageDividing = false)
{
if ($this->wasCut()) {
return $this;
}
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) {
- 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 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' => [
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);
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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);
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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();