Function addElement
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function addElement(string $childElement, string $attrKey = '', string $attrValue = '', string $data = '', bool $selfClosing = false)
{
// if previous current element was not written to html string and the same child element is set
// than this could be a call of parent class so do not reinitialize the current element
if (!$this->currentElementDataWritten && $childElement === $this->currentElement) {
- 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 addElement
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addElement(string $childElement, string $attrKey = '', string $attrValue = '', string $data = '', bool $selfClosing = false)
{
// if previous current element was not written to html string and the same child element is set
// than this could be a call of parent class so do not reinitialize the current element
if (!$this->currentElementDataWritten && $childElement === $this->currentElement) {
Function closeParentElement
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function closeParentElement(string $parentElement): bool
{
// count entries in array
$totalCount = count($this->arrParentElements);
- 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 addParentElement
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function addParentElement(string $parentElement, string $attrKey = '', string $attrValue = '')
{
// Only possible for child elements of the main element or nesting mode is active!
if (!$this->nesting && $this->currentElement === $this->mainElement) {
return;
- 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 addAttribute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function addAttribute(string $attrKey, string $attrValue, string $element = '')
{
if ($element === '') {
$element = $this->currentElement;
}
- 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 addElement
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function addElement(string $childElement, string $attrKey = '', string $attrValue = '', string $data = '', bool $selfClosing = false)
Function addData
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function addData($data, bool $selfClosing = false)
{
if ($selfClosing) {
$startTag = '<' . $this->currentElement . $this->getCurrentElementAttributesString();
$endTag = '/>';
- 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"