Showing 287 of 15,735 total issues
Function addPage
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function addPage(string $format = '', string $orientation = '', Page $page = null, Page $after = null): Page
{
if (null === $page) {
$page = (new Page())->setDocument($this)->init();
}
- 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 getBoxesByTagName
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getBoxesByTagName(string $tagName)
{
$boxes = [];
$allChildren = [];
$this->getAllChildren($allChildren);
- 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 getChildren
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getChildren(bool $onlyRenderable = false, bool $onlyForMeasurment = false): array
{
if (!$onlyRenderable && !$onlyForMeasurment) {
return $this->children;
}
- 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 addObject
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function addObject(PdfObject $object, $after = null): self
{
$afterIndex = \count($this->objects);
if ($after) {
foreach ($this->objects as $afterIndex => $obj) {
- 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 measureOffset
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function measureOffset(bool $afterPageDividing = false)
{
if (\YetiForcePDF\Page::CUT_BELOW === $this->wasCut()) {
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 cloneAndDivideChildrenAfterY
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function cloneAndDivideChildrenAfterY(string $yPos, array $boxes = null)
{
if (null === $boxes) {
$boxes = [];
foreach ($this->getBox()->getChildren() as $child) {
- 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 getOuterWidth
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getOuterWidth()
{
$box = $this->getBox();
if (!$box->isForMeasurement() && !$this->getBox()->getStyle()->haveSpacing()) {
return '0';
Method getMaxWidth
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getMaxWidth()
{
$box = $this->getBox();
if (!$box->isForMeasurement()) {
return '0';
Method clearStyles
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function clearStyles()
{
$allNestedChildren = [];
$maxLevel = '0';
foreach ($this->getChildren() as $child) {
Method matchFont
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function matchFont(bool $custom = false)
{
if (!$custom) {
return static::$fontFiles[$this->family][$this->weight][$this->style];
}
Function removeChild
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function removeChild(self $child)
{
$oldChildren = $this->children; // copy children
$this->children = [];
foreach ($oldChildren as $currentChild) {
- 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 normalize
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function normalize($ruleValue, string $ruleName = ''): array
{
if (null !== $this->normalized) {
return $this->normalized;
}
Method setUpSizingTypes
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function setUpSizingTypes()
{
$columnSizingTypes = [];
// rowGroup -> row -> columns
$columns = $this->getFirstChild()->getFirstChild()->getChildren();
Method render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render(): string
{
$xref = '';
$this->buffer = '';
The class Document has 47 public methods and attributes. Consider reducing the number of public items to less than 45. Open
class Document
{
/**
* Actual id auto incremented.
*
- Read upRead up
- Exclude checks
ExcessivePublicCount
Since: 0.1
A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.
Example
public class Foo {
public $value;
public $something;
public $var;
// [... more more public attributes ...]
public function doWork() {}
public function doMoreWork() {}
public function doWorkAgain() {}
// [... more more public methods ...]
}
Source https://phpmd.org/rules/codesize.html#excessivepubliccount
The class Box has 58 public methods and attributes. Consider reducing the number of public items to less than 45. Open
class Box extends \YetiForcePDF\Base
{
/**
* Id of this box (should be cloned to track inline wrapped elements).
*
- Read upRead up
- Exclude checks
ExcessivePublicCount
Since: 0.1
A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.
Example
public class Foo {
public $value;
public $something;
public $var;
// [... more more public attributes ...]
public function doWork() {}
public function doMoreWork() {}
public function doWorkAgain() {}
// [... more more public methods ...]
}
Source https://phpmd.org/rules/codesize.html#excessivepubliccount
The class Style has 53 public methods and attributes. Consider reducing the number of public items to less than 45. Open
class Style extends \YetiForcePDF\Base
{
/**
* @var \YetiForcePDF\Document
*/
- Read upRead up
- Exclude checks
ExcessivePublicCount
Since: 0.1
A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.
Example
public class Foo {
public $value;
public $something;
public $var;
// [... more more public attributes ...]
public function doWork() {}
public function doMoreWork() {}
public function doWorkAgain() {}
// [... more more public methods ...]
}
Source https://phpmd.org/rules/codesize.html#excessivepubliccount
Method loadImage
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function loadImage(string $fileName)
{
if ('data:image' === substr($fileName, 0, 10)) {
$this->imageData = $this->convertToJpg($fileName);
} elseif (filter_var($fileName, FILTER_VALIDATE_URL)) {
Method addPage
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addPage(string $format = '', string $orientation = '', Page $page = null, Page $after = null): Page
{
if (null === $page) {
$page = (new Page())->setDocument($this)->init();
}
Method measureOffset
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function measureOffset(bool $afterPageDividing = false)
{
if (\YetiForcePDF\Page::CUT_BELOW === $this->wasCut()) {
return $this;
}